This adds new columns to the wh_user_dimension to provide additional
data from OIDC that does not apply to Password Auth.
Note: Given the specifics of the data, it is possible these columns may
be used by other auth methods in the future, hence the lack of `oidc` in
the column names.
The specific columns are:
- auth_method_external_id
For OIDC this is the Issuer
- auth_account_external_id
For OIDC this is the Subject
- auth_account_full_name
For OIDC this is the account's Full Name, and can be `None`.
- auth_account_email
For OIDC this is the account's Email, and can be `None`.
For all of these new columns, they will be `Not Applicable` if the auth
method is Password.
42 lines
1.9 KiB
PL/PgSQL
42 lines
1.9 KiB
PL/PgSQL
-- upsert tests that the wh_upsert_user function will do an update when
|
|
-- an existing source wh_user_dimension exists.
|
|
begin;
|
|
select plan(4);
|
|
|
|
select wtt_load('widgets', 'iam', 'kms', 'auth', 'hosts', 'targets');
|
|
|
|
-- ensure no existing dimensions
|
|
select is(count(*), 0::bigint) from wh_user_dimension;
|
|
|
|
insert into wh_user_dimension
|
|
(
|
|
id,
|
|
user_id, user_name, user_description,
|
|
auth_account_id, auth_account_type, auth_account_name, auth_account_description,
|
|
auth_account_external_id, auth_account_full_name, auth_account_email,
|
|
auth_method_id, auth_method_type, auth_method_name, auth_method_description,
|
|
auth_method_external_id,
|
|
user_organization_id, user_organization_name, user_organization_description,
|
|
current_row_indicator, row_effective_time, row_expiration_time
|
|
)
|
|
values
|
|
(
|
|
'wud_____1',
|
|
'u_____walter', 'Walter', 'This is Walter',
|
|
'apa___walter', 'password auth account', 'walter', 'Account for Walter',
|
|
'None', 'None', 'None',
|
|
'apm___widget', 'password auth method', 'Widget Auth Password', 'None',
|
|
'None',
|
|
'o_____widget', 'Widget Inc', 'None',
|
|
'Current', '2021-07-21T12:01'::timestamptz, 'infinity'::timestamptz
|
|
);
|
|
|
|
select lives_ok($$select wh_upsert_user('u_____walter', 'tok___walter')$$);
|
|
|
|
-- upsert should insert a user_dimension
|
|
select is(count(*), 2::bigint) from wh_user_dimension;
|
|
select is(count(*), 1::bigint) from wh_user_dimension where current_row_indicator = 'Current';
|
|
|
|
select * from finish();
|
|
rollback;
|