Class Saml2AssertionBuilder
java.lang.Object
se.swedenconnect.spring.saml.idp.authentication.Saml2AssertionBuilder
The
Saml2AssertionBuilder
is responsible for building SAML Assertion
s given
Saml2UserAuthentication
objects.- Author:
- Martin Lindström
-
Constructor Summary
ConstructorDescriptionSaml2AssertionBuilder
(String idpEntityId, PkiCredential signatureCredential, AttributeReleaseManager attributeReleaseManager) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.opensaml.saml.saml2.core.Assertion
buildAssertion
(Saml2UserAuthentication userAuthentication) Given aSaml2UserAuthentication
object a SAMLAssertion
is built.void
setAssertionCustomizer
(org.springframework.security.config.Customizer<org.opensaml.saml.saml2.core.Assertion> assertionCustomizer) By assigning aCustomizer
theAssertion
object that is built can be modified.void
setIdGenerator
(Saml2MessageIDGenerator idGenerator) Assigns a custom ID generator.void
setNotBeforeDuration
(Duration notBeforeDuration) Assigns the setting that tells the time restrictions the IdP puts on an Assertion concerning "not before".void
setNotOnOrAfterDuration
(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 org.opensaml.saml.saml2.core.Assertion buildAssertion(Saml2UserAuthentication userAuthentication) throws Saml2ErrorStatusException, UnrecoverableSaml2IdpException Given aSaml2UserAuthentication
object a SAMLAssertion
is 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<org.opensaml.saml.saml2.core.Assertion> assertionCustomizer) By assigning aCustomizer
theAssertion
object that is built can be modified. The customizer is invoked when theAssertion
object 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
-