Class DefaultNameIDGeneratorFactory

java.lang.Object
se.swedenconnect.spring.saml.idp.attributes.nameid.DefaultNameIDGeneratorFactory
All Implemented Interfaces:
NameIDGeneratorFactory

public class DefaultNameIDGeneratorFactory extends Object implements NameIDGeneratorFactory
A NameIDGeneratorFactory that implements the requirements regarding NameID's put by the Technical Specifications for the Swedish eID Framework.
Author:
Martin Lindström
  • Constructor Details

    • DefaultNameIDGeneratorFactory

      public DefaultNameIDGeneratorFactory(String idpEntityId)
      Constructor.
      Parameters:
      idpEntityId - the IdP entityID
  • Method Details

    • getNameIDGenerator

      public NameIDGenerator getNameIDGenerator(org.opensaml.saml.saml2.core.AuthnRequest authnRequest, org.opensaml.saml.saml2.metadata.EntityDescriptor peerMetadata) throws Saml2ErrorStatusException, UnrecoverableSaml2IdpException
      Given the requirements for a NameID in the AuthnRequest and EntityDescriptor along with the IdP policy the method returns a NameIDGenerator.
      Specified by:
      getNameIDGenerator in interface NameIDGeneratorFactory
      Parameters:
      authnRequest - the AuthnRequest
      peerMetadata - the peer metadata
      Returns:
      a NameIDGenerator
      Throws:
      Saml2ErrorStatusException - for errors that should be reported back to the Service Provider
      UnrecoverableSaml2IdpException - for non-recoverable errors
    • getSupportedFormats

      public List<String> getSupportedFormats()
      Gets a list of the NameIDFormats that are supported by the factory. The most preferred should be added first.
      Specified by:
      getSupportedFormats in interface NameIDGeneratorFactory
      Returns:
      a list of the supported formats
    • setDefaultFormat

      public void setDefaultFormat(String format)
      Assigns the default NameID format to use. If not assigned, urn:oasis:names:tc:SAML:2.0:nameid-format:persistent will be used.
      Parameters:
      format - the NameID format
    • createNameIDGenerator

      protected NameIDGenerator createNameIDGenerator(String format, String nameQualifier, String spNameQualifier) throws Saml2ErrorStatusException
      Creates a NameIDGenerator based on the supplied format.
      Parameters:
      format - the requested NameID format.
      nameQualifier - the IdP name qualifier
      spNameQualifier - the SP name qualifier
      Returns:
      a NameIDGenerator
      Throws:
      Saml2ErrorStatusException - if the format is unsupported
    • isSupported

      protected boolean isSupported(String format)
      Predicate that tells whether the supplied NameID format is supported.
      Parameters:
      format - the format to test
      Returns:
      true if the format is supported and false otherwise