public class SessionTokenAuthenticationDetailsProvider extends Object implements AuthenticationDetailsProvider, RegionProvider, RefreshableOnNotAuthenticatedProvider<String>
Implementation of AuthenticationDetailsProvider
that uses a session token for
authentication.
Modifier and Type | Class and Description |
---|---|
static class |
SessionTokenAuthenticationDetailsProvider.SessionToken |
static class |
SessionTokenAuthenticationDetailsProvider.SessionTokenAuthenticationDetailsProviderBuilder
Builder for SessionTokenAuthenticationDetailsProvider.
|
static class |
SessionTokenAuthenticationDetailsProvider.SessionTokenRefreshRequest |
Modifier | Constructor and Description |
---|---|
|
SessionTokenAuthenticationDetailsProvider()
Creates a new instance using the config file at the default location and the default profile.
|
|
SessionTokenAuthenticationDetailsProvider(ConfigFileReader.ConfigFile configFile)
Creates a new instance.
|
|
SessionTokenAuthenticationDetailsProvider(String profile)
Creates a new instance using the config file at the default location, see
ConfigFileReader.DEFAULT_FILE_PATH . |
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) |
|
SessionTokenAuthenticationDetailsProvider(String configurationFilePath,
String profile)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
static SessionTokenAuthenticationDetailsProvider.SessionTokenAuthenticationDetailsProviderBuilder |
builder()
Creates a new SessionTokenAuthenticationDetailsProviderBuilder.
|
void |
close()
Stops the token refresh scheduler.
|
String |
getFingerprint()
Returns the fingerprint of the key being used.
|
String |
getKeyId()
Returns the keyId used to sign requests.
|
String |
getPassPhrase()
Deprecated.
|
char[] |
getPassphraseCharacters()
Returns the optional pass phrase for the (encrypted) private key, as a character array.
|
InputStream |
getPrivateKey()
Returns a new InputStream to the private key.
|
Region |
getRegion()
Returns the region.
|
ExecutorService |
getScheduler()
Returns the token refresh scheduler.
|
String |
getSessionToken() |
String |
getTenantId()
Returns the tenant OCID.
|
String |
getUserId()
Returns the user OCID.
|
String |
refresh()
Refreshes the session token from the file defined in the OCI config file.
|
boolean |
refreshSessionToken()
Makes a call to the Identity service to refresh the session token.
|
void |
setSessionToken(String sessionToken)
Sets the session token directly from a string.
|
void |
setSessionTokenFromFilePath(String sessionTokenFilePath)
Loads the session token from the file specified in the file path.
|
String |
toString() |
public SessionTokenAuthenticationDetailsProvider() throws IOException
Creates a new instance using the config file at the default location and the default profile.
See ConfigFileReader.DEFAULT_FILE_PATH
.
IOException
- if the configuration file could not be loadedpublic SessionTokenAuthenticationDetailsProvider(String profile) throws IOException
Creates a new instance using the config file at the default location, see ConfigFileReader.DEFAULT_FILE_PATH
.
profile
- profile to load, optionalIOException
- if the configuration file could not be loadedpublic SessionTokenAuthenticationDetailsProvider(String configurationFilePath, String profile) throws IOException
Creates a new instance.
configurationFilePath
- path to the OCI configuration fileprofile
- profile to load, optionalIOException
- if the configuration file could not be loadedprotected 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) throws IOException
IOException
public SessionTokenAuthenticationDetailsProvider(ConfigFileReader.ConfigFile configFile) throws IOException
Creates a new instance.
configFile
- The configuration file to use.IOException
- if the configuration file could not be loadedpublic void setSessionToken(String sessionToken)
Sets the session token directly from a string.
sessionToken
- The session token to use.public String getSessionToken()
public ExecutorService getScheduler()
Returns the token refresh scheduler.
public void close()
Stops the token refresh scheduler.
public void setSessionTokenFromFilePath(String sessionTokenFilePath) throws IOException
Loads the session token from the file specified in the file path.
sessionTokenFilePath
- The file path to set the session token from.IOException
public String refresh()
Refreshes the session token from the file defined in the OCI config file.
refresh
in interface RefreshableOnNotAuthenticatedProvider<String>
public boolean refreshSessionToken()
Makes a call to the Identity service to refresh the session token.
public String getKeyId()
BasicAuthenticationDetailsProvider
Returns the keyId used to sign requests.
getKeyId
in interface BasicAuthenticationDetailsProvider
public InputStream getPrivateKey()
BasicAuthenticationDetailsProvider
Returns a new InputStream to the private key. This stream should be closed by the caller, implementations should return new streams each time.
getPrivateKey
in interface BasicAuthenticationDetailsProvider
@Deprecated public String getPassPhrase()
BasicAuthenticationDetailsProvider
Returns the optional pass phrase for the (encrypted) private key.
getPassPhrase
in interface BasicAuthenticationDetailsProvider
public char[] getPassphraseCharacters()
BasicAuthenticationDetailsProvider
Returns the optional pass phrase for the (encrypted) private key, as a character array.
getPassphraseCharacters
in interface BasicAuthenticationDetailsProvider
public String getFingerprint()
AuthenticationDetailsProvider
Returns the fingerprint of the key being used.
getFingerprint
in interface AuthenticationDetailsProvider
public String getTenantId()
AuthenticationDetailsProvider
Returns the tenant OCID.
getTenantId
in interface AuthenticationDetailsProvider
public String getUserId()
AuthenticationDetailsProvider
Returns the user OCID.
getUserId
in interface AuthenticationDetailsProvider
public Region getRegion()
RegionProvider
Returns the region.
getRegion
in interface RegionProvider
public static SessionTokenAuthenticationDetailsProvider.SessionTokenAuthenticationDetailsProviderBuilder builder()
Creates a new SessionTokenAuthenticationDetailsProviderBuilder.
Copyright © 2016–2024. All rights reserved.