public class SessionTokenAuthenticationDetailsProvider extends Object implements AuthenticationDetailsProvider, RegionProvider, RefreshableOnNotAuthenticatedProvider<String>
Implementation of AuthenticationDetailsProvider
that uses a session token for
authentication.
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 . |
SessionTokenAuthenticationDetailsProvider(String configurationFilePath,
String profile)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
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.
|
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 loadedpublic 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 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 void setSessionToken(String sessionToken)
Sets the session token directly from a string.
sessionToken
- The session token to use.public String refresh()
Refreshes the session token from the file defined in the OCI config file.
refresh
in interface RefreshableOnNotAuthenticatedProvider<String>
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
Copyright © 2016–2023. All rights reserved.