Class Saml2AuthenticationToken
java.lang.Object
org.springframework.security.authentication.AbstractAuthenticationToken
org.springframework.security.saml2.provider.service.authentication.Saml2AuthenticationToken
- All Implemented Interfaces:
Serializable,Principal,Authentication,CredentialsContainer
Represents an incoming SAML 2.0 response containing an assertion that has not been
validated.
isAuthenticated() will always return false.- Since:
- 5.2
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSaml2AuthenticationToken(String saml2Response, String recipientUri, String idpEntityId, String localSpEntityId, List<Saml2X509Credential> credentials) Deprecated.Saml2AuthenticationToken(RelyingPartyRegistration relyingPartyRegistration, String saml2Response) Creates aSaml2AuthenticationTokenwith the provided parameters Note that the givenRelyingPartyRegistrationshould have all its templates resolved at this point.Saml2AuthenticationToken(RelyingPartyRegistration relyingPartyRegistration, String saml2Response, AbstractSaml2AuthenticationRequest authenticationRequest) Creates aSaml2AuthenticationTokenwith the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionReturns the authentication request sent to the assertion party ornullif no authentication request is presentReturns the decoded and inflated SAML 2.0 Response XML object as a stringDeprecated.UsegetRelyingPartyRegistration().getAssertingPartyDetails().getEntityId()insteadDeprecated.UsegetRelyingPartyRegistration().getEntityId()insteadAlways returns null.Deprecated.UsegetRelyingPartyRegistration().getAssertionConsumerServiceLocation()insteadGet the resolvedRelyingPartyRegistrationassociated with the requestReturns inflated and decoded XML representation of the SAML 2 ResponseDeprecated.Get the credentials throughgetRelyingPartyRegistration()insteadbooleanUsed to indicate toAbstractSecurityInterceptorwhether it should present the authentication token to theAuthenticationManager.voidsetAuthenticated(boolean authenticated) The state of this object cannot be changed.Methods inherited from class org.springframework.security.authentication.AbstractAuthenticationToken
equals, eraseCredentials, getAuthorities, getDetails, getName, hashCode, setDetails, toString
-
Constructor Details
-
Saml2AuthenticationToken
public Saml2AuthenticationToken(RelyingPartyRegistration relyingPartyRegistration, String saml2Response, AbstractSaml2AuthenticationRequest authenticationRequest) Creates aSaml2AuthenticationTokenwith the provided parameters. Note that the givenRelyingPartyRegistrationshould have all its templates resolved at this point. SeeSaml2WebSsoAuthenticationFilterfor an example of performing that resolution.- Parameters:
relyingPartyRegistration- the resolvedRelyingPartyRegistrationto usesaml2Response- the SAML 2.0 response to authenticateauthenticationRequest- theAuthNRequestsent to the asserting party- Since:
- 5.6
-
Saml2AuthenticationToken
public Saml2AuthenticationToken(RelyingPartyRegistration relyingPartyRegistration, String saml2Response) Creates aSaml2AuthenticationTokenwith the provided parameters Note that the givenRelyingPartyRegistrationshould have all its templates resolved at this point. SeeSaml2WebSsoAuthenticationFilterfor an example of performing that resolution.- Parameters:
relyingPartyRegistration- the resolvedRelyingPartyRegistrationto usesaml2Response- the SAML 2.0 response to authenticate- Since:
- 5.4
-
Saml2AuthenticationToken
@Deprecated public Saml2AuthenticationToken(String saml2Response, String recipientUri, String idpEntityId, String localSpEntityId, List<Saml2X509Credential> credentials) Deprecated.Creates an authentication token from an incoming SAML 2 Response object- Parameters:
saml2Response- inflated and decoded XML representation of the SAML 2 ResponserecipientUri- the URL that the SAML 2 Response was received at. Used for validationidpEntityId- the entity ID of the asserting entitylocalSpEntityId- the configured local SP, the relying party, entity IDcredentials- the credentials configured for signature verification and decryption
-
-
Method Details
-
getCredentials
Returns the decoded and inflated SAML 2.0 Response XML object as a string- Returns:
- decoded and inflated XML data as a
String
-
getPrincipal
Always returns null.- Returns:
- null
-
getRelyingPartyRegistration
Get the resolvedRelyingPartyRegistrationassociated with the request- Returns:
- the resolved
RelyingPartyRegistration - Since:
- 5.4
-
getSaml2Response
Returns inflated and decoded XML representation of the SAML 2 Response- Returns:
- inflated and decoded XML representation of the SAML 2 Response
-
getRecipientUri
Deprecated.UsegetRelyingPartyRegistration().getAssertionConsumerServiceLocation()insteadReturns the URI that the SAML 2 Response object came in on- Returns:
- URI as a string
-
getLocalSpEntityId
Deprecated.UsegetRelyingPartyRegistration().getEntityId()insteadReturns the configured entity ID of the receiving relying party, SP- Returns:
- an entityID for the configured local relying party
-
getX509Credentials
Deprecated.Get the credentials throughgetRelyingPartyRegistration()insteadReturns all the credentials associated with the relying party configuraiton- Returns:
- all associated credentials
-
isAuthenticated
public boolean isAuthenticated()Description copied from interface:AuthenticationUsed to indicate toAbstractSecurityInterceptorwhether it should present the authentication token to theAuthenticationManager. Typically anAuthenticationManager(or, more often, one of itsAuthenticationProviders) will return an immutable authentication token after successful authentication, in which case that token can safely returntrueto this method. Returningtruewill improve performance, as calling theAuthenticationManagerfor every request will no longer be necessary.For security reasons, implementations of this interface should be very careful about returning
truefrom this method unless they are either immutable, or have some way of ensuring the properties have not been changed since original creation.- Specified by:
isAuthenticatedin interfaceAuthentication- Overrides:
isAuthenticatedin classAbstractAuthenticationToken- Returns:
- false
-
setAuthenticated
public void setAuthenticated(boolean authenticated) The state of this object cannot be changed. Will always throw an exception- Specified by:
setAuthenticatedin interfaceAuthentication- Overrides:
setAuthenticatedin classAbstractAuthenticationToken- Parameters:
authenticated- ignored
-
getIdpEntityId
Deprecated.UsegetRelyingPartyRegistration().getAssertingPartyDetails().getEntityId()insteadReturns the configured IDP, asserting party, entity ID- Returns:
- a string representing the entity ID
-
getAuthenticationRequest
Returns the authentication request sent to the assertion party ornullif no authentication request is present- Returns:
- the authentication request sent to the assertion party
- Since:
- 5.6
-
Saml2AuthenticationToken(RelyingPartyRegistration, String)instead