Package com.google.auth.oauth2
Class JwtClaims
java.lang.Object
com.google.auth.oauth2.JwtClaims
- All Implemented Interfaces:
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:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether or not this set of claims is complete.Returns a new Claims instance with overridden fields.static JwtClaims.Builder
-
Constructor Details
-
JwtClaims
public JwtClaims()
-
-
Method Details
-
newBuilder
-
merge
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
-