Class DssUtils
java.lang.Object
se.idsec.signservice.integration.dss.DssUtils
Utilities for creating DSS elements.
- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic List<se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue> fromAttributeStatement(se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement attributeStatement) Converts from anAttributeStatementobject to a list ofSignerIdentityAttributeValueobjects.static se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatementgetAttributeStatement(se.swedenconnect.schemas.saml_2_0.assertion.Assertion assertion) Given an assertion theAttributeStatementis extracted.static StringgetAttributeValue(se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement statement, String name) Gets a String-attribute value from the given statement.static <T> TgetAttributeValue(se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement statement, String name, Class<T> type) Gets an attribute value from the given statement having the given type.static se.swedenconnect.schemas.saml_2_0.assertion.AttributetoAttribute(se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue value) Creates a SAMLAttributegiven aSignerIdentityAttributeValue.static se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatementtoAttributeStatement(List<se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue> attributes) Converts a list ofSignerIdentityAttributeValueobjects into aAttributeStatementelement.static ObjecttoAttributeValue(se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue siav) Given aSignerIdentityAttributeValuethe method extracts its value and converts it to the correct type.static se.swedenconnect.schemas.csig.dssext_1_1.CertRequestPropertiestoCertRequestProperties(se.idsec.signservice.integration.certificate.SigningCertificateRequirements certReqs, List<String> authnContextClassRefs) Converts aSigningCertificateRequirementsobject into aCertRequestPropertieselement.static se.swedenconnect.schemas.saml_2_0.assertion.NameIDTypeCreates a NameID object.static List<se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue> toSignerIdentityAttributeValue(se.swedenconnect.schemas.saml_2_0.assertion.Attribute attribute) Given an attribute, the method transforms it into aSignerIdentityAttributeValue.
-
Field Details
-
DSS_PROFILE
The DSS profile we use.- See Also:
-
DSS_EXT_NAMESPACE
The namespace for DSS extension.- See Also:
-
-
Method Details
-
toEntity
Creates a NameID object.- Parameters:
name- the name- Returns:
- the NameID object
-
getAttributeStatement
public static se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement getAttributeStatement(se.swedenconnect.schemas.saml_2_0.assertion.Assertion assertion) Given an assertion theAttributeStatementis extracted.- Parameters:
assertion- the assertion- Returns:
- an AttributeStatement
-
getAttributeValue
public static String getAttributeValue(se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement statement, String name) Gets a String-attribute value from the given statement.- Parameters:
statement- the statementname- the attribute name- Returns:
- the value or null if no value is found
-
getAttributeValue
@Nullable public static <T> T getAttributeValue(se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement statement, String name, Class<T> type) Gets an attribute value from the given statement having the given type.- Parameters:
statement- the statementname- the attribute nametype- the type of the attribute value- Returns:
- the value or null if no value is found
-
toAttributeStatement
public static se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement toAttributeStatement(@Nonnull List<se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue> attributes) throws SignServiceProtocolException Converts a list ofSignerIdentityAttributeValueobjects into aAttributeStatementelement.- Parameters:
attributes- list of attributes- Returns:
- an AttributeStatement element
- Throws:
SignServiceProtocolException- for encoding/decoding errors
-
fromAttributeStatement
public static List<se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue> fromAttributeStatement(@Nonnull se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement attributeStatement) Converts from anAttributeStatementobject to a list ofSignerIdentityAttributeValueobjects.- Parameters:
attributeStatement- the statement to convert- Returns:
- a list of SignerIdentityAttributeValue objects
-
toCertRequestProperties
public static se.swedenconnect.schemas.csig.dssext_1_1.CertRequestProperties toCertRequestProperties(se.idsec.signservice.integration.certificate.SigningCertificateRequirements certReqs, List<String> authnContextClassRefs) Converts aSigningCertificateRequirementsobject into aCertRequestPropertieselement.- Parameters:
certReqs- signing certificate requirementsauthnContextClassRefs- the level of assurance(s)- Returns:
- a CertRequestProperties elements
-
toAttribute
public static se.swedenconnect.schemas.saml_2_0.assertion.Attribute toAttribute(se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue value) throws SignServiceProtocolException Creates a SAMLAttributegiven aSignerIdentityAttributeValue.- Parameters:
value- the value to transform into an Attribute- Returns:
- an Attribute
- Throws:
SignServiceProtocolException- for protocol errors
-
toAttributeValue
public static Object toAttributeValue(se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue siav) throws SignServiceProtocolException Given aSignerIdentityAttributeValuethe method extracts its value and converts it to the correct type.- Parameters:
siav- the object to convert- Returns:
- the attribute value
- Throws:
SignServiceProtocolException- for non supported values
-
toSignerIdentityAttributeValue
public static List<se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue> toSignerIdentityAttributeValue(se.swedenconnect.schemas.saml_2_0.assertion.Attribute attribute) Given an attribute, the method transforms it into aSignerIdentityAttributeValue.Note: If the attribute is multi-valued, several
SignerIdentityAttributeValueinstances will be created.- Parameters:
attribute- the attribute to convert- Returns:
- a list of SignerIdentityAttributeValue objects
-