feat(cli): Add password credential CLI commands (#6117)

This commit is contained in:
Bharath Gajjala committed 2025-11-13 12:28:04 -08:00
1 parent 11c4fd7580
commit d4f7bd55d1
11 files changed
+676 -84

No files matched your search

@@ -63,6 +63,19 @@ function create_json_credential() {
$args
}
function create_password_credential() {
local name=$1
local sid=$2
local pass=$3
export BP="${pass}"
boundary credentials create password \
-name $name \
-description 'test password credential' \
-credential-store-id $sid \
-password env://BP
}
function read_credential() {
boundary credentials read -id $1 -format json
}
@@ -12,6 +12,7 @@ export NEW_UPD_AT_CREDENTIAL='test-at-user-domain-pass'
export NEW_UPD_SLASH_CREDENTIAL='test-slash-domain-user-pass'
export NEW_UPD_CREDENTIAL_DOMAIN='test-domain-user-plus-domain'
export NEW_JSON_CREDENTIAL='test-json'
export NEW_PASSWORD_CREDENTIAL='test-pass'
@test "boundary/login: can login as default user" {
run login $DEFAULT_LOGIN
@@ -68,6 +69,20 @@ export NEW_JSON_CREDENTIAL='test-json'
}
@test "boundary/credentials: can create $NEW_PASSWORD_CREDENTIAL credential in $NEW_STORE store" {
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
run create_password_credential $NEW_PASSWORD_CREDENTIAL $csid 'password'
echo "$output"
[ "$status" -eq 0 ]
}
@test "boundary/credentials: can not create already created $NEW_PASSWORD_CREDENTIAL credential" {
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
run create_password_credential $NEW_PASSWORD_CREDENTIAL $csid 'password'
echo "$output"
[ "$status" -eq 1 ]
}
@test "boundary/credentials: can create $NEW_JSON_CREDENTIAL credential in $NEW_STORE store" {
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
run create_json_credential $NEW_JSON_CREDENTIAL $csid '-string-kv username=admin -string-kv password=pass'
@@ -142,6 +157,14 @@ export NEW_JSON_CREDENTIAL='test-json'
[ "$status" -eq 0 ]
}
@test "boundary/credentials: can read $NEW_PASSWORD_CREDENTIAL credential" {
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
local cid=$(credential_id $NEW_PASSWORD_CREDENTIAL $csid)
run read_credential $cid
echo "$output"
[ "$status" -eq 0 ]
}
@test "boundary/credentials: can read $NEW_JSON_CREDENTIAL credential" {
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
local cid=$(credential_id $NEW_JSON_CREDENTIAL $csid)
@@ -186,6 +209,15 @@ export NEW_JSON_CREDENTIAL='test-json'
[ "$status" -eq 0 ]
}
@test "boundary/credentials: can delete $NEW_PASSWORD_CREDENTIAL credential" {
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
local cid=$(credential_id $NEW_PASSWORD_CREDENTIAL $csid)
run delete_credential $cid
echo "$output"
run has_status_code "$output" "204"
[ "$status" -eq 0 ]
}
@test "boundary/credentials: can delete $NEW_JSON_CREDENTIAL credential" {
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
local cid=$(credential_id $NEW_JSON_CREDENTIAL $csid)
@@ -255,6 +287,14 @@ export NEW_JSON_CREDENTIAL='test-json'
[ "$status" -eq 1 ]
}
@test "boundary/credential-stores: can not read deleted $NEW_PASSWORD_CREDENTIAL credential" {
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
local cid=$(credential_id $NEW_PASSWORD_CREDENTIAL $csid)
run read_credential $cid
echo "$output"
[ "$status" -eq 1 ]
}
@test "boundary/credential-stores: can delete $NEW_STORE static store" {
local csid=$(credential_store_id $NEW_STORE $DEFAULT_P_ID)
run delete_credential_store $csid