Class Saml2AuthnRequestAuthenticationToken
java.lang.Object
org.springframework.security.authentication.AbstractAuthenticationToken
se.swedenconnect.spring.saml.idp.authnrequest.Saml2AuthnRequestAuthenticationToken
- All Implemented Interfaces:
Serializable,Principal,org.springframework.security.core.Authentication,org.springframework.security.core.CredentialsContainer
public class Saml2AuthnRequestAuthenticationToken
extends org.springframework.security.authentication.AbstractAuthenticationToken
An
Authentication object for a SAML authentication request. This token will act as the input for the user
authentication process.- Author:
- Martin Lindström
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSaml2AuthnRequestAuthenticationToken(AuthnRequest authnRequest, String relayState) Constructor assigning the receivedAuthnRequestand optionally also theRelayStatevariable. -
Method Summary
Modifier and TypeMethodDescriptionGets the assertion consumer servuce URL to use when posting back an assertion.Gets the receivedAuthnRequest.Gets the binding URI (redirect or POST).Will always return an empty string.Gets the entityID of the requesting entity.Gets a simple log string looking like:Gets theNameIDGeneratorto use when generating aNameIDin the assertion that is created based on this request.Gets the peer (SP) metadata.The principal of this token is the issuer entityID of theAuthnRequest.Gets the receivedRelayStatevalue.booleanPredicate that tells if the peer is a "signature service" peer.voidsetAssertionConsumerServiceUrl(String assertionConsumerServiceUrl) Assigns the URL to use when sending back the response.voidsetNameIDGenerator(NameIDGenerator nameIDGenerator) Assigns theNameIDGeneratorto use when generating aNameIDin the assertion that is created based on this request.voidsetPeerMetadata(EntityDescriptor peerMetadata) Assigns the peer (SP) metadata.Methods inherited from class org.springframework.security.authentication.AbstractAuthenticationToken
equals, eraseCredentials, getAuthorities, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toString
-
Constructor Details
-
Saml2AuthnRequestAuthenticationToken
Constructor assigning the receivedAuthnRequestand optionally also theRelayStatevariable.- Parameters:
authnRequest- the SAML authentication requestrelayState- theRelayStatevariable
-
-
Method Details
-
getCredentials
Will always return an empty string. -
getPrincipal
The principal of this token is the issuer entityID of theAuthnRequest. -
getEntityId
Gets the entityID of the requesting entity.- Returns:
- the entityID of the requesting entity
-
getAuthnRequest
Gets the receivedAuthnRequest.- Returns:
- the
AuthnRequest
-
getRelayState
Gets the receivedRelayStatevalue.- Returns:
- the RelayState (may be
null)
-
setPeerMetadata
Assigns the peer (SP) metadata.- Parameters:
peerMetadata- the peer metadata
-
getPeerMetadata
Gets the peer (SP) metadata.- Returns:
- the peer metadata
-
isSignatureServicePeer
public boolean isSignatureServicePeer()Predicate that tells if the peer is a "signature service" peer.- Returns:
trueif the peer is a signature service andfalse
-
getBindingUri
Gets the binding URI (redirect or POST). Possible values are "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" and "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST".- Returns:
- the binding URI used for the
AuthnRequest
-
getAssertionConsumerServiceUrl
Gets the assertion consumer servuce URL to use when posting back an assertion.- Returns:
- URL
-
setAssertionConsumerServiceUrl
Assigns the URL to use when sending back the response.- Parameters:
assertionConsumerServiceUrl- URL
-
getNameIDGenerator
Gets theNameIDGeneratorto use when generating aNameIDin the assertion that is created based on this request.- Returns:
- a
NameIDGenerator
-
setNameIDGenerator
Assigns theNameIDGeneratorto use when generating aNameIDin the assertion that is created based on this request.- Parameters:
nameIDGenerator- aNameIDGenerator
-
getLogString
Gets a simple log string looking like:entity-id: 'https://sp.example.com', authn-request: '9873hHYYT'
- Returns:
- a formatted log string
-