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

public Class FileBasedResourcePrincipalFederationClient

extends Object
implements FederationClient, ProvidesConfigurableRefresh
Class Inheritance
All Implemented Interfaces
com.oracle.bmc.auth.ProvidesConfigurableRefresh, com.oracle.bmc.auth.internal.FederationClient
Imports
com.oracle.bmc.auth.ProvidesConfigurableRefresh, .SessionKeySupplier, com.oracle.bmc.util.StreamUtils, com.oracle.bmc.util.internal.Validate, java.io.File, .FileInputStream, .IOException, java.nio.charset.Charset, java.security.KeyPair, java.time.Duration, java.util.Optional, org.slf4j.Logger

This class gets a security token from file.

Field Summary

Modifier and TypeField and Description
private static final Logger
private final String
private volatile SecurityTokenAdapter
private final SessionKeySupplier

Constructor Summary

AccessConstructor and Description
public
FileBasedResourcePrincipalFederationClient(SessionKeySupplier
the session key supplier.
sessionKeySupplier
,
String
the path to load the RPST from
resourcePrincipalSessionTokenPath
)

Constructor of FileBasedResourcePrincipalFederationClient.

Method Summary

Modifier and TypeMethod and Description
public String
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
getSecurityTokenFromFile
()

Gets a security token from file

public String
getStringClaim(String key)

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

Get a claim embedded in the security token.

public String
refreshAndGetSecurityToken()

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

Gets a security token from the federation endpoint.

public String
refreshAndGetSecurityTokenIfExpiringWithin(Duration
the duration to check
time
,
boolean
boolean value to enable/disable refresh of keys
refreshKeys
)

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
refreshAndGetSecurityTokenIfExpiringWithin(Duration
the duration to check
time
)

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

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

private String
refreshAndGetSecurityTokenInner(final boolean doFinalTokenValidityCheck, Optional<Duration> time, boolean refreshKeys)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final Logger LOG
resourcePrincipalSessionTokenPathback to summary
private final String resourcePrincipalSessionTokenPath
securityTokenAdapterback to summary
private volatile SecurityTokenAdapter securityTokenAdapter
sessionKeySupplierback to summary
private final SessionKeySupplier sessionKeySupplier

Constructor Detail

FileBasedResourcePrincipalFederationClientback to summary
public FileBasedResourcePrincipalFederationClient(SessionKeySupplier sessionKeySupplier, String resourcePrincipalSessionTokenPath)

Constructor of FileBasedResourcePrincipalFederationClient.

Parameters
sessionKeySupplier:SessionKeySupplier

the session key supplier.

resourcePrincipalSessionTokenPath:String

the path to load the RPST from

Method Detail

getSecurityTokenback to summary
public String getSecurityToken()

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

Doc from 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
getSecurityTokenFromFileback to summary
protected SecurityTokenAdapter getSecurityTokenFromFile()

Gets a security token from file

Returns:SecurityTokenAdapter

the security token, which is basically a JWT token string

getStringClaimback to summary
public String getStringClaim(String key)

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

Doc from com.oracle.bmc.auth.internal.FederationClient.getStringClaim.

Get a claim embedded in the security token. May use the cached token if it is judged to still be valid.

Annotations
@Override
refreshAndGetSecurityTokenback to summary
public String refreshAndGetSecurityToken()

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

Doc from com.oracle.bmc.auth.internal.FederationClient.refreshAndGetSecurityToken.

Gets a security token from the federation endpoint. This will always retreive a new token from the federation endpoint and does not use a cached token.

Returns:String

A security token that can be used to authenticate requests.

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

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

Doc from 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)

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

Doc from 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
refreshAndGetSecurityTokenInnerback to summary
private String refreshAndGetSecurityTokenInner(final boolean doFinalTokenValidityCheck, Optional<Duration> time, boolean refreshKeys)