public class
LocalFileCredentialFactory
extends Object
implements CredentialFactory
implements CredentialFactory
Factory to create a GoogleCredential object for accessing the Cloud Search API.
Required configuration parameters:
api.serviceAccountPrivateKeyFile- Specifies the service account private key file path.
Optional configuration parameters:
api.serviceAccountId- Specifies the service account ID. Ifapi.serviceAccountPrivateKeyFileis not a json key, thenapi.serviceAccountIdis required.
Nested Class Summary
| class | LocalFileCredentialFactory.Builder | Builder for creating instance of LocalFileCredentialFactory. |
|
Constant Summary
| String | SERVICE_ACCOUNT_ID_CONFIG | Configuration key for service account ID. |
| String | SERVICE_ACCOUNT_KEY_FILE_CONFIG | Configuration key for service account key file path. |
Public Method Summary
| static LocalFileCredentialFactory |
fromConfiguration()
Method to build an instance of
LocalFileCredentialFactory from configuration. |
| GoogleCredential |
getCredential(Collection<String> scopes)
Gets
GoogleCredential instance constructed for service account. |
Inherited Method Summary
Constants
public static final String SERVICE_ACCOUNT_ID_CONFIG
Configuration key for service account ID.
Constant Value:
"api.serviceAccountId"
public static final String SERVICE_ACCOUNT_KEY_FILE_CONFIG
Configuration key for service account key file path.
Constant Value:
"api.serviceAccountPrivateKeyFile"
Public Methods
public static LocalFileCredentialFactory fromConfiguration ()
Method to build an instance of LocalFileCredentialFactory from configuration.
Returns
- an instance of
LocalFileCredentialFactory
public GoogleCredential getCredential (Collection<String> scopes)
Gets GoogleCredential instance constructed for service account.
Parameters
| scopes | the OAuth 2.0 scope requirements to access the Cloud Search API |
|---|
Returns
- a fully built
GoogleCredential
Throws
| GeneralSecurityException | |
|---|---|
| IOException |