Package com.adobe.granite.oauth.jwt
Interface JwsBuilder
public interface JwsBuilder
The
JwsBuilder provides a simple API to issue JWS formatted token
as defined in http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-16
and http://tools.ietf.org/html/draft-ietf-jose-json-web-signature-21-
Method Summary
Modifier and TypeMethodDescriptionbuild()setAudience(String aud) Set the (Audience) Claim as for http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-16#section-4.1.3setCustomClaimsSetField(String key, Object value) Set a custom claim fieldsetExpiresIn(long expiresIn) Set the expiration time for the token expressed in secondssetIssuedAt(long iat) Set the (Issued At) Claim as for https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-25#section-4.1.6 If the set Issued At is too far away in the future (20 seconds or more than current time) the set Issued At will be ignored and the current time is used instead to build the JWTSet the (Issuer) Claim as for http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-16#section-4.1.1Set the scope associate with the tokensetSubject(String sub) Set the (Subject) Claim as for http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-16#section-4.1.2
-
Method Details
-
build
- Returns:
- a signed JWS as defined in http://tools.ietf.org/html/draft-ietf-jose-json-web-signature-21
- Throws:
CryptoException- if any problem occurs signing the token
-
setIssuer
Set the (Issuer) Claim as for http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-16#section-4.1.1- Parameters:
iss- The (Issuer) Claim- Returns:
- JwsBuilder
-
setSubject
Set the (Subject) Claim as for http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-16#section-4.1.2- Parameters:
sub- The (Subject) Claim as- Returns:
- JwsBuilder
-
setAudience
Set the (Audience) Claim as for http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-16#section-4.1.3- Parameters:
aud- The (Audience) Claim- Returns:
- JwsBuilder
-
setExpiresIn
Set the expiration time for the token expressed in seconds- Parameters:
expiresIn- The expiration time for the token expressed in seconds- Returns:
- JwsBuilder
-
setScope
Set the scope associate with the token- Parameters:
scope- The scope associate with the token- Returns:
- JwsBuilder
-
setCustomClaimsSetField
Set a custom claim field- Parameters:
key- The claim field custom namevalue- The claim field value- Returns:
- JwsBuilder
-
setIssuedAt
Set the (Issued At) Claim as for https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-25#section-4.1.6 If the set Issued At is too far away in the future (20 seconds or more than current time) the set Issued At will be ignored and the current time is used instead to build the JWT- Parameters:
iat- The (Issued At) Claim expressed in seconds- Returns:
- JwsBuilder
- Since:
- 1.1
-