public class BrowserIdcAuthPlugin extends CommonCredentialsProvider
| Modifier and Type | Field and Description |
|---|---|
int |
DEFAULT_IDC_TOKEN_EXPIRY_IN_SEC |
protected static Pattern |
IAM_HTTP_URL_PATTERN |
protected static Pattern |
IAM_URL_PATTERN |
protected static String |
KEY_SSL_INSECURE |
protected RedshiftLogger |
m_log |
protected AWSSSOOIDC |
m_sdk_client |
protected boolean |
m_sslInsecure |
int |
REQUEST_CREATE_TOKEN_DEFAULT_INTERVAL
The default time in seconds for which the client must wait between attempts when polling for a session
It is used if auth server doesn't provide any value for
interval in start device authorization response |
m_disableCache| Constructor and Description |
|---|
BrowserIdcAuthPlugin() |
BrowserIdcAuthPlugin(AWSSSOOIDC client) |
| Modifier and Type | Method and Description |
|---|---|
void |
addParameter(String key,
String value)
Overridden method to grab the field parameters from JDBC connection string or extended params provided by user.
|
protected CreateTokenResult |
fetchTokenResult(RegisterClientResult registerClientResult,
StartDeviceAuthorizationResult startDeviceAuthorizationResult,
String grantType,
String scope) |
protected NativeTokenHolder |
getAuthToken()
Overridden method to obtain the auth token from plugin specific implementation
|
protected CreateTokenResult |
getCreateTokenResult(String clientId,
String clientSecret,
String deviceCode,
String grantType,
String... scope)
Creates and returns an access token for the authorized client.
|
protected CloseableHttpClient |
getHttpClient() |
protected NativeTokenHolder |
getIdcToken()
Plugin implementation method to grab the IdC token from AWS IAM Identity Center.
|
String |
getPluginSpecificCacheKey() |
protected static String |
getRegexForJsonKey(String keyName) |
protected RegisterClientResult |
getRegisterClientResult(String clientName,
String clientType)
Registers a client with IAM Identity Center.
|
protected StartDeviceAuthorizationResult |
getStartDeviceAuthorizationResult(String clientId,
String clientSecret,
String startUrl)
Initiates device authorization by requesting a pair of verification codes from the IAM Identity Center
|
protected void |
openBrowser(String verificationUri) |
protected NativeTokenHolder |
processCreateTokenResult(CreateTokenResult createTokenResult) |
protected void |
validateURL(String paramString) |
getCacheKey, getCredentials, getIdpToken, refresh, setLoggerpublic final int REQUEST_CREATE_TOKEN_DEFAULT_INTERVAL
interval in start device authorization responsepublic final int DEFAULT_IDC_TOKEN_EXPIRY_IN_SEC
protected AWSSSOOIDC m_sdk_client
protected static final String KEY_SSL_INSECURE
protected boolean m_sslInsecure
protected static final Pattern IAM_URL_PATTERN
protected static final Pattern IAM_HTTP_URL_PATTERN
protected RedshiftLogger m_log
public BrowserIdcAuthPlugin()
public BrowserIdcAuthPlugin(AWSSSOOIDC client)
public void addParameter(String key, String value)
addParameter in interface INativePluginaddParameter in class CommonCredentialsProviderkey - parameter key passed to JDBC drivervalue - parameter value associated with the given keypublic String getPluginSpecificCacheKey()
getPluginSpecificCacheKey in interface INativePlugingetPluginSpecificCacheKey in class CommonCredentialsProviderprotected NativeTokenHolder getAuthToken() throws IOException
getAuthToken in class CommonCredentialsProviderNativeTokenHolder A wrapper containing auth token and its expiration time informationIOException - indicating the errorprotected NativeTokenHolder getIdcToken() throws IOException
NativeTokenHolder A wrapper containing IdC token and its expiration time informationIOException - indicating the errorprotected RegisterClientResult getRegisterClientResult(String clientName, String clientType) throws IOException
clientName - The friendly name of the clientclientType - The type of client. The service supports only public as a client typeRegisterClientResult Client registration result containing clientId and clientSecret required for device authorizationIOException - if an error occurs during the involved API callprotected StartDeviceAuthorizationResult getStartDeviceAuthorizationResult(String clientId, String clientSecret, String startUrl) throws IOException
clientId - The unique identifier string for the client that is registered with IAM Identity Center.clientSecret - A secret string that is generated for the client.startUrl - The URL for the AWS access portalStartDeviceAuthorizationResult Device Authorization result containing deviceCode for creating tokenIOException - if an error occurs during the involved API callprotected void openBrowser(String verificationUri) throws IOException
IOExceptionprotected CreateTokenResult getCreateTokenResult(String clientId, String clientSecret, String deviceCode, String grantType, String... scope)
clientId - The unique identifier string for each clientclientSecret - A secret string generated for the clientdeviceCode - Used only when calling this API for the device code grant type. This short-term code is used to identify this authentication attemptgrantType - Supports grant types for the device code requestscope - The list of scopes that is defined by the client. Upon authorization, this list is used to restrict permissions when granting an access tokenCreateTokenResult Create token result containing IdC tokenprotected CreateTokenResult fetchTokenResult(RegisterClientResult registerClientResult,
StartDeviceAuthorizationResult startDeviceAuthorizationResult,
String grantType,
String scope)
throws IOException
IOExceptionprotected NativeTokenHolder processCreateTokenResult(CreateTokenResult createTokenResult) throws IOException
IOExceptionprotected CloseableHttpClient getHttpClient()
throws GeneralSecurityException
GeneralSecurityExceptionprotected void validateURL(String paramString) throws IOException
IOExceptionCopyright © 2023 Amazon.com Inc.. All rights reserved.