Package io.camunda.zeebe.auth.impl
Class JwtAuthorizationDecoder
java.lang.Object
io.camunda.zeebe.auth.impl.JwtAuthorizationDecoder
- All Implemented Interfaces:
AuthorizationDecoder<Map<String,,Object>> JwtAuthorizationBuilder<JwtAuthorizationDecoder,com.auth0.jwt.algorithms.Algorithm, com.auth0.jwt.interfaces.DecodedJWT>
public class JwtAuthorizationDecoder
extends Object
implements JwtAuthorizationBuilder<JwtAuthorizationDecoder,com.auth0.jwt.algorithms.Algorithm,com.auth0.jwt.interfaces.DecodedJWT>, AuthorizationDecoder<Map<String,Object>>
-
Field Summary
Fields inherited from interface io.camunda.zeebe.auth.api.JwtAuthorizationBuilder
DEFAULT_AUDIENCE, DEFAULT_ISSUER, DEFAULT_SUBJECT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.auth0.jwt.interfaces.DecodedJWTbuild()Validates the signature and decodes a provided JWT token.decode()Returns an instance ofcontaining the user's authorizations. withAudience(String audience) Sets the token audience.Sets the name of a JWT token claim expected to be part of the token.withIssuer(String issuer) Sets the token issuer.withJwtToken(String token) Sets the JWT token String that should be validated and decoded.withSigningAlgorithm(com.auth0.jwt.algorithms.Algorithm signingAlgorithm) Sets the signing algorithm for the token.withSubject(String subject) Sets the token subject.
-
Constructor Details
-
JwtAuthorizationDecoder
public JwtAuthorizationDecoder() -
JwtAuthorizationDecoder
-
-
Method Details
-
withSubject
Description copied from interface:JwtAuthorizationBuilderSets the token subject.- Specified by:
withSubjectin interfaceJwtAuthorizationBuilder<JwtAuthorizationDecoder,com.auth0.jwt.algorithms.Algorithm, com.auth0.jwt.interfaces.DecodedJWT> - Parameters:
subject- - the subject String- Returns:
- the builder instance
-
withIssuer
Description copied from interface:JwtAuthorizationBuilderSets the token issuer.- Specified by:
withIssuerin interfaceJwtAuthorizationBuilder<JwtAuthorizationDecoder,com.auth0.jwt.algorithms.Algorithm, com.auth0.jwt.interfaces.DecodedJWT> - Parameters:
issuer- - the issuer String- Returns:
- the builder instance
-
withAudience
Description copied from interface:JwtAuthorizationBuilderSets the token audience.- Specified by:
withAudiencein interfaceJwtAuthorizationBuilder<JwtAuthorizationDecoder,com.auth0.jwt.algorithms.Algorithm, com.auth0.jwt.interfaces.DecodedJWT> - Parameters:
audience- - the audience String- Returns:
- the builder instance
-
withSigningAlgorithm
public JwtAuthorizationDecoder withSigningAlgorithm(com.auth0.jwt.algorithms.Algorithm signingAlgorithm) Description copied from interface:JwtAuthorizationBuilderSets the signing algorithm for the token. The algorithm may depend on the token library.- Specified by:
withSigningAlgorithmin interfaceJwtAuthorizationBuilder<JwtAuthorizationDecoder,com.auth0.jwt.algorithms.Algorithm, com.auth0.jwt.interfaces.DecodedJWT> - Parameters:
signingAlgorithm- - the signing algorithm instance- Returns:
- the builder instance
-
build
public com.auth0.jwt.interfaces.DecodedJWT build()Validates the signature and decodes a provided JWT token. It is also possible to pass the names of the claims that are expected to be contained in the token.- Specified by:
buildin interfaceJwtAuthorizationBuilder<JwtAuthorizationDecoder,com.auth0.jwt.algorithms.Algorithm, com.auth0.jwt.interfaces.DecodedJWT> - Returns:
- a decoded JWT token
-
decode
Description copied from interface:AuthorizationDecoderReturns an instance ofcontaining the user's authorizations. - Specified by:
decodein interfaceAuthorizationDecoder<Map<String,Object>>
-
withClaim
Sets the name of a JWT token claim expected to be part of the token. This method can be called multiple times. The token will be validated agains all the added claims.- Parameters:
claimName- - the name of the claim- Returns:
- the builder instance
-
withJwtToken
Sets the JWT token String that should be validated and decoded.- Parameters:
token- - the JWT token String- Returns:
- the builder instance
-