Class IdTokenVerifier.Builder
- java.lang.Object
-
- com.google.api.client.auth.openidconnect.IdTokenVerifier.Builder
-
- Enclosing class:
- IdTokenVerifier
@Beta public static class IdTokenVerifier.Builder extends java.lang.Object- Since:
- 1.16
-
-
Field Summary
Fields Modifier and Type Field Description (package private) longacceptableTimeSkewSecondsSeconds of time skew to accept when verifying time.(package private) java.util.Collection<java.lang.String>audienceList of trusted audience client IDs ornullto suppress the audience check.(package private) java.lang.StringcertificatesLocation(package private) com.google.api.client.util.ClockclockClock.(package private) Environmentenvironmentwrapper for environment variables(package private) HttpTransportFactoryhttpTransportFactory(package private) java.util.Collection<java.lang.String>issuersCollection of equivalent expected issuers ornullto suppress the issuer check.
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IdTokenVerifierbuild()Builds a new instance ofIdTokenVerifier.longgetAcceptableTimeSkewSeconds()Returns the seconds of time skew to accept when verifying time.java.util.Collection<java.lang.String>getAudience()Returns the list of trusted audience client IDs ornullto suppress the audience check.com.google.api.client.util.ClockgetClock()Returns the clock.(package private) EnvironmentgetEnvironment()Returns an instance of theEnvironmentjava.lang.StringgetIssuer()Returns the first of equivalent expected issuers ornullif issuer check suppressed.java.util.Collection<java.lang.String>getIssuers()Returns the equivalent expected issuers ornullif issuer check suppressed.IdTokenVerifier.BuildersetAcceptableTimeSkewSeconds(long acceptableTimeSkewSeconds)Sets the seconds of time skew to accept when verifying time (default isIdTokenVerifier.DEFAULT_TIME_SKEW_SECONDS).IdTokenVerifier.BuildersetAudience(java.util.Collection<java.lang.String> audience)Sets the list of trusted audience client IDs ornullto suppress the audience check.IdTokenVerifier.BuildersetCertificatesLocation(java.lang.String certificatesLocation)Override the location URL that contains published public keys.IdTokenVerifier.BuildersetClock(com.google.api.client.util.Clock clock)Sets the clock.(package private) IdTokenVerifier.BuildersetEnvironment(Environment environment)Sets the environment.IdTokenVerifier.BuildersetHttpTransportFactory(HttpTransportFactory httpTransportFactory)Sets the HttpTransportFactory used for requesting public keys from the certificate URL.IdTokenVerifier.BuildersetIssuer(java.lang.String issuer)Sets the expected issuer ornullto suppress the issuer check.IdTokenVerifier.BuildersetIssuers(java.util.Collection<java.lang.String> issuers)Sets the list of equivalent expected issuers ornullto suppress the issuer check.
-
-
-
Field Detail
-
clock
com.google.api.client.util.Clock clock
Clock.
-
certificatesLocation
java.lang.String certificatesLocation
-
environment
Environment environment
wrapper for environment variables
-
acceptableTimeSkewSeconds
long acceptableTimeSkewSeconds
Seconds of time skew to accept when verifying time.
-
issuers
java.util.Collection<java.lang.String> issuers
Collection of equivalent expected issuers ornullto suppress the issuer check.
-
audience
java.util.Collection<java.lang.String> audience
List of trusted audience client IDs ornullto suppress the audience check.
-
httpTransportFactory
HttpTransportFactory httpTransportFactory
-
-
Method Detail
-
build
public IdTokenVerifier build()
Builds a new instance ofIdTokenVerifier.
-
getClock
public final com.google.api.client.util.Clock getClock()
Returns the clock.
-
setClock
public IdTokenVerifier.Builder setClock(com.google.api.client.util.Clock clock)
Sets the clock.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getIssuer
public final java.lang.String getIssuer()
Returns the first of equivalent expected issuers ornullif issuer check suppressed.
-
setIssuer
public IdTokenVerifier.Builder setIssuer(java.lang.String issuer)
Sets the expected issuer ornullto suppress the issuer check.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
setCertificatesLocation
public IdTokenVerifier.Builder setCertificatesLocation(java.lang.String certificatesLocation)
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
-
getIssuers
public final java.util.Collection<java.lang.String> getIssuers()
Returns the equivalent expected issuers ornullif issuer check suppressed.- Since:
- 1.21.0
-
setIssuers
public IdTokenVerifier.Builder setIssuers(java.util.Collection<java.lang.String> issuers)
Sets the list of equivalent expected issuers ornullto suppress the issuer check. Typically only a single issuer should be used, but multiple may be specified to support an issuer transitioning to a new string. The collection must not be empty.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Since:
- 1.21.0
-
getAudience
public final java.util.Collection<java.lang.String> getAudience()
Returns the list of trusted audience client IDs ornullto suppress the audience check.
-
setAudience
public IdTokenVerifier.Builder setAudience(java.util.Collection<java.lang.String> audience)
Sets the list of trusted audience client IDs ornullto suppress the audience check.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getAcceptableTimeSkewSeconds
public final long getAcceptableTimeSkewSeconds()
Returns the seconds of time skew to accept when verifying time.
-
setAcceptableTimeSkewSeconds
public IdTokenVerifier.Builder setAcceptableTimeSkewSeconds(long acceptableTimeSkewSeconds)
Sets the seconds of time skew to accept when verifying time (default isIdTokenVerifier.DEFAULT_TIME_SKEW_SECONDS).It must be greater or equal to zero.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getEnvironment
final Environment getEnvironment()
Returns an instance of theEnvironment
-
setEnvironment
IdTokenVerifier.Builder setEnvironment(Environment environment)
Sets the environment. Used mostly for testing
-
setHttpTransportFactory
public IdTokenVerifier.Builder setHttpTransportFactory(HttpTransportFactory httpTransportFactory)
Sets 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
-
-