TD-502: Enable usage of user_id and party_id from token (#26)

* TD-502: Enable usage of user_id and party_id from token

* Fix tests
This commit is contained in:
ndiezel0 2023-01-27 11:13:52 +05:00 committed by GitHub
parent b408726bab
commit 2de9367561
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -111,15 +111,11 @@ get_subject_id(Context) ->
-spec get_user_id(processing_context()) -> binary(). -spec get_user_id(processing_context()) -> binary().
get_user_id(Context) -> get_user_id(Context) ->
%% TODO Replace when user ids finally stop being equal to party ids capi_auth:get_user_id(get_auth_context(Context)).
%% capi_auth:get_user_id(get_auth_context(Context)).
get_subject_id(Context).
-spec get_party_id(processing_context()) -> binary(). -spec get_party_id(processing_context()) -> binary().
get_party_id(Context) -> get_party_id(Context) ->
%% TODO Replace when user ids finally stop being equal to party ids capi_auth:get_party_id(get_auth_context(Context)).
%% capi_auth:get_party_id(get_auth_context(Context)).
get_subject_id(Context).
%% Utils %% Utils

View File

@ -173,13 +173,15 @@ combine_metadata(#{} = FullMetadata) ->
user_session_metadata() -> user_session_metadata() ->
genlib_map:compact(#{ genlib_map:compact(#{
?TK_META_PARTY_ID => ?PARTY_ID,
?TK_META_USER_ID => ?USER_ID, ?TK_META_USER_ID => ?USER_ID,
?TK_META_USER_EMAIL => ?USER_EMAIL ?TK_META_USER_EMAIL => ?USER_EMAIL
}). }).
api_key_metadata() -> api_key_metadata() ->
genlib_map:compact(#{ genlib_map:compact(#{
?TK_META_PARTY_ID => ?PARTY_ID ?TK_META_PARTY_ID => ?PARTY_ID,
?TK_META_USER_ID => ?USER_ID
}). }).
consumer_metadata(Consumer) -> consumer_metadata(Consumer) ->