Package com.google.auth.oauth2
Class JwtClaims
- java.lang.Object
-
- com.google.auth.oauth2.JwtClaims
-
- All Implemented Interfaces:
Serializable
public abstract class JwtClaims extends Object implements Serializable
Value class representing the set of fields used as the payload of a JWT token.To create and customize claims, use the builder:
Claims claims = Claims.newBuilder() .setAudience("https://example.com/some-audience") .setIssuer("some-issuer@example.com") .setSubject("some-subject@example.com") .build();
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JwtClaims.Builder
-
Constructor Summary
Constructors Constructor Description JwtClaims()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isComplete()
Returns whether or not this set of claims is complete.JwtClaims
merge(JwtClaims other)
Returns a new Claims instance with overridden fields.static JwtClaims.Builder
newBuilder()
-
-
-
Method Detail
-
newBuilder
public static JwtClaims.Builder newBuilder()
-
merge
public JwtClaims merge(JwtClaims other)
Returns a new Claims instance with overridden fields.Any non-null field will overwrite the value from the original claims instance.
- Parameters:
other
- claims to override- Returns:
- new claims
-
isComplete
public boolean isComplete()
Returns whether or not this set of claims is complete.Audience, issuer, and subject are required to be set in order to use the claim set for a JWT token. An incomplete Claims instance is useful for overriding claims when using
ServiceAccountJwtAccessCredentials.jwtWithClaims(JwtClaims)
orJwtCredentials.jwtWithClaims(JwtClaims)
.- Returns:
- true if all required fields have been set; false otherwise
-
-