public class TestingAuthenticationToken extends AbstractAuthenticationToken
Authentication
implementation that is
designed for use whilst unit testing.
The corresponding authentication provider is TestingAuthenticationProvider
.
Constructor and Description |
---|
TestingAuthenticationToken(java.lang.Object principal,
java.lang.Object credentials) |
TestingAuthenticationToken(java.lang.Object principal,
java.lang.Object credentials,
java.util.List<GrantedAuthority> authorities) |
TestingAuthenticationToken(java.lang.Object principal,
java.lang.Object credentials,
java.lang.String... authorities) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getCredentials()
The credentials that prove the principal is correct.
|
java.lang.Object |
getPrincipal()
The identity of the principal being authenticated.
|
equals, eraseCredentials, getAuthorities, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toString
public TestingAuthenticationToken(java.lang.Object principal, java.lang.Object credentials)
public TestingAuthenticationToken(java.lang.Object principal, java.lang.Object credentials, java.lang.String... authorities)
public TestingAuthenticationToken(java.lang.Object principal, java.lang.Object credentials, java.util.List<GrantedAuthority> authorities)
public java.lang.Object getCredentials()
Authentication
AuthenticationManager
. Callers
are expected to populate the credentials.Principal
public java.lang.Object getPrincipal()
Authentication
The AuthenticationManager implementation will often return an
Authentication containing richer information as the principal for use by
the application. Many of the authentication providers will create a
UserDetails
object as the principal.
Principal
being authenticated or the authenticated
principal after authentication.