public class HTTPVaultConnector extends Object implements VaultConnector
PATH_SECRET| Constructor and Description |
|---|
HTTPVaultConnector(String baseURL)
Create connector using full URL.
|
HTTPVaultConnector(String hostname,
boolean useTLS)
Create connector using hostname and schema.
|
HTTPVaultConnector(String hostname,
boolean useTLS,
Integer port)
Create connector using hostname, schema and port.
|
HTTPVaultConnector(String hostname,
boolean useTLS,
Integer port,
String prefix)
Create connector using hostname, schema, port and path.
|
HTTPVaultConnector(String hostname,
boolean useTLS,
Integer port,
String prefix,
SSLContext sslContext)
Create connector using hostname, schema, port, path and trusted certificate.
|
HTTPVaultConnector(String hostname,
boolean useTLS,
Integer port,
String prefix,
SSLContext sslContext,
int numberOfRetries,
Integer timeout)
Create connector using hostname, schema, port, path and trusted certificate.
|
HTTPVaultConnector(String baseURL,
SSLContext sslContext)
Create connector using full URL and trusted certificate.
|
HTTPVaultConnector(String baseURL,
SSLContext sslContext,
int numberOfRetries)
Create connector using full URL and trusted certificate.
|
HTTPVaultConnector(String baseURL,
SSLContext sslContext,
int numberOfRetries,
Integer timeout)
Create connector using full URL and trusted certificate.
|
| Modifier and Type | Method and Description |
|---|---|
AuthResponse |
authAppId(String appID,
String userID)
Deprecated.
|
AuthResponse |
authAppRole(String roleID,
String secretID)
Authorize to Vault using AppRole method.
|
TokenResponse |
authToken(String token)
Authorize to Vault using token.
|
AuthResponse |
authUserPass(String username,
String password)
Authorize to Vault using username and password.
|
void |
close() |
boolean |
createAppRole(AppRole role)
Register a new AppRole role from given metamodel.
|
AppRoleSecretResponse |
createAppRoleSecret(String roleName,
AppRoleSecret secret)
Register new AppRole secret with custom ID.
|
AuthResponse |
createToken(Token token)
Create a new token.
|
AuthResponse |
createToken(Token token,
boolean orphan)
Create a new token.
|
AuthResponse |
createToken(Token token,
String role)
Create a new token for specific role.
|
void |
delete(String key)
Delete key from Vault.
|
boolean |
deleteAppRole(String roleName)
Delete AppRole role from Vault.
|
boolean |
destroyAppRoleSecret(String roleName,
String secretID)
Destroy an AppRole secret.
|
String |
getAppRoleID(String roleName)
Retrieve ID for an AppRole role.
|
List<AuthBackend> |
getAuthBackends()
Get all availale authentication backends.
|
boolean |
isAuthorized()
Get authorization status.
|
List<String> |
list(String path)
List available nodes from Vault.
|
List<String> |
listAppRoles()
List existing (accessible) AppRole roles.
|
List<String> |
listAppRoleSecrets(String roleName)
List existing (accessible) secret IDs for AppRole role.
|
AppRoleResponse |
lookupAppRole(String roleName)
Lookup an AppRole role.
|
AppRoleSecretResponse |
lookupAppRoleSecret(String roleName,
String secretID)
Lookup an AppRole secret.
|
TokenResponse |
lookupToken(String token)
Lookup token information.
|
SecretResponse |
read(String key)
Retrieve any nodes content from Vault.
|
boolean |
registerAppId(String appID,
String policy,
String displayName)
Deprecated.
|
boolean |
registerUserId(String appID,
String userID)
Deprecated.
|
SecretResponse |
renew(String leaseID,
Integer increment)
Renew lease with given ID.
|
void |
resetAuth()
Reset authorization information.
|
void |
revoke(String leaseID)
Revoke given lease immediately.
|
boolean |
seal()
Seal vault.
|
SealResponse |
sealStatus()
Retrieve status of vault seal.
|
boolean |
setAppRoleID(String roleName,
String roleID)
Set custom ID for an AppRole role.
|
SealResponse |
unseal(String key,
Boolean reset)
Unseal vault.
|
void |
write(String key,
Map<String,Object> data)
Write value to Vault.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitauthAppRole, createAppRole, createAppRole, createAppRole, createAppRole, createAppRoleSecret, createAppRoleSecret, deleteSecret, listAppRoleSecretss, listSecrets, readDbCredentials, readMongoDbCredentials, readMsSqlCredentials, readMySqlCredentials, readPostgreSqlCredentials, readSecret, registerAppUserId, renew, unseal, write, writeSecret, writeSecretpublic HTTPVaultConnector(String hostname, boolean useTLS)
hostname - The hostnameuseTLS - If TRUE, use HTTPS, otherwise HTTPpublic HTTPVaultConnector(String hostname, boolean useTLS, Integer port)
hostname - The hostnameuseTLS - If TRUE, use HTTPS, otherwise HTTPport - The portpublic HTTPVaultConnector(String hostname, boolean useTLS, Integer port, String prefix)
hostname - The hostnameuseTLS - If TRUE, use HTTPS, otherwise HTTPport - The portprefix - HTTP API prefix (default: /v1/)public HTTPVaultConnector(String hostname, boolean useTLS, Integer port, String prefix, SSLContext sslContext)
hostname - The hostnameuseTLS - If TRUE, use HTTPS, otherwise HTTPport - The portprefix - HTTP API prefix (default: /v1/)sslContext - Custom SSL Contextpublic HTTPVaultConnector(String hostname, boolean useTLS, Integer port, String prefix, SSLContext sslContext, int numberOfRetries, Integer timeout)
hostname - The hostnameuseTLS - If TRUE, use HTTPS, otherwise HTTPport - The portprefix - HTTP API prefix (default: /v1/)sslContext - Custom SSL ContextnumberOfRetries - Number of retries on 5xx errorstimeout - Timeout for HTTP requests (milliseconds)public HTTPVaultConnector(String baseURL)
baseURL - The URLpublic HTTPVaultConnector(String baseURL, SSLContext sslContext)
baseURL - The URLsslContext - Custom SSL Contextpublic HTTPVaultConnector(String baseURL, SSLContext sslContext, int numberOfRetries)
baseURL - The URLsslContext - Custom SSL ContextnumberOfRetries - Number of retries on 5xx errorspublic HTTPVaultConnector(String baseURL, SSLContext sslContext, int numberOfRetries, Integer timeout)
baseURL - The URLsslContext - Custom SSL ContextnumberOfRetries - Number of retries on 5xx errorstimeout - Timeout for HTTP requests (milliseconds)public final void resetAuth()
VaultConnectorresetAuth in interface VaultConnectorpublic final SealResponse sealStatus()
VaultConnectorsealStatus in interface VaultConnectorpublic final boolean seal()
VaultConnectorseal in interface VaultConnectorpublic final SealResponse unseal(String key, Boolean reset)
VaultConnectorunseal in interface VaultConnectorkey - A single master share keyreset - Discard previously provided keys (optional)public final boolean isAuthorized()
VaultConnectorisAuthorized in interface VaultConnectorpublic final List<AuthBackend> getAuthBackends() throws VaultConnectorException
VaultConnectorgetAuthBackends in interface VaultConnectorVaultConnectorException - on errorpublic final TokenResponse authToken(String token) throws VaultConnectorException
VaultConnectorauthToken in interface VaultConnectortoken - The tokenVaultConnectorException - on errorpublic final AuthResponse authUserPass(String username, String password) throws VaultConnectorException
VaultConnectorauthUserPass in interface VaultConnectorusername - The usernamepassword - The passwordVaultConnectorException - on error@Deprecated public final AuthResponse authAppId(String appID, String userID) throws VaultConnectorException
VaultConnectorauthAppId in interface VaultConnectorappID - The App IDuserID - The User IDVaultConnectorException - on errorpublic final AuthResponse authAppRole(String roleID, String secretID) throws VaultConnectorException
VaultConnectorauthAppRole in interface VaultConnectorroleID - The role IDsecretID - The secret IDVaultConnectorException - on error@Deprecated public final boolean registerAppId(String appID, String policy, String displayName) throws VaultConnectorException
VaultConnectorregisterAppId in interface VaultConnectorappID - The unique App-IDpolicy - The policy to associate withdisplayName - Arbitrary name to displayVaultConnectorException - on error@Deprecated public final boolean registerUserId(String appID, String userID) throws VaultConnectorException
VaultConnectorregisterUserId in interface VaultConnectorappID - The App-IDuserID - The User-IDVaultConnectorException - on errorpublic final boolean createAppRole(AppRole role) throws VaultConnectorException
VaultConnectorcreateAppRole in interface VaultConnectorrole - The roleVaultConnectorException - on errorpublic final AppRoleResponse lookupAppRole(String roleName) throws VaultConnectorException
VaultConnectorlookupAppRole in interface VaultConnectorroleName - The role nameVaultConnectorException - on errorpublic final boolean deleteAppRole(String roleName) throws VaultConnectorException
VaultConnectordeleteAppRole in interface VaultConnectorroleName - The role anmeVaultConnectorException - on errorpublic final String getAppRoleID(String roleName) throws VaultConnectorException
VaultConnectorgetAppRoleID in interface VaultConnectorroleName - The role nameVaultConnectorException - on errorpublic final boolean setAppRoleID(String roleName, String roleID) throws VaultConnectorException
VaultConnectorsetAppRoleID in interface VaultConnectorroleName - The role nameroleID - The role IDVaultConnectorException - on errorpublic final AppRoleSecretResponse createAppRoleSecret(String roleName, AppRoleSecret secret) throws VaultConnectorException
VaultConnectorcreateAppRoleSecret in interface VaultConnectorroleName - The role namesecret - The secret meta objectVaultConnectorException - on errorpublic final AppRoleSecretResponse lookupAppRoleSecret(String roleName, String secretID) throws VaultConnectorException
VaultConnectorlookupAppRoleSecret in interface VaultConnectorroleName - The role namesecretID - The secret IDVaultConnectorException - on errorpublic final boolean destroyAppRoleSecret(String roleName, String secretID) throws VaultConnectorException
VaultConnectordestroyAppRoleSecret in interface VaultConnectorroleName - The role namesecretID - The secret meta objectVaultConnectorException - on errorpublic final List<String> listAppRoles() throws VaultConnectorException
VaultConnectorlistAppRoles in interface VaultConnectorVaultConnectorException - on errorpublic final List<String> listAppRoleSecrets(String roleName) throws VaultConnectorException
VaultConnectorlistAppRoleSecrets in interface VaultConnectorroleName - The role nameVaultConnectorException - on errorpublic final SecretResponse read(String key) throws VaultConnectorException
VaultConnectorread in interface VaultConnectorkey - Secret identifierVaultConnectorException - on errorpublic final List<String> list(String path) throws VaultConnectorException
VaultConnectorlist in interface VaultConnectorpath - Root path to searchVaultConnectorException - on errorpublic final void write(String key, Map<String,Object> data) throws VaultConnectorException
VaultConnectorwrite in interface VaultConnectorkey - Secret pathdata - Secret content. Value must be be JSON serializable.VaultConnectorException - on errorpublic final void delete(String key) throws VaultConnectorException
VaultConnectordelete in interface VaultConnectorkey - Secret pathVaultConnectorException - on errorpublic final void revoke(String leaseID) throws VaultConnectorException
VaultConnectorrevoke in interface VaultConnectorleaseID - the lease IDVaultConnectorException - on errorpublic final SecretResponse renew(String leaseID, Integer increment) throws VaultConnectorException
VaultConnectorrenew in interface VaultConnectorleaseID - the lase IDincrement - number of seconds to extend lease timeVaultConnectorException - on errorpublic final AuthResponse createToken(Token token) throws VaultConnectorException
VaultConnectorcreateToken in interface VaultConnectortoken - the tokenVaultConnectorException - on errorpublic final AuthResponse createToken(Token token, boolean orphan) throws VaultConnectorException
VaultConnectorcreateToken in interface VaultConnectortoken - the tokenorphan - create orphan tokenVaultConnectorException - on errorpublic final AuthResponse createToken(Token token, String role) throws VaultConnectorException
VaultConnectorcreateToken in interface VaultConnectortoken - the tokenrole - the role nameVaultConnectorException - on errorpublic final void close()
close in interface AutoCloseablepublic final TokenResponse lookupToken(String token) throws VaultConnectorException
VaultConnectorlookupToken in interface VaultConnectortoken - the tokenVaultConnectorException - on errorCopyright © 2016–2017. All rights reserved.