Package com.google.auth.oauth2
Class JwtClaims
java.lang.Object
com.google.auth.oauth2.JwtClaims
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AutoValue_JwtClaims
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 -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns additional claims for this object.(package private) abstract String(package private) abstract String(package private) abstract StringbooleanReturns whether or not this set of claims is complete.Returns a new Claims instance with overridden fields.static JwtClaims.Builder
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
JwtClaims
public JwtClaims()
-
-
Method Details
-
getAudience
-
getIssuer
-
getSubject
-
getAdditionalClaims
Returns additional claims for this object. The returned map is not guaranteed to be mutable.- Returns:
- additional claims
-
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
-