Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public class UsernamePasswordAuthenticationToken

  1. Object
  2. AbstractAuthenticationToken
  3. UsernamePasswordAuthenticationToken

ImplementsAuthentication

A username and password: as a client presented them, or – with authorities – as an AuthenticationProvider accepted them.

Constructors

public UsernamePasswordAuthenticationToken(Object principal, Object credentials)A token still to be checked.
public UsernamePasswordAuthenticationToken(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities)A token that has been checked.

Methods

public static UsernamePasswordAuthenticationToken unauthenticated(Object principal, Object credentials)A token still to be checked.
public static UsernamePasswordAuthenticationToken authenticated(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities)A token that has been checked.
public Object getCredentials()What proves the principal is who it says: a password, usually, and null once it has been checked.
public Object getPrincipal()The identity: a username before authentication, and afterwards usually the UserDetails it was resolved to.
public void setAuthenticated(boolean isAuthenticated)Marks the token trusted or not.
public void eraseCredentials()Drops the secret this token carried, once it has been checked.

Inherited methods

Constructor details

UsernamePasswordAuthenticationToken

public UsernamePasswordAuthenticationToken(Object principal, Object credentials)
A token still to be checked.

UsernamePasswordAuthenticationToken

public UsernamePasswordAuthenticationToken(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities)
A token that has been checked. Only code that authenticated the principal may build one.

Method details

unauthenticated

public static UsernamePasswordAuthenticationToken unauthenticated(Object principal, Object credentials)
A token still to be checked.

authenticated

public static UsernamePasswordAuthenticationToken authenticated(Object principal, Object credentials, Collection<? extends GrantedAuthority> authorities)
A token that has been checked.

getCredentials

public Object getCredentials()
What proves the principal is who it says: a password, usually, and null once it has been checked.

getPrincipal

public Object getPrincipal()
The identity: a username before authentication, and afterwards usually the UserDetails it was resolved to.

setAuthenticated

public void setAuthenticated(boolean isAuthenticated)
Marks the token trusted or not. Implementations refuse true from outside: a trusted token is made by a constructor that says so.

eraseCredentials

public void eraseCredentials()
Drops the secret this token carried, once it has been checked. Called by ProviderManager on a token it accepted.