This change adds a credential type attribute to credential library and allows it to be set when creating a credential library. Specifying the type of credential returned from a library allows for new features and additional error checking to be added over time. A User Password credential type and an Unspecified credential type are included with the expectation that additional credential types will be added in the future. This change also adds the credential type attribute to existing credential libraries and sets it to Unspecified. Known Limitations: - Credential type is only supported on the repository create method. Support for the other CRUD methods will be added in the future.
40 lines
1.8 KiB
PL/PgSQL
40 lines
1.8 KiB
PL/PgSQL
-- credential_vault_library tests:
|
|
-- the following triggers
|
|
-- insert_credential_library_subtype
|
|
-- delete_credential_library_subtype
|
|
|
|
begin;
|
|
select plan(10);
|
|
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets', 'credentials');
|
|
|
|
-- validate the setup data
|
|
select is(count(*), 1::bigint) from credential_vault_library where public_id = 'vl______wvl1' and credential_type = 'unspecified';
|
|
select is(count(*), 1::bigint) from credential_library where public_id = 'vl______wvl1' and credential_type = 'unspecified';
|
|
|
|
select is(count(*), 1::bigint) from credential_vault_library where public_id = 'vl______wvl3' and credential_type = 'user_password';
|
|
select is(count(*), 1::bigint) from credential_library where public_id = 'vl______wvl3' and credential_type = 'user_password';
|
|
|
|
-- validate the insert triggers
|
|
prepare insert_vault_library as
|
|
insert into credential_vault_library
|
|
(store_id, public_id, vault_path, http_method, credential_type)
|
|
values
|
|
('vs_______wvs', 'vl_______tt1', '/secrets/kv', 'GET', 'user_password');
|
|
select lives_ok('insert_vault_library');
|
|
|
|
select is(count(*), 1::bigint) from credential_vault_library where public_id = 'vl_______tt1' and credential_type = 'user_password';
|
|
select is(count(*), 1::bigint) from credential_library where public_id = 'vl_______tt1' and credential_type = 'user_password';
|
|
|
|
-- validate the delete triggers
|
|
prepare delete_vault_library as
|
|
delete
|
|
from credential_vault_library
|
|
where public_id = 'vl_______tt1';
|
|
select lives_ok('delete_vault_library');
|
|
|
|
select is(count(*), 0::bigint) from credential_vault_library where public_id = 'vl_______tt1';
|
|
select is(count(*), 0::bigint) from credential_library where public_id = 'vl_______tt1';
|
|
|
|
select * from finish();
|
|
rollback;
|