Class DssUtils

java.lang.Object
se.idsec.signservice.integration.dss.DssUtils

public class DssUtils extends Object
Utilities for creating DSS elements.
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The namespace for DSS extension.
    static final String
    The DSS profile we use.
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue>
    fromAttributeStatement(se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement attributeStatement)
    Converts from an AttributeStatement object to a list of SignerIdentityAttributeValue objects.
    static se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement
    getAttributeStatement(se.swedenconnect.schemas.saml_2_0.assertion.Assertion assertion)
    Given an assertion the AttributeStatement 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 SAML Attribute given a SignerIdentityAttributeValue.
    static se.swedenconnect.schemas.saml_2_0.assertion.AttributeStatement
    toAttributeStatement(List<se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue> attributes)
    Converts a list of SignerIdentityAttributeValue objects into a AttributeStatement element.
    static Object
    toAttributeValue(se.idsec.signservice.integration.authentication.SignerIdentityAttributeValue siav)
    Given a SignerIdentityAttributeValue 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 a SigningCertificateRequirements object into a CertRequestProperties 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 a SignerIdentityAttributeValue.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • toEntity

      public static se.swedenconnect.schemas.saml_2_0.assertion.NameIDType toEntity(String name)
      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 the AttributeStatement 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 statement
      name - 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 statement
      name - the attribute name
      type - 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 of SignerIdentityAttributeValue objects into a AttributeStatement 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 an AttributeStatement object to a list of SignerIdentityAttributeValue 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 a SigningCertificateRequirements object into a CertRequestProperties element.
      Parameters:
      certReqs - signing certificate requirements
      authnContextClassRefs - 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 SAML Attribute given a SignerIdentityAttributeValue.
      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 a SignerIdentityAttributeValue 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 a SignerIdentityAttributeValue.

      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