feat(cmd): Support Vault LDAP Credential Library
This commit is contained in:
1 parent
84dd5543cf
commit
9652ebe032
7 files changed
+471
-2
No files matched your search
@@ -18,6 +18,17 @@ function create_vault_generic_library() {
|
||||
create vault-generic $@
|
||||
}
|
||||
|
||||
function create_vault_ldap_library() {
|
||||
boundary credential-libraries \
|
||||
create vault-ldap $@
|
||||
}
|
||||
|
||||
function update_vault_ldap_library() {
|
||||
boundary credential-libraries \
|
||||
update vault-ldap $@
|
||||
}
|
||||
|
||||
|
||||
function create_vault_library() {
|
||||
boundary credential-libraries \
|
||||
create vault $@
|
||||
|
||||
@@ -52,7 +52,7 @@ export NEW_VAULT_LIB="test_vault"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/credential-libraries: can not create already created $NEW_VAULT_LIB vault-generic libary" {
|
||||
@test "boundary/credential-libraries: can not create already created $NEW_VAULT_LIB vault-generic library" {
|
||||
skip_if_no_vault
|
||||
|
||||
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
|
||||
@@ -106,7 +106,7 @@ export NEW_VAULT_LIB="test_vault"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/credential-libraries: can not create already created $NEW_VAULT_LIB vault-ssh-certificate libary" {
|
||||
@test "boundary/credential-libraries: can not create already created $NEW_VAULT_LIB vault-ssh-certificate library" {
|
||||
skip_if_no_vault
|
||||
|
||||
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
|
||||
@@ -587,6 +587,69 @@ export NEW_VAULT_LIB="test_vault"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/credential-libraries: can create $NEW_VAULT_LIB vault-ldap library in credential store $NEW_STORE" {
|
||||
skip_if_no_vault
|
||||
|
||||
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
|
||||
run create_vault_ldap_library \
|
||||
-name $NEW_VAULT_LIB -credential-store-id $csid \
|
||||
-vault-path /ldap/static-cred/einstein \
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
|
||||
@test "boundary/credential-libraries: can not create already created $NEW_VAULT_LIB vault-ldap library" {
|
||||
skip_if_no_vault
|
||||
|
||||
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
|
||||
run create_vault_ldap_library \
|
||||
-name $NEW_VAULT_LIB -credential-store-id $csid \
|
||||
-vault-path /ldap/static-cred/einstein \
|
||||
echo "$output"
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "boundary/credential-libraries: can update $NEW_VAULT_LIB vault-ldap library description" {
|
||||
skip_if_no_vault
|
||||
|
||||
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
|
||||
local clid=$(credential_library_id $NEW_VAULT_LIB $csid)
|
||||
run update_vault_ldap_library -id $clid -description hellothere
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
|
||||
run read_credential_library $clid
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
got=$(echo "$output")
|
||||
|
||||
run field_eq "$got" ".item.attributes.description" "null"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/credential-libraries: can read $NEW_VAULT_LIB vault-ldap library" {
|
||||
skip_if_no_vault
|
||||
|
||||
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
|
||||
local clid=$(credential_library_id $NEW_VAULT_LIB $csid)
|
||||
run read_credential_library $clid
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "boundary/credential-libraries: can delete $NEW_VAULT_LIB vault-ldaplibrary" {
|
||||
skip_if_no_vault
|
||||
|
||||
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
|
||||
local clid=$(credential_library_id $NEW_VAULT_LIB $csid)
|
||||
run delete_credential_library $clid
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
run has_status_code "$output" "204"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
# Note, deleting the cred store will revoke the vault token
|
||||
@test "boundary/credential-stores: cleanup can delete $NEW_STORE vault store" {
|
||||
skip_if_no_vault
|
||||
|
||||
Reference in new issue
Block a user