Class Saml2AssertionBuilder
java.lang.Object
se.swedenconnect.spring.saml.idp.authentication.Saml2AssertionBuilder
The
Saml2AssertionBuilder is responsible for building SAML Assertions given
Saml2UserAuthentication objects.- Author:
- Martin Lindström
-
Constructor Summary
ConstructorsConstructorDescriptionSaml2AssertionBuilder(String idpEntityId, PkiCredential signatureCredential, AttributeReleaseManager attributeReleaseManager) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbuildAssertion(Saml2UserAuthentication userAuthentication) Given aSaml2UserAuthenticationobject a SAMLAssertionis built.voidsetAssertionCustomizer(org.springframework.security.config.Customizer<Assertion> assertionCustomizer) By assigning aCustomizertheAssertionobject that is built can be modified.voidsetIdGenerator(Saml2MessageIDGenerator idGenerator) Assigns a custom ID generator.voidsetNotBeforeDuration(Duration notBeforeDuration) Assigns the setting that tells the time restrictions the IdP puts on an Assertion concerning "not before".voidsetNotOnOrAfterDuration(Duration notOnOrAfterDuration) Assigns the setting that tells the time restrictions the IdP puts on an Assertion concerning "not on or after".
-
Constructor Details
-
Saml2AssertionBuilder
public Saml2AssertionBuilder(String idpEntityId, PkiCredential signatureCredential, AttributeReleaseManager attributeReleaseManager) Constructor.- Parameters:
idpEntityId- the IdP entity IDsignatureCredential- the signature credential (for signing the assertion)attributeReleaseManager- decides which attributes from the user token that should be released in the assertion
-
-
Method Details
-
buildAssertion
public Assertion buildAssertion(Saml2UserAuthentication userAuthentication) throws Saml2ErrorStatusException, UnrecoverableSaml2IdpException Given aSaml2UserAuthenticationobject a SAMLAssertionis built.- Parameters:
userAuthentication- the information about the user authentication- Returns:
- an
Assertion - Throws:
Saml2ErrorStatusException- for errors that should be reported back to the Service ProviderUnrecoverableSaml2IdpException- for unrecoverable errors
-
setAssertionCustomizer
public void setAssertionCustomizer(org.springframework.security.config.Customizer<Assertion> assertionCustomizer) By assigning aCustomizertheAssertionobject that is built can be modified. The customizer is invoked when theAssertionobject has been completely built, but before it is signed.- Parameters:
assertionCustomizer- aCustomizer
-
setNotOnOrAfterDuration
Assigns the setting that tells the time restrictions the IdP puts on an Assertion concerning "not on or after". Defaults toAssertionSettings.NOT_ON_OR_AFTER_DURATION_DEFAULT.- Parameters:
notOnOrAfterDuration- duration
-
setNotBeforeDuration
Assigns the setting that tells the time restrictions the IdP puts on an Assertion concerning "not before". Defaults toAssertionSettings.NOT_BEFORE_DURATION_DEFAULT.- Parameters:
notBeforeDuration- duration
-
setIdGenerator
Assigns a custom ID generator. The default isDefaultSaml2MessageIDGenerator.- Parameters:
idGenerator- the ID generator
-