Class AbstractAuthentication
java.lang.Object
io.camunda.identity.sdk.authentication.AbstractAuthentication
- All Implemented Interfaces:
Authentication
- Direct Known Subclasses:
Auth0Authentication,GenericAuthentication
The Authentication class provides functionality to authenticate a user with Identity
and verify access tokens.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final IdentityConfigurationstatic final longstatic final longstatic final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractAuthentication(IdentityConfiguration configuration) -
Method Summary
Modifier and TypeMethodDescriptioncom.auth0.jwt.interfaces.DecodedJWTDecodes a token.getAssignedOrganizations(com.auth0.jwt.interfaces.DecodedJWT token) getGroups(com.auth0.jwt.interfaces.DecodedJWT token) getPermissions(com.auth0.jwt.interfaces.DecodedJWT token, String audience) protected UserDetailsgetUserDetails(com.auth0.jwt.interfaces.DecodedJWT token) booleanReturns a true/false indicating if authentication is available or not.protected abstract com.auth0.jwk.JwkProviderprotected abstract TokensrequestFreshToken(String audience) requestToken(String audience) Requests a client token from the cache if available.verifyToken(String token) Verifies the validity of the passed token.protected AccessTokenverifyToken(String token, String audience) Verifies the validity of the passed token.Verifies the validity of the passed token.protected abstract WellKnownConfigurationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.camunda.identity.sdk.authentication.Authentication
authorizeUriBuilder, exchangeAuthCode, getClientId, isM2MToken, renewToken, revokeToken
-
Field Details
-
JWKS_CACHE_SIZE
public static final long JWKS_CACHE_SIZE- See Also:
-
JWKS_CACHE_LIFETIME_DAYS
public static final long JWKS_CACHE_LIFETIME_DAYS- See Also:
-
WELL_KNOWN_PATH
- See Also:
-
configuration
-
tokenCache
-
-
Constructor Details
-
AbstractAuthentication
-
-
Method Details
-
isAvailable
public boolean isAvailable()Description copied from interface:AuthenticationReturns a true/false indicating if authentication is available or not.- Specified by:
isAvailablein interfaceAuthentication- Returns:
- the availability of authentication
-
requestToken
Requests a client token from the cache if available. If no token is found with the required audience, a new token will be requested from the authentication provider and stored.- Specified by:
requestTokenin interfaceAuthentication- Parameters:
audience- the audience of the resource server- Returns:
- the tokens
- Throws:
IdentityException- if case of a failure
-
decodeJWT
Decodes a token. Can be used to access tokens data without validation- Specified by:
decodeJWTin interfaceAuthentication- Parameters:
token- token in JWT format- Returns:
- decoded token
- Throws:
TokenDecodeException- the token can not be decoded
-
verifyTokenIgnoringAudience
Description copied from interface:AuthenticationVerifies the validity of the passed token. Following checks will be performed:- The token is correctly signed
- The token has not expired
- Specified by:
verifyTokenIgnoringAudiencein interfaceAuthentication- Parameters:
token- the token- Returns:
- the decoded jwt
-
verifyToken
Verifies the validity of the passed token. Following checks will be performed:- The token is correctly signed
- The token has not expired
- Token's audience (aud claim) matches application's audience
- Specified by:
verifyTokenin interfaceAuthentication- Parameters:
token- the token- Returns:
- the decoded jwt
- Throws:
TokenDecodeException- the token can not be decodedInvalidSignatureException- the token's signature is invalidTokenExpiredException- the token has expiredInvalidClaimException- the provided claim is invalidJsonWebKeyException- the JWK needed to verify token's signature can not be retrieved
-
verifyToken
Verifies the validity of the passed token. Following checks will be performed:- The token is correctly signed
- The token has not expired
- Token's audience (aud claim) matches provided audience
- Parameters:
token- the tokenaudience- token's aud claim must match provided audience- Returns:
- the decoded jwt
- Throws:
TokenDecodeException- the token can not be decodedInvalidSignatureException- the token's signature is invalidTokenExpiredException- the token has expiredInvalidClaimException- the provided claim is invalidJsonWebKeyException- the JWK needed to verify token's signature can not be retrieved
-
getUserDetails
-
getPermissions
-
getGroups
-
getAssignedOrganizations
-
jwkProvider
protected abstract com.auth0.jwk.JwkProvider jwkProvider() -
wellKnownConfiguration
-
requestFreshToken
-