public class GooglePublicKeysManager
Beta
Thread-safe Google public keys manager.
The public keys are loaded from the public certificates endpoint at #getPublicCertsEncodedUrl and cached in this instance. Therefore, for maximum efficiency, applications should use a single globally-shared instance of the GooglePublicKeysManager.
Constructors
GooglePublicKeysManager(GooglePublicKeysManager.Builder builder)
protected GooglePublicKeysManager(GooglePublicKeysManager.Builder builder)
Name | Description |
builder | GooglePublicKeysManager.Builder builder |
GooglePublicKeysManager(HttpTransport transport, JsonFactory jsonFactory)
public GooglePublicKeysManager(HttpTransport transport, JsonFactory jsonFactory)
Name | Description |
transport | com.google.api.client.http.HttpTransport HTTP transport |
jsonFactory | com.google.api.client.json.JsonFactory JSON factory |
Methods
getClock()
public final Clock getClock()
Returns the clock.
Type | Description |
com.google.api.client.util.Clock |
getExpirationTimeMilliseconds()
public final long getExpirationTimeMilliseconds()
Returns the expiration time in milliseconds to be used with Clock#currentTimeMillis()
or 0
for none.
Type | Description |
long |
getJsonFactory()
public final JsonFactory getJsonFactory()
Returns the JSON factory.
Type | Description |
com.google.api.client.json.JsonFactory |
getPublicCertsEncodedUrl()
public final String getPublicCertsEncodedUrl()
Returns the public certificates encoded URL.
Type | Description |
String |
getPublicKeys()
public final List<PublicKey> getPublicKeys()
Returns an unmodifiable view of the public keys.
For efficiency, an in-memory cache of the public keys is used here. If this method is called for the first time, or the certificates have expired since last time it has been called (or are within 5 minutes of expiring), #refresh() will be called before returning the value.
Type | Description |
List<PublicKey> |
Type | Description |
GeneralSecurityException | |
IOException |
getTransport()
public final HttpTransport getTransport()
Returns the HTTP transport.
Type | Description |
com.google.api.client.http.HttpTransport |
refresh()
public GooglePublicKeysManager refresh()
Forces a refresh of the public certificates downloaded from #getPublicCertsEncodedUrl.
This method is automatically called from #getPublicKeys() if the public keys have not yet been initialized or if the expiration time is very close, so normally this doesn't need to be called. Only call this method to explicitly force the public keys to be updated.
Type | Description |
GooglePublicKeysManager |
Type | Description |
GeneralSecurityException | |
IOException |