Class JwtAuthenticationToken
java.lang.Object
com.codename1.backend.security.AbstractAuthenticationToken
com.codename1.backend.security.oauth2.server.resource.JwtAuthenticationToken
- All Implemented Interfaces:
Authentication
Who a request is from, when a verified JWT says so. The principal is the
Jwt itself, so a controller reads any claim off it:
@GetMapping("/me")
String me(@AuthenticationPrincipal Jwt jwt) {
return jwt.getClaimAsString("email");
}
-
Constructor Summary
ConstructorsConstructorDescriptionJwtAuthenticationToken(Jwt jwt, Collection<? extends GrantedAuthority> authorities) Named after the token's subject.JwtAuthenticationToken(Jwt jwt, Collection<? extends GrantedAuthority> authorities, String name) -
Method Summary
Modifier and TypeMethodDescriptionWhat proves the principal is who it says: a password, usually, and null once it has been checked.getName()The principal's name.The identity: a username before authentication, and afterwards usually theUserDetailsit was resolved to.getToken()The verified token.The token's claims.Methods inherited from class AbstractAuthenticationToken
eraseCredentials, getAuthorities, getDetails, isAuthenticated, setAuthenticated, setDetails, toString
-
Constructor Details
-
JwtAuthenticationToken
Named after the token's subject. -
JwtAuthenticationToken
public JwtAuthenticationToken(Jwt jwt, Collection<? extends GrantedAuthority> authorities, String name)
-
-
Method Details
-
getToken
The verified token. -
getTokenAttributes
-
getPrincipal
Description copied from interface:AuthenticationThe identity: a username before authentication, and afterwards usually theUserDetailsit was resolved to. -
getCredentials
Description copied from interface:AuthenticationWhat proves the principal is who it says: a password, usually, and null once it has been checked. -
getName
Description copied from interface:AuthenticationThe principal's name.- Specified by:
getNamein interfaceAuthentication- Overrides:
getNamein classAbstractAuthenticationToken
-