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
ConstructorDescriptionSaml2AuthnRequestAuthenticationToken
(org.opensaml.saml.saml2.core.AuthnRequest authnRequest, String relayState) Constructor assigning the receivedAuthnRequest
and optionally also theRelayState
variable. -
Method Summary
Modifier and TypeMethodDescriptionGets the assertion consumer servuce URL to use when posting back an assertion.org.opensaml.saml.saml2.core.AuthnRequest
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 theNameIDGenerator
to use when generating aNameID
in the assertion that is created based on this request.org.opensaml.saml.saml2.metadata.EntityDescriptor
Gets the peer (SP) metadata.The principal of this token is the issuer entityID of theAuthnRequest
.Gets the receivedRelayState
value.boolean
Predicate that tells if the peer is a "signature service" peer.void
setAssertionConsumerServiceUrl
(String assertionConsumerServiceUrl) Assigns the URL to use when sending back the response.void
setNameIDGenerator
(NameIDGenerator nameIDGenerator) Assigns theNameIDGenerator
to use when generating aNameID
in the assertion that is created based on this request.void
setPeerMetadata
(org.opensaml.saml.saml2.metadata.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
public Saml2AuthnRequestAuthenticationToken(org.opensaml.saml.saml2.core.AuthnRequest authnRequest, String relayState) Constructor assigning the receivedAuthnRequest
and optionally also theRelayState
variable.- Parameters:
authnRequest
- the SAML authentication requestrelayState
- theRelayState
variable
-
-
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
public org.opensaml.saml.saml2.core.AuthnRequest getAuthnRequest()Gets the receivedAuthnRequest
.- Returns:
- the
AuthnRequest
-
getRelayState
Gets the receivedRelayState
value.- Returns:
- the RelayState (may be
null
)
-
setPeerMetadata
public void setPeerMetadata(org.opensaml.saml.saml2.metadata.EntityDescriptor peerMetadata) Assigns the peer (SP) metadata.- Parameters:
peerMetadata
- the peer metadata
-
getPeerMetadata
public org.opensaml.saml.saml2.metadata.EntityDescriptor 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:
true
if 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 theNameIDGenerator
to use when generating aNameID
in the assertion that is created based on this request.- Returns:
- a
NameIDGenerator
-
setNameIDGenerator
Assigns theNameIDGenerator
to use when generating aNameID
in 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
-