Class JWEAuthentication<A extends Authentication>
- Type Parameters:
A- the original authentication type
- All Implemented Interfaces:
Authentication,TokenAuthentication
A token authentication that wraps the original authentication in a JWE and uses its compact representation as token value.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Constructor Summary
ConstructorsConstructorDescriptionJWEAuthentication(JWE<A> jwe) Creates a JWE authentication with the specified JWE.Creates a denied JWE authentication with the specified security error. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.inverno.mod.security.authentication.Authentication
isAnonymous
-
Constructor Details
-
JWEAuthentication
Creates a JWE authentication with the specified JWE.
- Parameters:
jwe- a JWE wrapping the original authentication
-
JWEAuthentication
Creates a denied JWE authentication with the specified security error.
- Parameters:
cause- a security error or null
-
-
Method Details
-
getJwe
Returns the JWE.
- Returns:
- the JWE or null if unauthenticated
-
getToken
Returns the JWE compact representation.
- Specified by:
getTokenin interfaceTokenAuthentication- Returns:
- the JWE compact representation or null if unauthenticated
-
isAuthenticated
public boolean isAuthenticated()Description copied from interface:AuthenticationDetermine whether the authentication is authenticated.
A non-authenticated authentication might indicates that no authentication took place (i.e. anonymous access) or that the authentication failed. In case of a failed authentication, the cause is exposed by
Authentication.getCause().- Specified by:
isAuthenticatedin interfaceAuthentication- Returns:
- true if the authentication is authenticated, false otherwise
-
getCause
Description copied from interface:AuthenticationReturns the cause of a failed authentication.
A non-authenticated authentication with no cause indicates that no authentication took place (i.e. anonymous access).
A non-authenticated authentication with a cause indicates a failed authentication.
- Specified by:
getCausein interfaceAuthentication- Returns:
- an optional returning the cause of the failed authentication, or an empty optional if there was no authentication or if the authentication was successful
-