Class DefaultNameIDGeneratorFactory
java.lang.Object
se.swedenconnect.spring.saml.idp.attributes.nameid.DefaultNameIDGeneratorFactory
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected NameIDGeneratorcreateNameIDGenerator(String format, String nameQualifier, String spNameQualifier) Creates aNameIDGeneratorbased on the supplied format.getNameIDGenerator(AuthnRequest authnRequest, EntityDescriptor peerMetadata) Given the requirements for aNameIDin theAuthnRequestandEntityDescriptoralong with the IdP policy the method returns aNameIDGenerator.Gets a list of theNameIDFormats that are supported by the factory.protected booleanisSupported(String format) Predicate that tells whether the suppliedNameIDformat is supported.voidsetDefaultFormat(String format) Assigns the defaultNameIDformat to use.
-
Constructor Details
-
DefaultNameIDGeneratorFactory
Constructor.- Parameters:
idpEntityId- the IdP entityID
-
-
Method Details
-
getNameIDGenerator
public NameIDGenerator getNameIDGenerator(AuthnRequest authnRequest, EntityDescriptor peerMetadata) throws Saml2ErrorStatusException, UnrecoverableSaml2IdpException Given the requirements for aNameIDin theAuthnRequestandEntityDescriptoralong with the IdP policy the method returns aNameIDGenerator.- Specified by:
getNameIDGeneratorin interfaceNameIDGeneratorFactory- Parameters:
authnRequest- theAuthnRequestpeerMetadata- the peer metadata- Returns:
- a
NameIDGenerator - Throws:
Saml2ErrorStatusException- for errors that should be reported back to the Service ProviderUnrecoverableSaml2IdpException- for non-recoverable errors
-
getSupportedFormats
Gets a list of theNameIDFormats that are supported by the factory. The most preferred should be added first.- Specified by:
getSupportedFormatsin interfaceNameIDGeneratorFactory- Returns:
- a list of the supported formats
-
setDefaultFormat
Assigns the defaultNameIDformat to use. If not assigned,urn:oasis:names:tc:SAML:2.0:nameid-format:persistentwill be used.- Parameters:
format- theNameIDformat
-
createNameIDGenerator
protected NameIDGenerator createNameIDGenerator(String format, String nameQualifier, String spNameQualifier) throws Saml2ErrorStatusException Creates aNameIDGeneratorbased on the supplied format.- Parameters:
format- the requestedNameIDformat.nameQualifier- the IdP name qualifierspNameQualifier- the SP name qualifier- Returns:
- a
NameIDGenerator - Throws:
Saml2ErrorStatusException- if the format is unsupported
-
isSupported
Predicate that tells whether the suppliedNameIDformat is supported.- Parameters:
format- the format to test- Returns:
trueif the format is supported andfalseotherwise
-