Module watts_session

this module handles one session.

Behaviours: gen_server.

Description

this module handles one session. One process exists per session and the running process keeps track of the timeout.

Data Types

session()

session() = #state{id = unknown | pid(), creation = integer(), type = undefined | type(), issuer_id = undefined | binary(), sess_token = undefined | binary(), user_agent = undefined | binary(), rsp = any(), ip = any(), error = any(), user_info = undefined | watts_userinfo:userinfo(), max_age = pos_integer(), killed = boolean(), redirection = any()}

type()

type() = oidc | rest | {rsp, Ui::ui | no_ui, Login::login | no_login}

Function Index

add_additional_login/3add an additional login to the session.
clear_additional_logins/2clear additional logins for the given service.
clear_redirection/1clear the redirection in the session.
close/1send a cast to stop the session.
code_change/3code change does nothing.
get_display_name/1get the display name of the user.
get_error/1get the error used for displaying login error messages at the UI.
get_id/1call the process to return the id.
get_iss_id/1get the Issuer id.
get_max_age/1get the max age of this session.
get_redirection/1get the redirection config.
get_rsp/1get the rsp data from the ssession.
get_sess_token/1get the session token by calling the process.
get_type/1get the session type.
get_user_info/1get the userinfo data from the session.
get_userid/1get the WaTTS userid.
handle_call/3implement the handle call to handle all the public function.
handle_cast/2handle cast reacts only to the stop cast.
handle_info/2handle the timeout.
init/1intialize the session with the given token.
is_logged_in/1check if the user in this session is logged in; web ui only.
is_same_ip/2check if the peer ip is the same as used before.
is_user_agent/2check if the user agent is the same as used before.
kill/1send a cast to kill the session.
set_error/2set an error to be displayed to the user.
set_iss_id/2set the issuer id.
set_iss_sub/3set issuer and subject.
set_max_age/2set the max age for this session.
set_redirection/4set the redirection for login, used for additional logins (also RSP).
set_rsp/2set the rsp data for the session.
set_token/2set an id token and update information.
set_type/2set the session type.
start_link/1start the session process with the token, linked.
terminate/2termination, just log a message and tell the manager.

Function Details

add_additional_login/3

add_additional_login(IssuerId::binary(), Token::map(), Pid::pid()) -> ok

add an additional login to the session

clear_additional_logins/2

clear_additional_logins(ServiceId::binary(), Pid::pid()) -> ok

clear additional logins for the given service

clear_redirection/1

clear_redirection(Pid::pid()) -> ok

clear the redirection in the session

close/1

close(Pid::pid()) -> ok

send a cast to stop the session

code_change/3

code_change(OldVsn::any(), State::session(), Extra::any()) -> {ok, session()}

code change does nothing

get_display_name/1

get_display_name(Pid::pid()) -> {ok, Name::binary()}

get the display name of the user

get_error/1

get_error(Pid::pid()) -> {ok, Error::binary()}

get the error used for displaying login error messages at the UI

get_id/1

get_id(Pid::pid() | undefined) -> {ok, ID::binary() | undefined}

call the process to return the id

get_iss_id/1

get_iss_id(Pid::pid()) -> {ok, IssId::binary()}

get the Issuer id

get_max_age/1

get_max_age(Pid::pid()) -> {ok, MaxAge::non_neg_integer()}

get the max age of this session

get_redirection/1

get_redirection(Pid::pid()) -> {ok, Redirection::map()}

get the redirection config

get_rsp/1

get_rsp(Pid::pid()) -> {ok, watts_rsp:rsp() | undefined}

get the rsp data from the ssession

get_sess_token/1

get_sess_token(Pid::pid()) -> {ok, Token::binary()}

get the session token by calling the process

get_type/1

get_type(Pid::pid()) -> {ok, type() | undefined}

get the session type

get_user_info/1

get_user_info(Pid::pid()) -> {ok, UserInfo::watts_userinfo:userinfo()}

get the userinfo data from the session

get_userid/1

get_userid(Pid::pid()) -> {ok, ID::binary()}

get the WaTTS userid

handle_call/3

handle_call(Request::any(), From::any(), State::session()) -> {reply, any(), session(), pos_integer()}

implement the handle call to handle all the public function

handle_cast/2

handle_cast(Msg::close | any(), State::session()) -> {stop, normal, session()} | {noreply, session(), pos_integer()}

handle cast reacts only to the stop cast

handle_info/2

handle_info(Info::timeout | any(), State::session()) -> {noreply, session(), pos_integer()}

handle the timeout

init/1

init(Token::binary()) -> {ok, session()}

intialize the session with the given token. Also setting the max age

is_logged_in/1

is_logged_in(Pid::pid()) -> true | false

check if the user in this session is logged in; web ui only

is_same_ip/2

is_same_ip(IP, Pid) -> any()

check if the peer ip is the same as used before

is_user_agent/2

is_user_agent(UserAgent, Pid) -> any()

check if the user agent is the same as used before

kill/1

kill(Pid::pid()) -> ok

send a cast to kill the session

set_error/2

set_error(Error::binary(), Pid::pid()) -> ok

set an error to be displayed to the user

set_iss_id/2

set_iss_id(IssuerId::binary(), Pid::pid()) -> ok

set the issuer id

set_iss_sub/3

set_iss_sub(Issuer::binary(), Subject::binary(), Pid::pid()) -> ok

set issuer and subject

set_max_age/2

set_max_age(MaxAge::pos_integer(), Pid::pid()) -> ok

set the max age for this session

set_redirection/4

set_redirection(ServiceId::binary(), Params::map(), ProviderId::binary(), Pid::pid()) -> ok

set the redirection for login, used for additional logins (also RSP)

set_rsp/2

set_rsp(Client::watts_rsp:rsp(), Pid::pid()) -> ok

set the rsp data for the session

set_token/2

set_token(Token::map(), Pid::pid()) -> ok

set an id token and update information

set_type/2

set_type(Type::type(), Pid::pid()) -> ok

set the session type

start_link/1

start_link(Token::binary()) -> {ok, pid()}

start the session process with the token, linked

terminate/2

terminate(Reason::any(), State::session()) -> ok

termination, just log a message and tell the manager


Generated by EDoc