Class OAuth2Utils (1.46.0)

public class OAuth2Utils

Internal utilities for the com.google.auth.oauth2 namespace.

These classes are marked public but should be treated effectively as internal classes only. They are not subject to any backwards compatibility guarantees and might change or be removed at any time. They are provided only as a convenience for other libraries within the com.google.auth family. Application developers should avoid using these classes directly; they are not part of the public API.

Inheritance

java.lang.Object > OAuth2Utils

Static Fields

CLOUD_PLATFORM_SCOPE

public static final String CLOUD_PLATFORM_SCOPE
Field Value
Type Description
String

HTTP_TRANSPORT_FACTORY

public static final HttpTransportFactory HTTP_TRANSPORT_FACTORY
Field Value
Type Description
HttpTransportFactory

TOKEN_ENDPOINT_RETRYABLE_STATUS_CODES

public static final Set<Integer> TOKEN_ENDPOINT_RETRYABLE_STATUS_CODES
Field Value
Type Description
Set<Integer>

TOKEN_EXCHANGE_URL_FORMAT

public static final String TOKEN_EXCHANGE_URL_FORMAT
Field Value
Type Description
String

TOKEN_TYPE_ACCESS_BOUNDARY_INTERMEDIARY_TOKEN

public static final String TOKEN_TYPE_ACCESS_BOUNDARY_INTERMEDIARY_TOKEN
Field Value
Type Description
String

TOKEN_TYPE_ACCESS_TOKEN

public static final String TOKEN_TYPE_ACCESS_TOKEN
Field Value
Type Description
String

Static Methods

privateKeyFromPkcs8(String privateKeyPkcs8)

public static PrivateKey privateKeyFromPkcs8(String privateKeyPkcs8)

Converts a PKCS#8 string to an RSA private key.

Parameter
Name Description
privateKeyPkcs8 String

the PKCS#8 string.

Returns
Type Description
PrivateKey

the RSA private key.

Exceptions
Type Description
IOException

if the PKCS#8 data is invalid or if an unexpected exception occurs during key creation.

privateKeyFromPkcs8(String privateKeyPkcs8, OAuth2Utils.Pkcs8Algorithm algorithm)

public static PrivateKey privateKeyFromPkcs8(String privateKeyPkcs8, OAuth2Utils.Pkcs8Algorithm algorithm)

Reads a private key from a PKCS#8 encoded string.

If the key is labeled with "-----BEGIN PRIVATE KEY-----", it is parsed as PKCS#8 as per RFC 7468 Section 10. See Also: RFC 7468 Section 10

Parameters
Name Description
privateKeyPkcs8 String

base64 encoded private key string

algorithm com.google.auth.oauth2.OAuth2Utils.Pkcs8Algorithm

expected algorithm of the private key

Returns
Type Description
PrivateKey

the private key.

Exceptions
Type Description
IOException

if the private key data is invalid or if an unexpected exception occurs during key creation.