public abstract class JwtClaims extends Object implements Serializable
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();
Modifier and Type | Class and Description |
---|---|
static class |
JwtClaims.Builder |
Constructor and Description |
---|
JwtClaims() |
Modifier and Type | Method and 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() |
public static JwtClaims.Builder newBuilder()
public JwtClaims merge(JwtClaims other)
Any non-null field will overwrite the value from the original claims instance.
other
- claims to overridepublic boolean isComplete()
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)
or JwtCredentials.jwtWithClaims(JwtClaims)
.
Copyright © 2023 Google. All rights reserved.