2.9.3 (latest) 2.9.2 2.8.1 2.7.2 2.6.0 2.5.1 2.4.1 2.1.2 2.0.1 1.35.2 1.34.1 1.33.4

```java
public class GooglePublicKeysManager
```
Beta   

Thread-safe Google public keys manager.

The public keys are loaded from the public certificates endpoint at [#getPublicCertsEncodedUrl](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GooglePublicKeysManager.md.txt#com_google_api_client_googleapis_auth_oauth2_GooglePublicKeysManager_getPublicCertsEncodedUrl_) and cached in this instance. Therefore, for maximum efficiency,
applications should use a single globally-shared instance of the [GooglePublicKeysManager](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GooglePublicKeysManager.md.txt).

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> GooglePublicKeysManager

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### GooglePublicKeysManager(GooglePublicKeysManager.Builder builder)

```java
protected GooglePublicKeysManager(GooglePublicKeysManager.Builder builder)
```

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `builder` | `GooglePublicKeysManager.Builder` builder |

### GooglePublicKeysManager(HttpTransport transport, JsonFactory jsonFactory)

```java
public GooglePublicKeysManager(HttpTransport transport, JsonFactory jsonFactory)
```

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `transport` | `com.google.api.client.http.HttpTransport` HTTP transport |
| `jsonFactory` | `com.google.api.client.json.JsonFactory` JSON factory |

## Methods

### getClock()

```java
public final Clock getClock()
```
Returns the clock.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.api.client.util.Clock` |   |

### getExpirationTimeMilliseconds()

```java
public final long getExpirationTimeMilliseconds()
```
Returns the expiration time in milliseconds to be used with [Clock#currentTimeMillis()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.util.Clock.md.txt#com_google_api_client_util_Clock_currentTimeMillis_)
or `0` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `long` |   |

### getJsonFactory()

```java
public final JsonFactory getJsonFactory()
```
Returns the JSON factory.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.api.client.json.JsonFactory` |   |

### getPublicCertsEncodedUrl()

```java
public final String getPublicCertsEncodedUrl()
```
Returns the public certificates encoded URL.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `String` |   |

### getPublicKeys()

```java
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()](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GooglePublicKeysManager.md.txt#com_google_api_client_googleapis_auth_oauth2_GooglePublicKeysManager_refresh__) will be called before returning the value.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `List<PublicKey>` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `GeneralSecurityException` |   |
| `IOException` |   |

### getTransport()

```java
public final HttpTransport getTransport()
```
Returns the HTTP transport.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.api.client.http.HttpTransport` |   |

### refresh()

```java
public GooglePublicKeysManager refresh()
```
Forces a refresh of the public certificates downloaded from [#getPublicCertsEncodedUrl](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GooglePublicKeysManager.md.txt#com_google_api_client_googleapis_auth_oauth2_GooglePublicKeysManager_getPublicCertsEncodedUrl_).

This method is automatically called from [#getPublicKeys()](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GooglePublicKeysManager.md.txt#com_google_api_client_googleapis_auth_oauth2_GooglePublicKeysManager_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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GooglePublicKeysManager` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `GeneralSecurityException` |   |
| `IOException` |   |