se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue Maven / Gradle / Ivy
/*
* Copyright 2019-2024 IDsec Solutions AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package se.idsec.signservice.integration.authentication;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import lombok.Builder;
import lombok.ToString;
import se.idsec.signservice.integration.core.ObjectBuilder;
import java.io.Serial;
/**
* Representation of the value of a signer attribute.
*
*
* When a sign requester sends a SignRequest message it includes requirements on the signer regarding authenticated
* attributes. This class represents these requirements.
*
*
*
* Currently, the only supported attribute type is SAML. A missing type will represent SAML ({@link #getType()}).
*
*
* @author Martin Lindström ([email protected])
* @author Stefan Santesson ([email protected])
*/
@ToString(callSuper = true)
@JsonInclude(Include.NON_NULL)
public class SignerIdentityAttributeValue extends SignerIdentityAttribute {
@Serial
private static final long serialVersionUID = 3356867580368876329L;
/** The default name format to use. */
public static final String DEFAULT_NAME_FORMAT = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri";
/** The default attribute value type to use. We assume SAML's xs:string. */
public static final String DEFAULT_ATTRIBUTE_VALUE_TYPE = "string";
/** The attribute value (in its string representation). */
private String value;
/** The name format for the attribute. */
private String nameFormat;
/**
* The type for the attribute value. When SAML attributes are represented, this holds the XSI type without the
* namespace prefix.
*/
private String attributeValueType;
/**
* Default constructor.
*/
public SignerIdentityAttributeValue() {
}
/**
* Constructor.
*
* @param type the type of attribute (if {@code null}, SAML is assumed)
* @param name the name of the attribute
* @param value the value of the attribute
* @param nameFormat the name format
* @param attributeValueType the value type
*/
@Builder
public SignerIdentityAttributeValue(final String type, final String name, final String value,
final String nameFormat, final String attributeValueType) {
super(type, name);
this.value = value;
this.nameFormat = nameFormat;
this.attributeValueType = attributeValueType;
}
/**
* Gets the attribute value (in its string representation).
*
* @return the attribute value (in its string representation)
*/
public String getValue() {
return this.value;
}
/**
* Assigns the attribute value (in its string representation).
*
* @param value the attribute value (in its string representation)
*/
public void setValue(final String value) {
this.value = value;
}
/**
* Gets the name format for the attribute. When the attribute type is SAML the default is
* {@value #DEFAULT_NAME_FORMAT}.
*
* @return the name format for the attribute
*/
public String getNameFormat() {
return this.nameFormat;
}
/**
* Assigns the name format for the attribute. When the attribute type is SAML the default is
* {@value #DEFAULT_NAME_FORMAT}.
*
* @param nameFormat the (SAML) name format
*/
public void setNameFormat(final String nameFormat) {
this.nameFormat = nameFormat;
}
/**
* Gets the type for the attribute value. When SAML attributes are represented, this holds the XSI type without the
* namespace prefix. The default in those cases is {@value #DEFAULT_ATTRIBUTE_VALUE_TYPE}.
*
* @return the attribute value type
*/
public String getAttributeValueType() {
return this.attributeValueType;
}
/**
* Assigns the type for the attribute value. When SAML attributes are represented, this holds the XSI type without the
* namespace prefix. The default in those cases is {@value #DEFAULT_ATTRIBUTE_VALUE_TYPE}.
*
* @param attributeValueType the attribute value type
*/
public void setAttributeValueType(final String attributeValueType) {
this.attributeValueType = attributeValueType;
}
/**
* Builder for {@code SignerIdentityAttributeValue} objects.
*/
public static class SignerIdentityAttributeValueBuilder implements ObjectBuilder {
// Lombok will generate code ...
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy