Class PreAuthenticatedAuthenticationToken
java.lang.Object
org.springframework.security.authentication.AbstractAuthenticationToken
org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken
- All Implemented Interfaces:
Serializable
,Principal
,Authentication
,CredentialsContainer
Authentication
implementation for
pre-authenticated authentication.- Since:
- 2.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
PreAuthenticatedAuthenticationToken.Builder<B extends PreAuthenticatedAuthenticationToken.Builder<B>>
A builder ofPreAuthenticatedAuthenticationToken
instancesNested classes/interfaces inherited from class org.springframework.security.authentication.AbstractAuthenticationToken
AbstractAuthenticationToken.AbstractAuthenticationBuilder<B extends AbstractAuthenticationToken.AbstractAuthenticationBuilder<B>>
-
Constructor Summary
ConstructorsModifierConstructorDescriptionPreAuthenticatedAuthenticationToken
(Object aPrincipal, @Nullable Object aCredentials) Constructor used for an authentication request.PreAuthenticatedAuthenticationToken
(Object aPrincipal, @Nullable Object aCredentials, Collection<? extends GrantedAuthority> anAuthorities) Constructor used for an authentication response.protected
-
Method Summary
Modifier and TypeMethodDescription@Nullable Object
Get the credentialsGet the principalReturn anAuthentication.Builder
based on this instance.Methods inherited from class org.springframework.security.authentication.AbstractAuthenticationToken
equals, eraseCredentials, getAuthorities, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toString
-
Constructor Details
-
PreAuthenticatedAuthenticationToken
Constructor used for an authentication request. TheAuthentication.isAuthenticated()
will returnfalse
.- Parameters:
aPrincipal
- The pre-authenticated principalaCredentials
- The pre-authenticated credentials
-
PreAuthenticatedAuthenticationToken
public PreAuthenticatedAuthenticationToken(Object aPrincipal, @Nullable Object aCredentials, Collection<? extends GrantedAuthority> anAuthorities) Constructor used for an authentication response. TheAuthentication.isAuthenticated()
will returntrue
.- Parameters:
aPrincipal
- The authenticated principalanAuthorities
- The granted authorities
-
PreAuthenticatedAuthenticationToken
protected PreAuthenticatedAuthenticationToken(PreAuthenticatedAuthenticationToken.Builder<?> builder)
-
-
Method Details
-
getCredentials
Get the credentials- Returns:
- the credentials that prove the identity of the
Principal
-
getPrincipal
Get the principal- Returns:
- the
Principal
being authenticated or the authenticated principal after authentication.
-
toBuilder
Description copied from interface:Authentication
Return anAuthentication.Builder
based on this instance. By default, returns a builder that builds aSimpleAuthentication
.Although a
default
method, allAuthentication
implementations should implement this. The reason is to ensure that theAuthentication
type is preserved whenAuthentication.Builder.build()
is invoked. This is especially important in the event that your authentication implementation contains custom fields.This isn't strictly necessary since it is recommended that applications code to the
Authentication
interface and that custom information is often contained in theAuthentication.getPrincipal()
value.- Returns:
- an
Authentication.Builder
for building a newAuthentication
based on this instance
-