java.lang.Object
edu.iu.client.IuJsonBuilder<B>
iu.crypt.JwtBuilder<B>
- Type Parameters:
B
- Concrete builder type
- All Implemented Interfaces:
WebTokenBuilder
- Direct Known Subclasses:
SessionJwtBuilder
public class JwtBuilder<B extends JwtBuilder<B>>
extends IuJsonBuilder<B>
implements WebTokenBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets the token audience URIs.build()
Builds aWebToken
instance based on provided claim values.Sets the time after which the JWT should not be accepted.iat()
Indicates thatWebTokenBuilder.build()
should set the issued at time to the current time.Sets the token issuer URI.jti()
Generates a unique token identifier.Provides a specific token identifier.Sets the time before which the JWT should not be accepted.Sets the nonce claim.protected void
prepare()
Applies state just prior to building the token.Sets the subject of the JWT.Methods inherited from class edu.iu.client.IuJsonBuilder
build, copy, param, param, param, paramNames, toJson
-
Constructor Details
-
JwtBuilder
public JwtBuilder()Default constructor
-
-
Method Details
-
jti
Description copied from interface:WebTokenBuilder
Generates a unique token identifier.- Specified by:
jti
in interfaceWebTokenBuilder
- Returns:
- this
-
jti
Description copied from interface:WebTokenBuilder
Provides a specific token identifier.- Specified by:
jti
in interfaceWebTokenBuilder
- Parameters:
tokenId
- token identifier- Returns:
- this
-
iss
Description copied from interface:WebTokenBuilder
Sets the token issuer URI.- Specified by:
iss
in interfaceWebTokenBuilder
- Parameters:
issuer
-URI
- Returns:
- this
-
aud
Description copied from interface:WebTokenBuilder
Sets the token audience URIs.- Specified by:
aud
in interfaceWebTokenBuilder
- Parameters:
audience
- at least oneURI
- Returns:
- this
-
sub
Description copied from interface:WebTokenBuilder
Sets the subject of the JWT.- Specified by:
sub
in interfaceWebTokenBuilder
- Parameters:
subject
- (sub claim)- Returns:
- this
-
iat
Description copied from interface:WebTokenBuilder
Indicates thatWebTokenBuilder.build()
should set the issued at time to the current time.- Specified by:
iat
in interfaceWebTokenBuilder
- Returns:
- this
-
nbf
Description copied from interface:WebTokenBuilder
Sets the time before which the JWT should not be accepted.- Specified by:
nbf
in interfaceWebTokenBuilder
- Parameters:
notBefore
- not before time (nbf claim)- Returns:
- this
-
exp
Description copied from interface:WebTokenBuilder
Sets the time after which the JWT should not be accepted.- Specified by:
exp
in interfaceWebTokenBuilder
- Parameters:
expires
- token expiration time (exp claim)- Returns:
- this
-
nonce
Description copied from interface:WebTokenBuilder
Sets the nonce claim.- Specified by:
nonce
in interfaceWebTokenBuilder
- Parameters:
nonce
- nonce claim value- Returns:
- this
- See Also:
-
prepare
protected void prepare()Applies state just prior to building the token.Call this method when overriding
build()
to apply any final state, e.g., setting the iat claim value. -
build
Description copied from interface:WebTokenBuilder
Builds aWebToken
instance based on provided claim values.- Specified by:
build
in interfaceWebTokenBuilder
- Returns:
WebToken
-