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
Modifier and TypeClassDescriptionstatic class
Remembers all (SAML) occurences where the user authentication has been used. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the authentication request token.void
Clears 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
.boolean
Gets the flag telling whether thisAuthentication
object may be "re-used", i.e., whether it may be used in SSO-scenarios.boolean
Predicate that tells whether the authentication object was issued based on a previous authentication.void
setAuthnRequestToken
(Saml2AuthnRequestAuthenticationToken authnRequestToken) Assigns the authentication request token.void
setAuthnRequirements
(AuthenticationRequirements authnRequirements) Assigns the authentication requirements.void
setReuseAuthentication
(boolean reuseAuthentication) Assigns the flag telling whether thisAuthentication
object 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 thisAuthentication
object may be "re-used", i.e., whether it may be used in SSO-scenarios. Defaults totrue
.Note that even if this flag is
true
the IdP-engine may choose not to save theAuthentication
object for future use. This may be dependent on other parameters. However, if the flag isfalse
the 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 thisAuthentication
object 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. TheSaml2UserAuthentication
object 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. TheSaml2UserAuthentication
object 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:
true
if the authentication object is based on a previous authentication andfalse
otherwise
-