Package com.google.auth.oauth2
Class ClientId
java.lang.Object
com.google.auth.oauth2.ClientId
An OAuth2 user authorization Client ID and associated information.
Corresponds to the information in the json file downloadable for a Client ID.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ClientId
Constructs a Client ID from JSON from a downloaded file.static ClientId
fromResource
(Class<?> relativeClass, String resourceName) Constructs a Client ID from JSON file stored as a resource.static ClientId
fromStream
(InputStream stream) Constructs a Client ID from JSON file stream.final String
Returns the text identifier of the Client ID.final String
Returns the secret associated with the Client ID.static ClientId.Builder
static ClientId
Constructs a client ID from an explicit ID and secret.
-
Field Details
-
FIELD_TYPE_INSTALLED
- See Also:
-
FIELD_TYPE_WEB
- See Also:
-
FIELD_CLIENT_ID
- See Also:
-
FIELD_CLIENT_SECRET
- See Also:
-
JSON_PARSE_ERROR
- See Also:
-
clientId
-
clientSecret
-
-
Constructor Details
-
ClientId
Constructs a client ID using an explicit ID and secretNote: Direct use of this constructor in application code is not recommended to avoid having secrets or values that need to be updated in source code.
- Parameters:
clientId
- Text identifier of the Client ID.clientSecret
- Secret to associated with the Client ID.
-
-
Method Details
-
of
Constructs a client ID from an explicit ID and secret.Note: Direct use of this factory method in application code is not recommended to avoid having secrets or values that need to be updated in source code.
- Parameters:
clientId
- Text identifier of the Client ID.clientSecret
- Secret to associated with the Client ID.- Returns:
- The ClientId instance.
-
fromJson
Constructs a Client ID from JSON from a downloaded file.- Parameters:
json
- the JSON from the downloaded file- Returns:
- the ClientId instance based on the JSON
- Throws:
IOException
- the JSON could not be parsed
-
fromResource
Constructs a Client ID from JSON file stored as a resource.- Parameters:
relativeClass
- a class in the same namespace as the resourceresourceName
- the name of the resource- Returns:
- the constructed ClientID instance based on the JSON in the resource
- Throws:
IOException
- The JSON could not be loaded or parsed.
-
fromStream
Constructs a Client ID from JSON file stream.- Parameters:
stream
- the downloaded JSON file- Returns:
- the constructed ClientID instance based on the JSON in the stream
- Throws:
IOException
- the JSON could not be read or parsed
-
getClientId
Returns the text identifier of the Client ID.- Returns:
- The text identifier of the Client ID.
-
getClientSecret
Returns the secret associated with the Client ID.- Returns:
- The secret associated with the Client ID.
-
newBuilder
-
toBuilder
-