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
-
Method Summary
Modifier and TypeMethodDescriptionprotected NameIDGenerator
createNameIDGenerator
(String format, String nameQualifier, String spNameQualifier) Creates aNameIDGenerator
based on the supplied format.getNameIDGenerator
(org.opensaml.saml.saml2.core.AuthnRequest authnRequest, org.opensaml.saml.saml2.metadata.EntityDescriptor peerMetadata) Given the requirements for aNameID
in theAuthnRequest
andEntityDescriptor
along with the IdP policy the method returns aNameIDGenerator
.Gets a list of theNameIDFormat
s that are supported by the factory.protected boolean
isSupported
(String format) Predicate that tells whether the suppliedNameID
format is supported.void
setDefaultFormat
(String format) Assigns the defaultNameID
format to use.
-
Constructor Details
-
DefaultNameIDGeneratorFactory
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 aNameID
in theAuthnRequest
andEntityDescriptor
along with the IdP policy the method returns aNameIDGenerator
.- Specified by:
getNameIDGenerator
in interfaceNameIDGeneratorFactory
- Parameters:
authnRequest
- theAuthnRequest
peerMetadata
- 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 theNameIDFormat
s that are supported by the factory. The most preferred should be added first.- Specified by:
getSupportedFormats
in interfaceNameIDGeneratorFactory
- Returns:
- a list of the supported formats
-
setDefaultFormat
Assigns the defaultNameID
format to use. If not assigned,urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
will be used.- Parameters:
format
- theNameID
format
-
createNameIDGenerator
protected NameIDGenerator createNameIDGenerator(String format, String nameQualifier, String spNameQualifier) throws Saml2ErrorStatusException Creates aNameIDGenerator
based on the supplied format.- Parameters:
format
- the requestedNameID
format.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 suppliedNameID
format is supported.- Parameters:
format
- the format to test- Returns:
true
if the format is supported andfalse
otherwise
-