Package com.google.auth.oauth2
Class ClientId
- java.lang.Object
-
- com.google.auth.oauth2.ClientId
-
public class ClientId extends java.lang.ObjectAn 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 Modifier and Type Class Description static classClientId.Builder
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringclientIdprivate java.lang.StringclientSecretprivate static java.lang.StringFIELD_CLIENT_IDprivate static java.lang.StringFIELD_CLIENT_SECRETprivate static java.lang.StringFIELD_TYPE_INSTALLEDprivate static java.lang.StringFIELD_TYPE_WEBprivate static java.lang.StringJSON_PARSE_ERROR
-
Constructor Summary
Constructors Modifier Constructor Description privateClientId(java.lang.String clientId, java.lang.String clientSecret)Constructs a client ID using an explicit ID and secret
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ClientIdfromJson(java.util.Map<java.lang.String,java.lang.Object> json)Constructs a Client ID from JSON from a downloaded file.static ClientIdfromResource(java.lang.Class<?> relativeClass, java.lang.String resourceName)Constructs a Client ID from JSON file stored as a resource.static ClientIdfromStream(java.io.InputStream stream)Constructs a Client ID from JSON file stream.java.lang.StringgetClientId()Returns the text identifier of the Client ID.java.lang.StringgetClientSecret()Returns the secret associated with the Client ID.static ClientId.BuildernewBuilder()static ClientIdof(java.lang.String clientId, java.lang.String clientSecret)Constructs a client ID from an explicit ID and secret.ClientId.BuildertoBuilder()
-
-
-
Field Detail
-
FIELD_TYPE_INSTALLED
private static final java.lang.String FIELD_TYPE_INSTALLED
- See Also:
- Constant Field Values
-
FIELD_TYPE_WEB
private static final java.lang.String FIELD_TYPE_WEB
- See Also:
- Constant Field Values
-
FIELD_CLIENT_ID
private static final java.lang.String FIELD_CLIENT_ID
- See Also:
- Constant Field Values
-
FIELD_CLIENT_SECRET
private static final java.lang.String FIELD_CLIENT_SECRET
- See Also:
- Constant Field Values
-
JSON_PARSE_ERROR
private static final java.lang.String JSON_PARSE_ERROR
- See Also:
- Constant Field Values
-
clientId
private final java.lang.String clientId
-
clientSecret
private final java.lang.String clientSecret
-
-
Constructor Detail
-
ClientId
private ClientId(java.lang.String clientId, java.lang.String clientSecret)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 Detail
-
of
public static ClientId of(java.lang.String clientId, java.lang.String clientSecret)
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
public static ClientId fromJson(java.util.Map<java.lang.String,java.lang.Object> json) throws java.io.IOException
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:
java.io.IOException- the JSON could not be parsed
-
fromResource
public static ClientId fromResource(java.lang.Class<?> relativeClass, java.lang.String resourceName) throws java.io.IOException
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:
java.io.IOException- The JSON could not be loaded or parsed.
-
fromStream
public static ClientId fromStream(java.io.InputStream stream) throws java.io.IOException
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:
java.io.IOException- the JSON could not be read or parsed
-
getClientId
public final java.lang.String getClientId()
Returns the text identifier of the Client ID.- Returns:
- The text identifier of the Client ID.
-
getClientSecret
public final java.lang.String getClientSecret()
Returns the secret associated with the Client ID.- Returns:
- The secret associated with the Client ID.
-
newBuilder
public static ClientId.Builder newBuilder()
-
toBuilder
public ClientId.Builder toBuilder()
-
-