Package com.google.auth.oauth2
Class JwtClaims
- java.lang.Object
-
- com.google.auth.oauth2.JwtClaims
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
AutoValue_JwtClaims
public abstract class JwtClaims extends java.lang.Object implements java.io.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
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description JwtClaims()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract java.util.Map<java.lang.String,java.lang.String>
getAdditionalClaims()
Returns additional claims for this object.(package private) abstract java.lang.String
getAudience()
(package private) abstract java.lang.String
getIssuer()
(package private) abstract java.lang.String
getSubject()
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()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAudience
@Nullable abstract java.lang.String getAudience()
-
getIssuer
@Nullable abstract java.lang.String getIssuer()
-
getSubject
@Nullable abstract java.lang.String getSubject()
-
getAdditionalClaims
abstract java.util.Map<java.lang.String,java.lang.String> getAdditionalClaims()
Returns additional claims for this object. The returned map is not guaranteed to be mutable.- Returns:
- additional claims
-
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
-
-