public class HTTPVaultConnector extends Object implements VaultConnector
| 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 baseURL,
SSLContext sslContext)
Create connector using full URL and trusted certificate.
|
| Modifier and Type | Method and Description |
|---|---|
AuthResponse |
authAppId(String appID,
String userID)
Authorize to Vault using AppID method.
|
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.
|
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.
|
boolean |
deleteAppRole(String roleName)
Delete AppRole role from Vault.
|
boolean |
deleteSecret(String key)
Delete secret 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 |
init()
Verify that vault connection is initialized.
|
boolean |
isAuthorized()
Get authorization status
|
List<String> |
listAppRoles()
List existing (accessible) AppRole roles.
|
List<String> |
listAppRoleSecretss(String roleName)
List existing (accessible) secret IDs for AppRole role.
|
List<String> |
listSecrets(String path)
List available secrets from Vault.
|
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 |
readSecret(String key)
Retrieve secret form Vault.
|
boolean |
registerAppId(String appID,
String policy,
String displayName)
Register new App-ID with policy.
|
boolean |
registerUserId(String appID,
String userID)
Register User-ID with App-ID
|
SecretResponse |
renew(String leaseID,
Integer increment)
Renew lease with given ID.
|
void |
resetAuth()
Reset authorization information.
|
boolean |
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.
|
boolean |
writeSecret(String key,
String value)
Write secret to Vault.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitauthAppRole, createAppRole, createAppRole, createAppRole, createAppRole, createAppRoleSecret, createAppRoleSecret, registerAppUserId, renew, unsealpublic 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 baseURL)
baseURL - The URLpublic HTTPVaultConnector(String baseURL, SSLContext sslContext)
baseURL - The URLpublic void resetAuth()
VaultConnectorresetAuth in interface VaultConnectorpublic SealResponse sealStatus()
VaultConnectorsealStatus in interface VaultConnectorpublic boolean seal()
VaultConnectorseal in interface VaultConnectorpublic SealResponse unseal(String key, Boolean reset)
VaultConnectorunseal in interface VaultConnectorkey - A single master share keyreset - Discard previously provided keys (optional)public boolean isAuthorized()
VaultConnectorisAuthorized in interface VaultConnectorpublic boolean init()
VaultConnectorinit in interface VaultConnectorpublic List<AuthBackend> getAuthBackends() throws VaultConnectorException
VaultConnectorgetAuthBackends in interface VaultConnectorVaultConnectorException - on errorpublic TokenResponse authToken(String token) throws VaultConnectorException
VaultConnectorauthToken in interface VaultConnectortoken - The tokenVaultConnectorException - on errorpublic AuthResponse authUserPass(String username, String password) throws VaultConnectorException
VaultConnectorauthUserPass in interface VaultConnectorusername - The usernamepassword - The passwordVaultConnectorException - on errorpublic AuthResponse authAppId(String appID, String userID) throws VaultConnectorException
VaultConnectorauthAppId in interface VaultConnectorappID - The App IDuserID - The User IDVaultConnectorException - on errorpublic AuthResponse authAppRole(String roleID, String secretID) throws VaultConnectorException
VaultConnectorauthAppRole in interface VaultConnectorroleID - The role IDsecretID - The secret IDVaultConnectorException - on errorpublic 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 errorpublic boolean registerUserId(String appID, String userID) throws VaultConnectorException
VaultConnectorregisterUserId in interface VaultConnectorappID - The App-IDuserID - The User-IDVaultConnectorException - on errorpublic boolean createAppRole(AppRole role) throws VaultConnectorException
VaultConnectorcreateAppRole in interface VaultConnectorrole - The roleVaultConnectorException - on errorpublic AppRoleResponse lookupAppRole(String roleName) throws VaultConnectorException
VaultConnectorlookupAppRole in interface VaultConnectorroleName - The role nameVaultConnectorException - on errorpublic boolean deleteAppRole(String roleName) throws VaultConnectorException
VaultConnectordeleteAppRole in interface VaultConnectorroleName - The role anmeVaultConnectorException - on errorpublic String getAppRoleID(String roleName) throws VaultConnectorException
VaultConnectorgetAppRoleID in interface VaultConnectorroleName - The role nameVaultConnectorException - on errorpublic boolean setAppRoleID(String roleName, String roleID) throws VaultConnectorException
VaultConnectorsetAppRoleID in interface VaultConnectorroleName - The role nameroleID - The role IDVaultConnectorException - on errorpublic AppRoleSecretResponse createAppRoleSecret(String roleName, AppRoleSecret secret) throws VaultConnectorException
VaultConnectorcreateAppRoleSecret in interface VaultConnectorroleName - The role namesecret - The secret meta objectVaultConnectorException - on errorpublic AppRoleSecretResponse lookupAppRoleSecret(String roleName, String secretID) throws VaultConnectorException
VaultConnectorlookupAppRoleSecret in interface VaultConnectorroleName - The role namesecretID - The secret IDVaultConnectorException - on errorpublic boolean destroyAppRoleSecret(String roleName, String secretID) throws VaultConnectorException
VaultConnectordestroyAppRoleSecret in interface VaultConnectorroleName - The role namesecretID - The secret meta objectVaultConnectorException - on errorpublic List<String> listAppRoles() throws VaultConnectorException
VaultConnectorlistAppRoles in interface VaultConnectorVaultConnectorException - on errorpublic List<String> listAppRoleSecretss(String roleName) throws VaultConnectorException
VaultConnectorlistAppRoleSecretss in interface VaultConnectorroleName - The role nameVaultConnectorException - on errorpublic SecretResponse readSecret(String key) throws VaultConnectorException
VaultConnectorreadSecret in interface VaultConnectorkey - Secret identifierVaultConnectorException - on errorpublic List<String> listSecrets(String path) throws VaultConnectorException
VaultConnectorlistSecrets in interface VaultConnectorpath - Root path to searchVaultConnectorException - on errorpublic boolean writeSecret(String key, String value) throws VaultConnectorException
VaultConnectorwriteSecret in interface VaultConnectorkey - Secret pathvalue - Secret valueVaultConnectorException - on errorpublic boolean deleteSecret(String key) throws VaultConnectorException
VaultConnectordeleteSecret in interface VaultConnectorkey - Secret pathVaultConnectorException - on errorpublic boolean revoke(String leaseID) throws VaultConnectorException
VaultConnectorrevoke in interface VaultConnectorleaseID - the lease IDVaultConnectorException - on errorpublic SecretResponse renew(String leaseID, Integer increment) throws VaultConnectorException
VaultConnectorrenew in interface VaultConnectorleaseID - the lase IDincrement - number of seconds to extend lease timeVaultConnectorExceptionpublic AuthResponse createToken(Token token) throws VaultConnectorException
VaultConnectorcreateToken in interface VaultConnectortoken - the tokenVaultConnectorException - on errorpublic AuthResponse createToken(Token token, boolean orphan) throws VaultConnectorException
VaultConnectorcreateToken in interface VaultConnectortoken - the tokenorphan - create orphan tokenVaultConnectorException - on errorpublic AuthResponse createToken(Token token, String role) throws VaultConnectorException
VaultConnectorcreateToken in interface VaultConnectortoken - the tokenrole - the role nameVaultConnectorException - on errorpublic TokenResponse lookupToken(String token) throws VaultConnectorException
VaultConnectorlookupToken in interface VaultConnectortoken - the tokenVaultConnectorException - on errorCopyright © 2016. All rights reserved.