Top Description Fields Constructors Methods
com.oracle.bmc.auth.internal

public Class ResourcePrincipalsV3FederationClient

extends AbstractFederationClient
Class Inheritance
Imports
com.oracle.bmc.auth.ResourcePrincipalAuthenticationDetailsProvider, .SessionKeySupplier, com.oracle.bmc.circuitbreaker.CircuitBreakerConfiguration, com.oracle.bmc.http.ClientConfigurator, com.oracle.bmc.http.client.HttpClient, .Method, com.oracle.bmc.http.internal.ClientCall, com.oracle.bmc.http.signing.DefaultRequestSigner, .RequestSigner, com.oracle.bmc.requests.BmcRequest, com.oracle.bmc.util.internal.StringUtils, org.slf4j.Logger, java.security.KeyPair, java.security.interfaces.RSAPublicKey, java.time.Duration, java.util.ArrayList, .HashMap, .List, .Map, .Optional

This class gets a security token from the auth service by fetching the RPST1 and then passing along the RPST1 to get RPT2 and further get security token RPST2 from the auth service, this nested fetching of security token continues for 10 levels or when the opc-parent-url header in the rpt response is the same as the rpt endpoint

Field Summary

Modifier and TypeField and Description
private final ClientConfigurator
private final ResourcePrincipalAuthenticationDetailsProvider
private static final Logger
private final String
private final String
private final String
private volatile SecurityTokenAdapter
Inherited from com.oracle.bmc.auth.internal.AbstractFederationClient:
additionalClientConfiguratorcircuitBreakerfederationClientresourcePrincipalTokenClientsessionKeySupplier

Constructor Summary

AccessConstructor and Description
public
ResourcePrincipalsV3FederationClient(String
the direct url that can provide the resource principal token.
resourcePrincipalTokenUrl
,
String
the endpoint that can provide the resource principal session token.
resourcePrincipalSessionTokenEndpoint
,
SessionKeySupplier
the session key supplier.
sessionKeySupplier
,
ResourcePrincipalAuthenticationDetailsProvider
the auth provider for leaf resource
leafAuthDetailsProvider
,
ClientConfigurator
the rest client configurator.
clientConfigurator
,
CircuitBreakerConfiguration
the rest client circuit breaker configuration.
circuitBreakerConfiguration
)

Constructor of ResourcePrincipalsFederationClient.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

A security token that can be used to authenticate requests.
getSecurityToken
()

Overrides com.oracle.bmc.auth.internal.AbstractFederationClient.getSecurityToken.

Implements com.oracle.bmc.auth.internal.FederationClient.getSecurityToken.

Gets a security token from the federation endpoint.

protected SecurityTokenAdapter

Returns:

the security token, which is basically a JWT token string
getSecurityTokenFromServer
()

Implements abstract com.oracle.bmc.auth.internal.AbstractFederationClient.getSecurityTokenFromServer.

Gets a security token from the federation server

protected SecurityTokenAdapter
getSecurityTokenFromServerInner(RSAPublicKey publicKey, int depth, String lastResourcePrincipalTokenUrl, HttpClient resourcePrincipalTokenClient, HttpClient federationClient)

protected ClientCall<?, GetResourcePrincipalTokenResponse.ResponseWrapper, ?>
prepareRptCall(HttpClient resourcePrincipalTokenClient)

public String

Returns:

A security token that can be used to authenticate requests.
refreshAndGetSecurityTokenIfExpiringWithin
(Duration
the duration to check
time
,
boolean
boolean value to enable/disable refresh of keys
refreshKeys
)

Overrides com.oracle.bmc.auth.internal.AbstractFederationClient.refreshAndGetSecurityTokenIfExpiringWithin.

Implements com.oracle.bmc.auth.ProvidesConfigurableRefresh.refreshAndGetSecurityTokenIfExpiringWithin.

Gets a security token from the federation endpoint if the security token expires within the provided duration and allows to enable/disable refresh of keys.

public String

Returns:

A security token that can be used to authenticate requests.
refreshAndGetSecurityTokenIfExpiringWithin
(Duration
the duration to check
time
)

Overrides com.oracle.bmc.auth.internal.AbstractFederationClient.refreshAndGetSecurityTokenIfExpiringWithin.

Implements com.oracle.bmc.auth.ProvidesConfigurableRefresh.refreshAndGetSecurityTokenIfExpiringWithin.

Gets a security token from the federation endpoint if the security token expires within the provided duration.

protected SecurityTokenAdapter
requestSessionToken(HttpClient federationClient, GetResourcePrincipalSessionTokenRequest getResourcePrincipalSessionTokenRequest)

Inherited from com.oracle.bmc.auth.internal.AbstractFederationClient:
getSecurityTokenAdaptergetStringClaimmakeClientprepareRptCallrefreshAndGetSecurityTokenrefreshAndGetSecurityTokenInnerrequestSessionToken

Field Detail

clientConfiguratorback to summary
private final ClientConfigurator clientConfigurator

Hides com.oracle.bmc.auth.internal.AbstractFederationClient.clientConfigurator.

leafAuthDetailsProviderback to summary
private final ResourcePrincipalAuthenticationDetailsProvider leafAuthDetailsProvider
LOGback to summary
private static final Logger LOG

Hides com.oracle.bmc.auth.internal.AbstractFederationClient.LOG.

OPC_PARENT_RPT_URL_HEADERback to summary
private final String OPC_PARENT_RPT_URL_HEADER
resourcePrincipalSessionTokenEndpointback to summary
private final String resourcePrincipalSessionTokenEndpoint
resourcePrincipalTokenUrlback to summary
private final String resourcePrincipalTokenUrl
securityTokenAdapterback to summary
private volatile SecurityTokenAdapter securityTokenAdapter

Hides com.oracle.bmc.auth.internal.AbstractFederationClient.securityTokenAdapter.

Constructor Detail

ResourcePrincipalsV3FederationClientback to summary
public ResourcePrincipalsV3FederationClient(String resourcePrincipalTokenUrl, String resourcePrincipalSessionTokenEndpoint, SessionKeySupplier sessionKeySupplier, ResourcePrincipalAuthenticationDetailsProvider leafAuthDetailsProvider, ClientConfigurator clientConfigurator, CircuitBreakerConfiguration circuitBreakerConfiguration)

Constructor of ResourcePrincipalsFederationClient.

Parameters
resourcePrincipalTokenUrl:String

the direct url that can provide the resource principal token.

resourcePrincipalSessionTokenEndpoint:String

the endpoint that can provide the resource principal session token.

sessionKeySupplier:SessionKeySupplier

the session key supplier.

leafAuthDetailsProvider:ResourcePrincipalAuthenticationDetailsProvider

the auth provider for leaf resource

clientConfigurator:ClientConfigurator

the rest client configurator.

circuitBreakerConfiguration:CircuitBreakerConfiguration

the rest client circuit breaker configuration.

Method Detail

getSecurityTokenback to summary
public String getSecurityToken()

Overrides com.oracle.bmc.auth.internal.AbstractFederationClient.getSecurityToken.

Implements com.oracle.bmc.auth.internal.FederationClient.getSecurityToken.

Gets a security token from the federation endpoint. May use a cached token if it judged to still be valid.

Returns:String

A security token that can be used to authenticate requests.

Annotations
@Override
getSecurityTokenFromServerback to summary
protected SecurityTokenAdapter getSecurityTokenFromServer()

Implements abstract com.oracle.bmc.auth.internal.AbstractFederationClient.getSecurityTokenFromServer.

Gets a security token from the federation server

Returns:SecurityTokenAdapter

the security token, which is basically a JWT token string

Annotations
@Override
getSecurityTokenFromServerInnerback to summary
protected SecurityTokenAdapter getSecurityTokenFromServerInner(RSAPublicKey publicKey, int depth, String lastResourcePrincipalTokenUrl, HttpClient resourcePrincipalTokenClient, HttpClient federationClient)
prepareRptCallback to summary
protected ClientCall<?, GetResourcePrincipalTokenResponse.ResponseWrapper, ?> prepareRptCall(HttpClient resourcePrincipalTokenClient)
refreshAndGetSecurityTokenIfExpiringWithinback to summary
public String refreshAndGetSecurityTokenIfExpiringWithin(Duration time, boolean refreshKeys)

Overrides com.oracle.bmc.auth.internal.AbstractFederationClient.refreshAndGetSecurityTokenIfExpiringWithin.

Implements com.oracle.bmc.auth.ProvidesConfigurableRefresh.refreshAndGetSecurityTokenIfExpiringWithin.

Gets a security token from the federation endpoint if the security token expires within the provided duration and allows to enable/disable refresh of keys. This will always retrieve a new token from the federation endpoint and does not use a cached token.

Parameters
time:Duration

the duration to check

refreshKeys:boolean

boolean value to enable/disable refresh of keys

Returns:String

A security token that can be used to authenticate requests.

Annotations
@Override
refreshAndGetSecurityTokenIfExpiringWithinback to summary
public String refreshAndGetSecurityTokenIfExpiringWithin(Duration time)

Overrides com.oracle.bmc.auth.internal.AbstractFederationClient.refreshAndGetSecurityTokenIfExpiringWithin.

Implements com.oracle.bmc.auth.ProvidesConfigurableRefresh.refreshAndGetSecurityTokenIfExpiringWithin.

Gets a security token from the federation endpoint if the security token expires within the provided duration. This will always retrieve a new token from the federation endpoint and does not use a cached token.

Parameters
time:Duration

the duration to check

Returns:String

A security token that can be used to authenticate requests.

Annotations
@Override
requestSessionTokenback to summary
protected SecurityTokenAdapter requestSessionToken(HttpClient federationClient, GetResourcePrincipalSessionTokenRequest getResourcePrincipalSessionTokenRequest)