Module watts_userinfo

This module implements the userinfo data structure and the functions to access it.

Description

This module implements the userinfo data structure and the functions to access it

Data Types

additional_login()

additional_login() = {{ServiceId::binary(), IssuerId::binary()}, UserInfo::userinfo()}

userinfo()

userinfo() = #user_info{issuer = undefined | binary(), subject = undefined | binary(), id_token = map(), id_info = map(), access_token = map(), plugin_info = map(), token_info = map(), additional_logins = [additional_login()], scope = map()}

Function Index

access_token/1*return the access token, if present.
add_additional_login/4add an additional login.
clear_additional_logins/2delete all additional logins for a service.
display_name/1*generate the display name.
has_additional_login/3check if an additional login for the service and issuer exists.
logged_in/1*return if the user is logged in.
maybe_to_atom/1*convert a binary to atom, if the atom exists.
new/0create a new userinfo structure (record).
return/2generic function to return needed information.
set_scope_if_empty/1*set an empty scope if no scope is set.
update_access_token/2update the access token in the userinfo, if it is valid.
update_id_info/2update subject from the Userinfo Endpoint, if matching the userinfo.
update_id_token/2claims and iss/sub coming from an Id Token.
update_iss_sub/3update issuer and subject of the userinfo, if valid.
update_plugin_info/1*update the prepared information for the plugin about the user.
update_scope/2*set the scope in the userinfo.
update_token_info/2update subject from the Tokeninfo Endpoint and set scopes.
update_with_token/2update the structure with the information from the Token.
userid/1*generate the userid.

Function Details

access_token/1 *

access_token(UserInfo::userinfo()) -> {ok, AccessToken::binary} | {error, Reason::atom()}

return the access token, if present

add_additional_login/4

add_additional_login(ServiceId::binary(), IssuerId::binary(), Token::map(), UserInfo::userinfo()) -> UpdatedInfo::userinfo()

add an additional login

clear_additional_logins/2

clear_additional_logins(ServiceId::binary(), UserInfo::userinfo()) -> UpdatedInfo::userinfo()

delete all additional logins for a service

display_name/1 *

display_name(UserInfo::userinfo()) -> {ok, Name::binary} | {error, Reason::atom()}

generate the display name

has_additional_login/3

has_additional_login(ServiceId::binary(), IssuerId::binary(), UserInfo::userinfo()) -> boolean()

check if an additional login for the service and issuer exists.

logged_in/1 *

logged_in(UserInfo::userinfo()) -> boolean()

return if the user is logged in

maybe_to_atom/1 *

maybe_to_atom(Binary::binary()) -> atom() | binary()

convert a binary to atom, if the atom exists

new/0

new() -> {ok, userinfo()}

create a new userinfo structure (record).

return/2

return(Key::atom() | {key, Key::binary()} | {additional_logins, ServiceId::binary(), WithAccessToken::boolean()}, UserInfo::userinfo()) -> {ok, Data::any()} | {ok, Iss::binary(), Sub::binary()} | boolean() | {error, Reason::atom()}

generic function to return needed information. The returned values are:

set_scope_if_empty/1 *

set_scope_if_empty(UserInfo::userinfo()) -> UpdatedInfo::userinfo()

set an empty scope if no scope is set

update_access_token/2

update_access_token(TokenMap::map(), UserInfo::userinfo()) -> {ok, UpdatedInfo::userinfo()} | {error, Reason::atom()}

update the access token in the userinfo, if it is valid.

update_id_info/2

update_id_info(IdInfo::map(), UserInfo::userinfo()) -> {ok, UpdatedInfo::userinfo()} | {error, Reason::atom()}

update subject from the Userinfo Endpoint, if matching the userinfo.

update_id_token/2

update_id_token(IdToken::map(), Info::userinfo()) -> {ok, userinfo()} | {error, not_match}

claims and iss/sub coming from an Id Token

update_iss_sub/3

update_iss_sub(Issuer::binary() | undefined, Subject::binary() | undefined, UserInfo::userinfo()) -> {ok, UpdatedInfo::userinfo()} | {error, Reason::atom()}

update issuer and subject of the userinfo, if valid.

update_plugin_info/1 *

update_plugin_info(UserInfo::userinfo()) -> UpdatedInfo::userinfo()

update the prepared information for the plugin about the user.

update_scope/2 *

update_scope(Scope::map(), UserInfo::userinfo()) -> {ok, UpdatedInfo::userinfo()}

set the scope in the userinfo

update_token_info/2

update_token_info(TokenInfo::map(), UserInfo::userinfo()) -> {ok, UpdatedInfo::userinfo()} | {error, Reason::atom()}

update subject from the Tokeninfo Endpoint and set scopes.

update_with_token/2

update_with_token(Token::map(), UserInfo::userinfo()) -> {ok, UpdatedInfo::userinfo()}

update the structure with the information from the Token

userid/1 *

userid(UserInfo::userinfo()) -> {ok, Id::binary} | {error, Reason::atom()}

generate the userid


Generated by EDoc