Package alpine.server.auth
Class JwtAuthenticationService
java.lang.Object
alpine.server.auth.JwtAuthenticationService
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionJwtAuthenticationService(org.glassfish.jersey.server.ContainerRequest request) Constructs a new JwtAuthenticationService. -
Method Summary
Modifier and TypeMethodDescriptionDefines an authentication method which returns a Principal if authentication is successful or an AuthorizationException if not.booleanDefines a method which returns if the specified piece of data, required to perform authentication is present.
-
Constructor Details
-
JwtAuthenticationService
public JwtAuthenticationService(org.glassfish.jersey.server.ContainerRequest request) Constructs a new JwtAuthenticationService.- Parameters:
request- a ContainerRequest object to parse
-
-
Method Details
-
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
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
-