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

public abstract Class AbstractFederationClientAuthenticationDetailsProviderBuilder<B extends AbstractFederationClientAuthenticationDetailsProviderBuilder<B, P>, P extends AbstractAuthenticationDetailsProvider>

extends AbstractRequestingAuthenticationDetailsProvider.Builder<B extends AbstractFederationClientAuthenticationDetailsProviderBuilder<B, P>>
Class Inheritance
Known Direct Subclasses
com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider.InstancePrincipalsAuthenticationDetailsProviderBuilder, com.oracle.bmc.auth.ResourcePrincipalAuthenticationDetailsProvider.ResourcePrincipalAuthenticationDetailsProviderBuilder
Annotations
@InternalSdk
Type Parameters
<B>
builder class
<P>
provider class
Imports
com.oracle.bmc.internal.Alloy, com.oracle.bmc.InternalSdk, .Realm, .Region, com.oracle.bmc.auth.internal.AuthUtils, .FederationClient, .X509FederationClient, com.oracle.bmc.circuitbreaker.CircuitBreakerConfiguration, com.oracle.bmc.http.client.HttpClient, .HttpProvider, .HttpResponse, .Method, .StandardClientProperties, com.oracle.bmc.http.internal.SyncFutureWaiter, com.oracle.bmc.util.CircuitBreakerUtils, com.oracle.bmc.util.internal.StringUtils, com.oracle.bmc.waiter.ExponentialBackoffDelayStrategyWithJitter, .WaiterConfiguration, org.slf4j.Logger, java.net.MalformedURLException, .URI, .URL, java.security.KeyPair, .KeyPairGenerator, .NoSuchAlgorithmException, java.time.Duration, java.util.Collections, .HashMap, .HashSet, .Map, .Optional, java.util.concurrent.CompletableFuture, .CompletionStage, .TimeUnit, java.util.function.Function

Abstract builder base class for authentication details provider extending AbstractRequestingAuthenticationDetailsProvider

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
AbstractFederationClientAuthenticationDetailsProviderBuilder.SessionKeySupplierImpl

This is a helper class to generate in-memory temporary session keys.

Field Summary

Modifier and TypeField and Description
private static final Map<String, String>
public static final String
AUTHORIZATION_HEADER_VALUE

The Authorization header value to be sent for requests to the metadata service.

protected CircuitBreakerConfiguration
circuitBreakerConfiguration

The configuration for the circuit breaker.

protected int
detectEndpointRetries

The number of retries for auto-detecting endpoint.

protected String
federationEndpoint

The federation endpoint url.

protected X509CertificateSupplier
leafCertificateSupplier

The leaf certificate, or null if detecting from instance metadata.

private static final Logger
public static final String
METADATA_BASE_URL_ENV_VAR

Environment variable used to overwrite the default metadata base url.

public static final String
METADATA_SERVICE_BASE_URL

Default base url of metadata service.

public static final String
METADATA_URL_OVERRIDE

Metadata URL from environment variable, to use if present.

protected volatile String
metadataBaseUrl

Base url of metadata service.

private String
protected Region
region

Detected region.

private static final String
protected static final Service
SERVICE

Service instance for auth.

protected String
tenancyId

Tenancy OCI, or null if detecting from instance metadata.

protected int
timeoutForEachRetry

The custom timeout for each retry for auto-detecting endpoint.

private volatile boolean
wasImdsV2CheckExecuted

Flag to ensure V2 endpoint is only checked once, if successful.

Inherited from com.oracle.bmc.auth.AbstractRequestingAuthenticationDetailsProvider.Builder:
additionalFederationClientConfiguratorsfederationClientfederationClientConfiguratorintermediateCertificateSupplierssessionKeySupplier

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
autoDetectCertificatesUsingMetadataUrl()

Auto detects and configures the certificates needed using Instance metadata.

protected String

Returns:

The auto-detected, or currently set, auth endpoint.
autoDetectEndpointUsingMetadataUrl
()

Auto detects the endpoint that should be used when talking to OCI Auth, if no endpoint has been configured already.

protected void
autoDetectUsingMetadataUrl()

Auto-detect endpoint and certificate information using Instance metadata.

public P

Returns:

A new provider instance.
build
()

Build a new AuthenticationDetailsProvider that uses the FederationClient.

protected abstract P

Returns:

authentication details provider
buildProvider
(SessionKeySupplier
the session key supplier to use
sessionKeySupplierToUse
)

Build the actual provider.

public B

Returns:

this builder
circuitBreakerConfigurator
(CircuitBreakerConfiguration
the circuit breaker to use
circuitBreakerConfiguration
)

Configures the Circuit Breaker to use, if any.

protected FederationClient

Returns:

the federation client
createFederationClient
(SessionKeySupplier
the session key supplier
sessionKeySupplier
)

Create the federation client.

public B

Returns:

this builder
detectEndpointRetries
(int
the number of retries
detectEndpointRetries
)

Configures the custom retries to use for detecting endpoint.

private void
executeImdsV2EndpointCheck()

Checks the V2 endpoint for both federation endpoint detection & certificates if necessary.

public B

Returns:

this builder
federationEndpoint
(String
the federation endpoint
federationEndpoint
)

Configures the custom federationEndpoint to use.

private <R> R
public String
public X509CertificateSupplier
public String
private URLBasedX509CertificateSupplier.ResourceDetails
public Region
public String
public B

Returns:

this builder
leafCertificateSupplier
(X509CertificateSupplier leafCertificateSupplier)

Configures the custom leafCertificateSupplier to use.

public B

Returns:

this builder
metadataBaseUrl
(String
the metadata base url
metadataBaseUrl
)

Configure the metadata endpoint to use when retrieving the instance data and principal for federation.

protected B

Returns:

this builder
purpose
(String
the purpose string
purpose
)

Configure the purpose to be used.

public B

Returns:

this builder
tenancyId
(String
the tenancy OCID
tenancyId
)

Configures the tenancy id to use.

public B

Returns:

this builder
timeoutForEachRetry
(int
the custom timeout
timeoutForEachRetry
)

Configures the custom timeout for each retry to use for detecting endpoint.

Inherited from com.oracle.bmc.auth.AbstractRequestingAuthenticationDetailsProvider.Builder:
additionalFederationClientConfiguratorfederationClientConfiguratorintermediateCertificateSupplierssessionKeySupplier

Field Detail

AUTHORIZATION_HEADERback to summary
private static final Map<String, String> AUTHORIZATION_HEADER
AUTHORIZATION_HEADER_VALUEback to summary
public static final String AUTHORIZATION_HEADER_VALUE

The Authorization header value to be sent for requests to the metadata service.

circuitBreakerConfigurationback to summary
protected CircuitBreakerConfiguration circuitBreakerConfiguration

The configuration for the circuit breaker.

detectEndpointRetriesback to summary
protected int detectEndpointRetries

The number of retries for auto-detecting endpoint.

federationEndpointback to summary
protected String federationEndpoint

The federation endpoint url.

leafCertificateSupplierback to summary
protected X509CertificateSupplier leafCertificateSupplier

The leaf certificate, or null if detecting from instance metadata.

LOGback to summary
private static final Logger LOG
METADATA_BASE_URL_ENV_VARback to summary
public static final String METADATA_BASE_URL_ENV_VAR

Environment variable used to overwrite the default metadata base url.

METADATA_SERVICE_BASE_URLback to summary
public static final String METADATA_SERVICE_BASE_URL

Default base url of metadata service.

METADATA_URL_OVERRIDEback to summary
public static final String METADATA_URL_OVERRIDE

Metadata URL from environment variable, to use if present.

metadataBaseUrlback to summary
protected volatile String metadataBaseUrl

Base url of metadata service.

purposeback to summary
private String purpose
regionback to summary
protected Region region

Detected region.

REGION_PATH_LITERALback to summary
private static final String REGION_PATH_LITERAL
SERVICEback to summary
protected static final Service SERVICE

Service instance for auth.

tenancyIdback to summary
protected String tenancyId

Tenancy OCI, or null if detecting from instance metadata.

timeoutForEachRetryback to summary
protected int timeoutForEachRetry

The custom timeout for each retry for auto-detecting endpoint.

wasImdsV2CheckExecutedback to summary
private volatile boolean wasImdsV2CheckExecuted

Flag to ensure V2 endpoint is only checked once, if successful.

Constructor Detail

AbstractFederationClientAuthenticationDetailsProviderBuilderback to summary
public AbstractFederationClientAuthenticationDetailsProviderBuilder()

Method Detail

autoDetectCertificatesUsingMetadataUrlback to summary
protected void autoDetectCertificatesUsingMetadataUrl()

Auto detects and configures the certificates needed using Instance metadata.

autoDetectEndpointUsingMetadataUrlback to summary
protected String autoDetectEndpointUsingMetadataUrl()

Auto detects the endpoint that should be used when talking to OCI Auth, if no endpoint has been configured already.

Returns:String

The auto-detected, or currently set, auth endpoint.

autoDetectUsingMetadataUrlback to summary
protected void autoDetectUsingMetadataUrl()

Auto-detect endpoint and certificate information using Instance metadata.

buildback to summary
public P build()

Build a new AuthenticationDetailsProvider that uses the FederationClient.

Returns:P

A new provider instance.

buildProviderback to summary
protected abstract P buildProvider(SessionKeySupplier sessionKeySupplierToUse)

Build the actual provider.

Parameters
sessionKeySupplierToUse:SessionKeySupplier

the session key supplier to use

Returns:P

authentication details provider

circuitBreakerConfiguratorback to summary
public B circuitBreakerConfigurator(CircuitBreakerConfiguration circuitBreakerConfiguration)

Configures the Circuit Breaker to use, if any.

Parameters
circuitBreakerConfiguration:CircuitBreakerConfiguration

the circuit breaker to use

Returns:B

this builder

createFederationClientback to summary
protected FederationClient createFederationClient(SessionKeySupplier sessionKeySupplier)

Create the federation client.

Parameters
sessionKeySupplier:SessionKeySupplier

the session key supplier

Returns:FederationClient

the federation client

detectEndpointRetriesback to summary
public B detectEndpointRetries(int detectEndpointRetries)

Configures the custom retries to use for detecting endpoint.

Parameters
detectEndpointRetries:int

the number of retries

Returns:B

this builder

executeImdsV2EndpointCheckback to summary
private void executeImdsV2EndpointCheck()

Checks the V2 endpoint for both federation endpoint detection & certificates if necessary.

federationEndpointback to summary
public B federationEndpoint(String federationEndpoint)

Configures the custom federationEndpoint to use.

Parameters
federationEndpoint:String

the federation endpoint

Returns:B

this builder

fetchRegionback to summary
private <R> R fetchRegion(Function<HttpResponse, CompletionStage<R>> responseHandler)
getFederationEndpointback to summary
public String getFederationEndpoint()
getLeafCertificateSupplierback to summary
public X509CertificateSupplier getLeafCertificateSupplier()
getMetadataBaseUrlback to summary
public String getMetadataBaseUrl()
getMetadataResourceDetailsback to summary
private URLBasedX509CertificateSupplier.ResourceDetails getMetadataResourceDetails(final String path) throws MalformedURLException
getRegionback to summary
public Region getRegion()
getTenancyIdback to summary
public String getTenancyId()
leafCertificateSupplierback to summary
public B leafCertificateSupplier(X509CertificateSupplier leafCertificateSupplier)

Configures the custom leafCertificateSupplier to use.

Returns:B

this builder

metadataBaseUrlback to summary
public B metadataBaseUrl(String metadataBaseUrl)

Configure the metadata endpoint to use when retrieving the instance data and principal for federation.

Parameters
metadataBaseUrl:String

the metadata base url

Returns:B

this builder

purposeback to summary
protected B purpose(String purpose)

Configure the purpose to be used.

Parameters
purpose:String

the purpose string

Returns:B

this builder

tenancyIdback to summary
public B tenancyId(String tenancyId)

Configures the tenancy id to use.

Parameters
tenancyId:String

the tenancy OCID

Returns:B

this builder

timeoutForEachRetryback to summary
public B timeoutForEachRetry(int timeoutForEachRetry)

Configures the custom timeout for each retry to use for detecting endpoint.

Parameters
timeoutForEachRetry:int

the custom timeout

Returns:B

this builder

com.oracle.bmc.auth back to summary

pack-priv Class AbstractFederationClientAuthenticationDetailsProviderBuilder.SessionKeySupplierImpl

extends Object
implements SessionKeySupplier
Class Inheritance
  • java.lang.Object
  • com.oracle.bmc.auth.AbstractFederationClientAuthenticationDetailsProviderBuilder.SessionKeySupplierImpl
All Implemented Interfaces
com.oracle.bmc.auth.SessionKeySupplier

This is a helper class to generate in-memory temporary session keys.

The thread safety of this class is ensured through the Caching class above which synchronizes on all methods.

The class is implemented in a lazy way to avoid generating the key if it is not needed or if refresh is immediately called.

Field Summary

Modifier and TypeField and Description
private static final KeyPairGenerator
private KeyPair

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public KeyPair
getKeyPair()

Implements com.oracle.bmc.auth.SessionKeySupplier.getKeyPair.

Returns the current RSA key pair.

public void
refreshKeys()

Implements com.oracle.bmc.auth.SessionKeySupplier.refreshKeys.

If the auth service-issued security token expires, the federation client will try to re-generate a new set of keys by calling this method.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GENERATORback to summary
private static final KeyPairGenerator GENERATOR
keyPairback to summary
private KeyPair keyPair

Constructor Detail

SessionKeySupplierImplback to summary
pack-priv SessionKeySupplierImpl()

Method Detail

getKeyPairback to summary
public KeyPair getKeyPair()

Implements com.oracle.bmc.auth.SessionKeySupplier.getKeyPair.

Doc from com.oracle.bmc.auth.SessionKeySupplier.getKeyPair.

Returns the current RSA key pair.

Returns:KeyPair

The RSA key pair.

Annotations
@Override
refreshKeysback to summary
public void refreshKeys()

Implements com.oracle.bmc.auth.SessionKeySupplier.refreshKeys.

Doc from com.oracle.bmc.auth.SessionKeySupplier.refreshKeys.

If the auth service-issued security token expires, the federation client will try to re-generate a new set of keys by calling this method. The implementer should create a new pair of keys for security reasons.

Refreshing keys should not be a long-running blocking call. You can refresh keys in an async thread and return from this method immediately. When the async process is done refreshing the keys, the client code will automatically pick up the latest set of keys and update the security token accordingly

Annotations
@Override