| Modifier and Type | Method and Description |
|---|---|
String |
issueJwt(String jsonPayload,
String secret)
Generate a JWT for the supplied payload, suitable for authenticating with the specified
secret. |
String |
issueJwt(String jsonPayload,
String secret,
SigningAlgorithm algorithm)
Generate a JWT for the supplied payload, suitable for authenticating with the specified
secret. |
Jwt |
verifyJwt(String jwt,
Map<String,? extends JwtClaimVerifier> claimVerifiers)
Verify an incoming JWT.
|
@Nonnull String issueJwt(@Nonnull String jsonPayload, @Nonnull String secret)
secret. This
uses SigningAlgorithm.HS256 as the default signing algorithm. Use
issueJwt(String, String, SigningAlgorithm) to create a JWT with a different algorithmjsonPayload - a JSON payloadsecret - the shared-secret or private-key used to signJwtSigningException - if a problem was encountered while generating the JWT@Nonnull String issueJwt(@Nonnull String jsonPayload, @Nonnull String secret, SigningAlgorithm algorithm)
secret.jsonPayload - a JSON payloadsecret - the shared-secret or private-key used to signalgorithm - the algorithm used to sign the JWTJwtSigningException - if a problem was encountered while generating the JWT@Nonnull Jwt verifyJwt(@Nonnull String jwt, @Nonnull Map<String,? extends JwtClaimVerifier> claimVerifiers) throws JwtIssuerLacksSharedSecretException, JwtParseException, JwtUnknownIssuerException, JwtVerificationException
jwt - a JWT extracted from an incoming request.claimVerifiers - Map of claim-name to JwtClaimVerifier that will test its correctnessJwtIssuerLacksSharedSecretException - if the JWT issuer is known, but does not have a shared secret
registered for itJwtParseException - if the JWT is malformedJwtVerificationException - if the JWT is well formed but failed verificationJwtUnknownIssuerException - if this server does not have a JWT relationship with the issuer indicated in
the JWT. This will happen if the linked application's JWT credentials have
been revoked, for example.Copyright © 2023 Atlassian. All rights reserved.