Class StoreAccessTokenProvider
- java.lang.Object
-
- oracle.nosql.driver.kv.StoreAccessTokenProvider
-
- All Implemented Interfaces:
AuthorizationProvider
public class StoreAccessTokenProvider extends Object implements AuthorizationProvider
On-premises only.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
Constructors Constructor Description StoreAccessTokenProvider()
This 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the provider, releasing resources such as a stored login token.String
getEndpoint()
Logger
getLogger()
Returns the logger, or null if not set.boolean
isAutoRenew()
Returns whether the login token is to be automatically renewed.boolean
isSecure()
Returns whether the provider is accessing a secured storeStoreAccessTokenProvider
setAutoRenew(boolean autoRenew)
Sets the auto-renew state.StoreAccessTokenProvider
setEndpoint(String endpoint)
StoreAccessTokenProvider
setLogger(Logger logger)
Sets a Logger instance for this provider.StoreAccessTokenProvider
setSslContext(io.netty.handler.ssl.SslContext sslCtx)
StoreAccessTokenProvider
setSslHandshakeTimeout(int timeout)
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface oracle.nosql.driver.AuthorizationProvider
flushCache, setRequiredHeaders
-
-
-
-
Constructor Detail
-
StoreAccessTokenProvider
public StoreAccessTokenProvider()
This method is used for access to a store without security enabled.
-
StoreAccessTokenProvider
public StoreAccessTokenProvider(String userName, char[] password)
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 Detail
-
close
public void close()
Closes the provider, releasing resources such as a stored login token.- Specified by:
close
in interfaceAuthorizationProvider
-
getLogger
public Logger getLogger()
Returns the logger, or null if not set.- Returns:
- the logger
-
setLogger
public StoreAccessTokenProvider setLogger(Logger logger)
Sets a Logger instance for this provider.- Parameters:
logger
- the logger- Returns:
- this
-
getEndpoint
public String getEndpoint()
-
setEndpoint
public StoreAccessTokenProvider setEndpoint(String endpoint)
-
setSslContext
public StoreAccessTokenProvider setSslContext(io.netty.handler.ssl.SslContext sslCtx)
-
setSslHandshakeTimeout
public StoreAccessTokenProvider setSslHandshakeTimeout(int timeout)
-
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
public StoreAccessTokenProvider setAutoRenew(boolean autoRenew)
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
-
-