Package alpine.auth
Class JwtAuthenticationService
- java.lang.Object
-
- alpine.auth.JwtAuthenticationService
-
- All Implemented Interfaces:
AuthenticationService
public class JwtAuthenticationService extends Object implements AuthenticationService
An AuthenticationService implementation for JWTs that authenticates users based on a token presented in the request. Tokens must be presented using the Authorization Bearer header.- Since:
- 1.0.0
- Author:
- Steve Springett
-
-
Constructor Summary
Constructors Constructor Description JwtAuthenticationService(org.glassfish.jersey.server.ContainerRequest request)Constructs a new JwtAuthenticationService.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Principalauthenticate()Defines an authentication method which returns a Principal if authentication is successful or an AuthorizationException if not.booleanisSpecified()Defines a method which returns if the specified piece of data, required to perform authentication is present.
-
-
-
Method Detail
-
isSpecified
public boolean isSpecified()
Defines a method which returns if the specified piece of data, required to perform authentication is present.- Specified by:
isSpecifiedin interfaceAuthenticationService- Returns:
- true if the authentication data was specified, false if not
-
authenticate
public Principal authenticate() throws AuthenticationException
Defines an authentication method which returns a Principal if authentication is successful or an AuthorizationException if not.- Specified by:
authenticatein interfaceAuthenticationService- Returns:
- a Principal of the authenticated user
- Throws:
AuthenticationException- an authentication failure
-
-