Package com.google.auth.oauth2
Class TokenVerifier.Builder
java.lang.Object
com.google.auth.oauth2.TokenVerifier.Builder
- Enclosing class:
TokenVerifier
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private String
private com.google.api.client.util.Clock
private HttpTransportFactory
private String
private PublicKey
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build the custom TokenVerifier for verifying tokens.setAudience
(String audience) Set a target audience to verify.setCertificatesLocation
(String certificatesLocation) Override the location URL that contains published public keys.setClock
(com.google.api.client.util.Clock clock) Set the clock for checking token expiry.setHttpTransportFactory
(HttpTransportFactory httpTransportFactory) Set the HttpTransportFactory used for requesting public keys from the certificate URL.Set the issuer to verify.setPublicKey
(PublicKey publicKey) Set the PublicKey for verifying the signature.
-
Field Details
-
audience
-
certificatesLocation
-
issuer
-
publicKey
-
clock
private com.google.api.client.util.Clock clock -
httpTransportFactory
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setAudience
Set a target audience to verify.- Parameters:
audience
- the audience claim to verify- Returns:
- the builder
-
setCertificatesLocation
Override the location URL that contains published public keys. Defaults to well-known Google locations.- Parameters:
certificatesLocation
- URL to published public keys- Returns:
- the builder
-
setIssuer
Set the issuer to verify.- Parameters:
issuer
- the issuer claim to verify- Returns:
- the builder
-
setPublicKey
Set the PublicKey for verifying the signature. This will ignore the key id from the JWT token header.- Parameters:
publicKey
- the public key to validate the signature- Returns:
- the builder
-
setClock
Set the clock for checking token expiry. Used for testing.- Parameters:
clock
- the clock to use. Defaults to the system clock- Returns:
- the builder
-
setHttpTransportFactory
Set the HttpTransportFactory used for requesting public keys from the certificate URL. Used mostly for testing.- Parameters:
httpTransportFactory
- the HttpTransportFactory used to build certificate URL requests- Returns:
- the builder
-
build
Build the custom TokenVerifier for verifying tokens.- Returns:
- the customized TokenVerifier
-