Package com.google.auth.oauth2
Class StsRequestHandler
- java.lang.Object
-
- com.google.auth.oauth2.StsRequestHandler
-
final class StsRequestHandler extends java.lang.ObjectImplements the OAuth 2.0 token exchange based on https://tools.ietf.org/html/rfc8693.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStsRequestHandler.Builder
-
Field Summary
Fields Modifier and Type Field Description private com.google.api.client.http.HttpHeadersheadersprivate com.google.api.client.http.HttpRequestFactoryhttpRequestFactoryprivate java.lang.StringinternalOptionsprivate static java.lang.StringPARSE_ERROR_PREFIXprivate StsTokenExchangeRequestrequestprivate static java.lang.StringTOKEN_EXCHANGE_GRANT_TYPEprivate java.lang.StringtokenExchangeEndpoint
-
Constructor Summary
Constructors Modifier Constructor Description privateStsRequestHandler(java.lang.String tokenExchangeEndpoint, StsTokenExchangeRequest request, com.google.api.client.http.HttpRequestFactory httpRequestFactory, com.google.api.client.http.HttpHeaders headers, java.lang.String internalOptions)Internal constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private StsTokenExchangeResponsebuildResponse(com.google.api.client.util.GenericData responseData)private com.google.api.client.util.GenericDatabuildTokenRequest()StsTokenExchangeResponseexchangeToken()Exchanges the provided token for another type of token based on the RFC 8693 spec.static StsRequestHandler.BuildernewBuilder(java.lang.String tokenExchangeEndpoint, StsTokenExchangeRequest stsTokenExchangeRequest, com.google.api.client.http.HttpRequestFactory httpRequestFactory)private com.google.api.client.json.GenericJsonparseJson(java.lang.String json)
-
-
-
Field Detail
-
TOKEN_EXCHANGE_GRANT_TYPE
private static final java.lang.String TOKEN_EXCHANGE_GRANT_TYPE
- See Also:
- Constant Field Values
-
PARSE_ERROR_PREFIX
private static final java.lang.String PARSE_ERROR_PREFIX
- See Also:
- Constant Field Values
-
tokenExchangeEndpoint
private final java.lang.String tokenExchangeEndpoint
-
request
private final StsTokenExchangeRequest request
-
httpRequestFactory
private final com.google.api.client.http.HttpRequestFactory httpRequestFactory
-
headers
@Nullable private final com.google.api.client.http.HttpHeaders headers
-
internalOptions
@Nullable private final java.lang.String internalOptions
-
-
Constructor Detail
-
StsRequestHandler
private StsRequestHandler(java.lang.String tokenExchangeEndpoint, StsTokenExchangeRequest request, com.google.api.client.http.HttpRequestFactory httpRequestFactory, @Nullable com.google.api.client.http.HttpHeaders headers, @Nullable java.lang.String internalOptions)Internal constructor.- Parameters:
tokenExchangeEndpoint- the token exchange endpointrequest- the token exchange requestheaders- optional additional headers to pass along the requestinternalOptions- optional GCP specific STS options
-
-
Method Detail
-
newBuilder
public static StsRequestHandler.Builder newBuilder(java.lang.String tokenExchangeEndpoint, StsTokenExchangeRequest stsTokenExchangeRequest, com.google.api.client.http.HttpRequestFactory httpRequestFactory)
-
exchangeToken
public StsTokenExchangeResponse exchangeToken() throws java.io.IOException
Exchanges the provided token for another type of token based on the RFC 8693 spec.- Throws:
java.io.IOException
-
buildTokenRequest
private com.google.api.client.util.GenericData buildTokenRequest()
-
buildResponse
private StsTokenExchangeResponse buildResponse(com.google.api.client.util.GenericData responseData) throws java.io.IOException
- Throws:
java.io.IOException
-
parseJson
private com.google.api.client.json.GenericJson parseJson(java.lang.String json) throws java.io.IOException- Throws:
java.io.IOException
-
-