LocalFileCredentialFactory
Stay organized with collections
Save and categorize content based on your preferences.
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. If api.serviceAccountPrivateKeyFile
is not a json key, then api.serviceAccountId
is
required.
Inherited Method Summary
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
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
GoogleCredential
getCredential
(Collection<String> scopes)
Parameters
scopes |
the OAuth 2.0 scope requirements to access the Cloud Search API |
Throws
GeneralSecurityException |
|
IOException |
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-03-18 UTC.
[null,null,["Last updated 2025-03-18 UTC."],[],[],null,["# LocalFileCredentialFactory\n\npublic class **LocalFileCredentialFactory** extends Object \nimplements [CredentialFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/CredentialFactory) \nFactory to create a [GoogleCredential](/workspace/cloud-search/docs/reference/sdk/com/google/api/client/googleapis/auth/oauth2/GoogleCredential) object for accessing the Cloud Search API.\n\nRequired configuration parameters:\n\n- `api.serviceAccountPrivateKeyFile` - Specifies the service account private key file path.\n\nOptional configuration parameters:\n\n- `api.serviceAccountId` - Specifies the service account ID. If `api.serviceAccountPrivateKeyFile` is not a json key, then `api.serviceAccountId` is required.\n\n\u003cbr /\u003e\n\n### Nested Class Summary\n\n|-------|---|---|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| class | [LocalFileCredentialFactory.Builder](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/LocalFileCredentialFactory.Builder) || Builder for creating instance of [LocalFileCredentialFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/LocalFileCredentialFactory). |\n\n### Constant Summary\n\n|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|\n| String | [SERVICE_ACCOUNT_ID_CONFIG](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/LocalFileCredentialFactory#SERVICE_ACCOUNT_ID_CONFIG) | Configuration key for service account ID. |\n| String | [SERVICE_ACCOUNT_KEY_FILE_CONFIG](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/LocalFileCredentialFactory#SERVICE_ACCOUNT_KEY_FILE_CONFIG) | Configuration key for service account key file path. |\n\n### Public Method Summary\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [LocalFileCredentialFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/LocalFileCredentialFactory) | [fromConfiguration](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/LocalFileCredentialFactory#fromConfiguration())() Method to build an instance of [LocalFileCredentialFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/LocalFileCredentialFactory) from configuration. |\n| GoogleCredential | [getCredential](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/LocalFileCredentialFactory#getCredential(java.util.Collection\u003cjava.lang.String\u003e))(Collection\\\u003cString\\\u003e scopes) Gets [GoogleCredential](/workspace/cloud-search/docs/reference/sdk/com/google/api/client/googleapis/auth/oauth2/GoogleCredential) instance constructed for service account. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface [com.google.enterprise.cloudsearch.sdk.CredentialFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/CredentialFactory) \n\n|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract GoogleCredential | [getCredential](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/CredentialFactory#getCredential(java.util.Collection\u003cjava.lang.String\u003e))(Collection\\\u003cString\\\u003e scopes) Creates a [GoogleCredential](/workspace/cloud-search/docs/reference/sdk/com/google/api/client/googleapis/auth/oauth2/GoogleCredential) object for accessing the Cloud Search API. |\n\nConstants\n---------\n\n#### public static final String\n**SERVICE_ACCOUNT_ID_CONFIG**\n\nConfiguration key for service account ID. \nConstant Value: \"api.serviceAccountId\" \n\n#### public static final String\n**SERVICE_ACCOUNT_KEY_FILE_CONFIG**\n\nConfiguration key for service account key file path. \nConstant Value: \"api.serviceAccountPrivateKeyFile\"\n\nPublic Methods\n--------------\n\n#### public static [LocalFileCredentialFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/LocalFileCredentialFactory)\n**fromConfiguration**\n()\n\nMethod to build an instance of [LocalFileCredentialFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/LocalFileCredentialFactory) from configuration. \n\n##### Returns\n\n- an instance of [LocalFileCredentialFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/LocalFileCredentialFactory) \n\n#### public GoogleCredential\n**getCredential**\n(Collection\\\u003cString\\\u003e scopes)\n\nGets [GoogleCredential](/workspace/cloud-search/docs/reference/sdk/com/google/api/client/googleapis/auth/oauth2/GoogleCredential) instance constructed for service account. \n\n##### Parameters\n\n| scopes | the OAuth 2.0 scope requirements to access the Cloud Search API |\n|--------|-----------------------------------------------------------------|\n\n##### Returns\n\n- a fully built [GoogleCredential](/workspace/cloud-search/docs/reference/sdk/com/google/api/client/googleapis/auth/oauth2/GoogleCredential) \n\n##### Throws\n\n| GeneralSecurityException | |\n| IOException | |\n|--------------------------|---|"]]