Class StoreAccessTokenProvider
- All Implemented Interfaces:
AuthorizationProvider
StoreAccessTokenProvider is an AuthorizationProvider
that performs
the following functions:
- Initial (bootstrap) login to store, using credentials provided
- Storage of bootstrap login token for re-use
- Optionally renews the login token before it expires
- Logs out of the store when closed
If accessing an insecure instance of Oracle NoSQL Database the default constructor is used, with no arguments.
If accessing a secure instance of Oracle NoSQL Database a user name and password must be provided. That user must already exist in the NoSQL Database and have sufficient permission to perform table operations. That user's identity is used to authorize all database operations.
-
Constructor Summary
ConstructorDescriptionThis method is used for access to a store without security enabled.StoreAccessTokenProvider
(String userName, char[] password) This constructor is used when accessing a secure store. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the provider, releasing resources such as a stored login token.Returns the endpoint of the authenticating entityReturns the logger, or null if not set.boolean
Returns whether the login token is to be automatically renewed.boolean
isSecure()
Returns whether the provider is accessing a secured storesetAutoRenew
(boolean autoRenew) Sets the auto-renew state.setEndpoint
(String endpoint) Sets the endpoint of the authenticating entitySets a Logger instance for this provider.setSslContext
(io.netty.handler.ssl.SslContext sslCtx) Sets the SSL contextsetSslHandshakeTimeout
(int timeoutMs) Sets the SSL handshake timeout in millisecondsMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface oracle.nosql.driver.AuthorizationProvider
flushCache, forCloud, setRequiredHeaders
-
Constructor Details
-
StoreAccessTokenProvider
public StoreAccessTokenProvider()This method is used for access to a store without security enabled. -
StoreAccessTokenProvider
This constructor is used when accessing a secure store.This constructor requires a valid user name and password to access the target store. The user must exist and have sufficient permission to perform table operations required by the application. The user identity is used to authorize all operations performed by the application.
- Parameters:
userName
- the user name to use for the store. This user must exist in the NoSQL Database and is the identity that is used for authorizing all database operations.password
- the password for the user.- Throws:
IllegalArgumentException
- if one or more of the parameters is malformed or a required parameter is missing.
-
-
Method Details
-
close
public void close()Closes the provider, releasing resources such as a stored login token.- Specified by:
close
in interfaceAuthorizationProvider
-
getLogger
Returns the logger, or null if not set.- Returns:
- the logger
-
setLogger
Sets a Logger instance for this provider.- Parameters:
logger
- the logger- Returns:
- this
-
getEndpoint
Returns the endpoint of the authenticating entity- Returns:
- the endpoint
-
setEndpoint
Sets the endpoint of the authenticating entity- Parameters:
endpoint
- the endpoint- Returns:
- this
- Throws:
IllegalArgumentException
- if the endpoint is not correctly formatted
-
setSslContext
Sets the SSL context- Parameters:
sslCtx
- the context- Returns:
- this
-
setSslHandshakeTimeout
Sets the SSL handshake timeout in milliseconds- Parameters:
timeoutMs
- the timeout in milliseconds- Returns:
- this
-
isSecure
public boolean isSecure()Returns whether the provider is accessing a secured store- Returns:
- true if accessing a secure store
-
isAutoRenew
public boolean isAutoRenew()Returns whether the login token is to be automatically renewed.- Returns:
- true if auto-renew is set
-
setAutoRenew
Sets the auto-renew state. If true, automatic renewal of the login token is enabled.- Parameters:
autoRenew
- set to true to enable auto-renew- Returns:
- this
-