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

public Class SessionTokenAuthenticationDetailsProvider

extends Object
implements AuthenticationDetailsProvider, RegionProvider, RefreshableOnNotAuthenticatedProvider<String>
Class Inheritance
All Implemented Interfaces
com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider, com.oracle.bmc.auth.RegionProvider, com.oracle.bmc.auth.AuthenticationDetailsProvider, com.oracle.bmc.auth.BasicAuthenticationDetailsProvider, com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider
Annotations
@AuthCachingPolicy
cacheKeyId:false
cachePrivateKey:false
Imports
com.oracle.bmc.ConfigFileReader, .ConfigFileReader.ConfigFile, .InternalSdk, .Region, .Services, com.oracle.bmc.http.Priorities, com.oracle.bmc.http.client.HttpClient, .HttpProvider, com.oracle.bmc.http.internal.AuthnClientFilter, .ClientCall, com.oracle.bmc.http.signing.DefaultRequestSigner, com.oracle.bmc.responses.BmcResponse, com.oracle.bmc.util.internal.Validate, org.slf4j.Logger, java.io.File, .FileWriter, .InputStream, .IOException, java.util.Collections, .List, .Map, .Scanner, java.util.concurrent.Executors, .ScheduledExecutorService, .ScheduledFuture, .TimeUnit

Implementation of AuthenticationDetailsProvider that uses a session token for authentication.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
public static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final long
private static final long
private static final long
private final String
private static final Logger
private final char[]
private final SimplePrivateKeySupplier
private final Region
private ScheduledFuture<V>
private final ScheduledExecutorService
private volatile String
private final String
private final String
private final String
private final boolean

Constructor Summary

AccessConstructor and Description
public
SessionTokenAuthenticationDetailsProvider()

Creates a new instance using the config file at the default location and the default profile.

public
SessionTokenAuthenticationDetailsProvider(String
profile to load, optional
profile
)

Creates a new instance using the config file at the default location, see ConfigFileReader#DEFAULT_FILE_PATH.

public
SessionTokenAuthenticationDetailsProvider(String
path to the OCI configuration file
configurationFilePath
,
String
profile to load, optional
profile
)

Creates a new instance.

protected
SessionTokenAuthenticationDetailsProvider(String privateKeyFilePath, Region region, String regionId, String passPhrase, String tenantId, String fingerprint, String userId, String sessionTokenFilePath, String sessionToken, long initialRefreshDelay, long refreshPeriod, TimeUnit timeUnit, long sessionLifetimeHours, ScheduledExecutorService scheduler, boolean usingDefaultScheduler)

public
SessionTokenAuthenticationDetailsProvider(ConfigFileReader.ConfigFile
The configuration file to use.
configFile
)

Creates a new instance.

Method Summary

Modifier and TypeMethod and Description
public static SessionTokenAuthenticationDetailsProvider.SessionTokenAuthenticationDetailsProviderBuilder

Returns:

A new builder instance.
builder
()

Creates a new SessionTokenAuthenticationDetailsProviderBuilder.

public void
close()

Stops the token refresh scheduler.

public String
getFingerprint()

Implements com.oracle.bmc.auth.AuthenticationDetailsProvider.getFingerprint.

Returns the fingerprint of the key being used.

public String
getKeyId()

Implements com.oracle.bmc.auth.BasicAuthenticationDetailsProvider.getKeyId.

Returns the keyId used to sign requests.

public String
getPassPhrase()

Implements com.oracle.bmc.auth.BasicAuthenticationDetailsProvider.getPassPhrase.

Deprecated

Returns the optional pass phrase for the (encrypted) private key.

public char[]
getPassphraseCharacters()

Implements com.oracle.bmc.auth.BasicAuthenticationDetailsProvider.getPassphraseCharacters.

Returns the optional pass phrase for the (encrypted) private key, as a character array.

public InputStream
getPrivateKey()

Implements com.oracle.bmc.auth.BasicAuthenticationDetailsProvider.getPrivateKey.

Returns a new InputStream to the private key.

public Region
public ExecutorService
getScheduler()

Returns the token refresh scheduler.

public String

Returns:

current session token.
getSessionToken
()

public String
public String
public String
refresh()

Implements com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider.refresh.

Refreshes the session token from the file defined in the OCI config file.

public synchronized boolean

Returns:

true if refresh was successful, false otherwise
refreshSessionToken
()

Makes a call to the Identity service to refresh the session token.

public void
setSessionToken(String
The session token to use.
sessionToken
)

Sets the session token directly from a string.

public void
setSessionTokenFromFilePath(String
The file path to set the session token from.
sessionTokenFilePath
)

Loads the session token from the file specified in the file path.

private void
setTokenRefreshSchedule(long refreshDelay, long refreshInterval, TimeUnit timeUnit, long sessionLifetime)

Default scheduler refreshes session tokens every 55 minutes and stops after 24 hours.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

private void
writeCurrentSessionTokenToFile()

Puts the current session token into the file specified by the sessionTokenFilePath variable.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait