Class Saml2UserAuthentication
java.lang.Object
org.springframework.security.authentication.AbstractAuthenticationToken
se.swedenconnect.spring.saml.idp.authentication.Saml2UserAuthentication
- All Implemented Interfaces:
Serializable,Principal,org.springframework.security.core.Authentication,org.springframework.security.core.CredentialsContainer
public class Saml2UserAuthentication
extends org.springframework.security.authentication.AbstractAuthenticationToken
An
Authentication token that represents the authentication of a user. This will later be translated into a
SAML Assertion.- Author:
- Martin Lindström
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRemembers all (SAML) occurences where the user authentication has been used. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the authentication request token.voidClears the authentication requirements.Gets the tracking of all the times this user authentication object has been used.Gets the authentication request token.Gets the authentication requirements.Will always return the empty string.Maps togetSaml2UserDetails().Gets theSaml2UserDetails.booleanGets the flag telling whether thisAuthenticationobject may be "re-used", i.e., whether it may be used in SSO-scenarios.booleanPredicate that tells whether the authentication object was issued based on a previous authentication.voidsetAuthnRequestToken(Saml2AuthnRequestAuthenticationToken authnRequestToken) Assigns the authentication request token.voidsetAuthnRequirements(AuthenticationRequirements authnRequirements) Assigns the authentication requirements.voidsetReuseAuthentication(boolean reuseAuthentication) Assigns the flag telling whether thisAuthenticationobject may be "re-used", i.e., whether it may be used in SSO-scenarios.Methods inherited from class org.springframework.security.authentication.AbstractAuthenticationToken
equals, eraseCredentials, getAuthorities, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toString
-
Constructor Details
-
Saml2UserAuthentication
Constructor.- Parameters:
userDetails- the user details
-
-
Method Details
-
getPrincipal
Maps togetSaml2UserDetails(). -
getSaml2UserDetails
Gets theSaml2UserDetails.- Returns:
- the
Saml2UserDetails
-
isReuseAuthentication
public boolean isReuseAuthentication()Gets the flag telling whether thisAuthenticationobject may be "re-used", i.e., whether it may be used in SSO-scenarios. Defaults totrue.Note that even if this flag is
truethe IdP-engine may choose not to save theAuthenticationobject for future use. This may be dependent on other parameters. However, if the flag isfalsethe authentication will not be saved.- Returns:
- whether the authentication object should be saved for future SSO
-
setReuseAuthentication
public void setReuseAuthentication(boolean reuseAuthentication) Assigns the flag telling whether thisAuthenticationobject may be "re-used", i.e., whether it may be used in SSO-scenarios.- Parameters:
reuseAuthentication- whether the authentication object should be saved for future SSO
-
getCredentials
Will always return the empty string. -
getAuthnRequestToken
Gets the authentication request token.- Returns:
- the authentication request token
-
setAuthnRequestToken
Assigns the authentication request token.- Parameters:
authnRequestToken- the authentication request token
-
clearAuthnRequestToken
public void clearAuthnRequestToken()Clears the authentication request token. This is done when the SAML response has been sent. TheSaml2UserAuthenticationobject will be persisted, and there is no need to carry around the authentication request information. -
getAuthnRequirements
Gets the authentication requirements.- Returns:
- the authentication requirements
-
setAuthnRequirements
Assigns the authentication requirements.- Parameters:
authnRequirements- the authentication requirements
-
clearAuthnRequirements
public void clearAuthnRequirements()Clears the authentication requirements. This is done when the SAML response has been sent. TheSaml2UserAuthenticationobject will be persisted, and there is no need to carry around non-needed information. -
getAuthenticationInfoTrack
Gets the tracking of all the times this user authentication object has been used.- Returns:
- an
Saml2UserAuthentication.AuthenticationInfoTrack
-
isSsoApplied
public boolean isSsoApplied()Predicate that tells whether the authentication object was issued based on a previous authentication.- Returns:
trueif the authentication object is based on a previous authentication andfalseotherwise
-