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 anAttributeStatement
object to a list ofSignerIdentityAttributeValue
objects.static se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement
getAttributeStatement
(se.swedenconnect.schemas.saml_2_0.assertion.Assertion assertion) Given an assertion theAttributeStatement
is extracted.static String
getAttributeValue
(se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement statement, String name) Gets a String-attribute value from the given statement.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.static se.swedenconnect.schemas.saml_2_0.assertion.Attribute
toAttribute
(se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue value) Creates a SAMLAttribute
given aSignerIdentityAttributeValue
.static se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement
toAttributeStatement
(List<se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue> attributes) Converts a list ofSignerIdentityAttributeValue
objects into aAttributeStatement
element.static Object
toAttributeValue
(se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue siav) Given aSignerIdentityAttributeValue
the method extracts its value and converts it to the correct type.static se.swedenconnect.schemas.csig.dssext_1_1.CertRequestProperties
toCertRequestProperties
(se.idsec.signservice.integration.certificate.SigningCertificateRequirements certReqs, List<String> authnContextClassRefs) Converts aSigningCertificateRequirements
object into aCertRequestProperties
element.static se.swedenconnect.schemas.saml_2_0.assertion.NameIDType
Creates 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 theAttributeStatement
is 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
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 ofSignerIdentityAttributeValue
objects into aAttributeStatement
element.- 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 anAttributeStatement
object to a list ofSignerIdentityAttributeValue
objects.- 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 aSigningCertificateRequirements
object into aCertRequestProperties
element.- 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 SAMLAttribute
given 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 aSignerIdentityAttributeValue
the 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
SignerIdentityAttributeValue
instances will be created.- Parameters:
attribute
- the attribute to convert- Returns:
- a list of SignerIdentityAttributeValue objects
-