public class ClientId extends Object
Corresponds to the information in the json file downloadable for a Client ID.
Modifier and Type | Class and Description |
---|---|
static class |
ClientId.Builder |
Modifier and Type | Method and Description |
---|---|
static ClientId |
fromJson(Map<String,Object> json)
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.
|
String |
getClientId()
Returns the text identifier of the Client ID.
|
String |
getClientSecret()
Returns the secret associated with the Client ID.
|
static ClientId.Builder |
newBuilder() |
static ClientId |
of(String clientId,
String clientSecret)
Constructs a client ID from an explicit ID and secret.
|
ClientId.Builder |
toBuilder() |
public static ClientId of(String clientId, String clientSecret)
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.
clientId
- Text identifier of the Client ID.clientSecret
- Secret to associated with the Client ID.public static ClientId fromJson(Map<String,Object> json) throws IOException
json
- the JSON from the downloaded fileIOException
- the JSON could not be parsedpublic static ClientId fromResource(Class<?> relativeClass, String resourceName) throws IOException
relativeClass
- a class in the same namespace as the resourceresourceName
- the name of the resourceIOException
- The JSON could not be loaded or parsed.public static ClientId fromStream(InputStream stream) throws IOException
stream
- the downloaded JSON fileIOException
- the JSON could not be read or parsedpublic final String getClientId()
public final String getClientSecret()
public static ClientId.Builder newBuilder()
public ClientId.Builder toBuilder()
Copyright © 2023 Google. All rights reserved.