Class IdTokenVerifier.Builder (1.36.0)

public static class IdTokenVerifier.Builder

Builder for IdTokenVerifier.

Implementation is not thread-safe.

Inheritance

java.lang.Object > IdTokenVerifier.Builder

Constructors

Builder()

public Builder()

Methods

build()

public IdTokenVerifier build()

Builds a new instance of IdTokenVerifier.

Returns
Type Description
IdTokenVerifier

getAcceptableTimeSkewSeconds()

public final long getAcceptableTimeSkewSeconds()

Returns the seconds of time skew to accept when verifying time.

Returns
Type Description
long

getAudience()

public final Collection<String> getAudience()

Returns the list of trusted audience client IDs or null to suppress the audience check.

Returns
Type Description
Collection<String>

getClock()

public final Clock getClock()

Returns the clock.

Returns
Type Description
com.google.api.client.util.Clock

getIssuer()

public final String getIssuer()

Returns the first of equivalent expected issuers or null if issuer check suppressed.

Returns
Type Description
String

getIssuers()

public final Collection<String> getIssuers()

Returns the equivalent expected issuers or null if issuer check suppressed.

Returns
Type Description
Collection<String>

setAcceptableTimeSkewSeconds(long acceptableTimeSkewSeconds)

public IdTokenVerifier.Builder setAcceptableTimeSkewSeconds(long acceptableTimeSkewSeconds)

Sets the seconds of time skew to accept when verifying time (default is #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.

Parameter
Name Description
acceptableTimeSkewSeconds long
Returns
Type Description
IdTokenVerifier.Builder

setAudience(Collection<String> audience)

public IdTokenVerifier.Builder setAudience(Collection<String> audience)

Sets the list of trusted audience client IDs or null to suppress the audience check.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameter
Name Description
audience Collection<String>
Returns
Type Description
IdTokenVerifier.Builder

setCertificatesLocation(String certificatesLocation)

public IdTokenVerifier.Builder setCertificatesLocation(String certificatesLocation)

Overrides the location URL that contains published public keys. Defaults to well-known Google locations.

Parameter
Name Description
certificatesLocation String

URL to published public keys

Returns
Type Description
IdTokenVerifier.Builder

the builder

setClock(Clock clock)

public IdTokenVerifier.Builder setClock(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.

Parameter
Name Description
clock com.google.api.client.util.Clock
Returns
Type Description
IdTokenVerifier.Builder

setHttpTransportFactory(HttpTransportFactory httpTransportFactory)

public IdTokenVerifier.Builder setHttpTransportFactory(HttpTransportFactory httpTransportFactory)

Sets the HttpTransportFactory used for requesting public keys from the certificate URL. Used mostly for testing.

Parameter
Name Description
httpTransportFactory HttpTransportFactory

the HttpTransportFactory used to build certificate URL requests

Returns
Type Description
IdTokenVerifier.Builder

the builder

setIssuer(String issuer)

public IdTokenVerifier.Builder setIssuer(String issuer)

Sets the expected issuer or null to suppress the issuer check.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameter
Name Description
issuer String
Returns
Type Description
IdTokenVerifier.Builder

setIssuers(Collection<String> issuers)

public IdTokenVerifier.Builder setIssuers(Collection<String> issuers)

Sets the list of equivalent expected issuers or null to 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.

Parameter
Name Description
issuers Collection<String>
Returns
Type Description
IdTokenVerifier.Builder