Behaviours: gen_server.
See also: watts_temp_cred_data.
this is the management module for the temporary plugin result data storage. The results (credentials or oidc_login request) are only stored in RAM and each in a separate process.
This module is running as a registered process so it can be reached without knowing its process id. It sets up the API to store and retrieve results.cred_record() = {Id::binary(), UserId::binary(), DataPid::pid(), MRef::reference()}
state() = #state{creds = [cred_record()]}
API.
add_cred/2 | add a credential, this creates a new temp_cred_data process. |
add_credential/3* | store a new credential, ensure to have a unique id. |
code_change/3 | code_change implementation, does nothing. |
credential_exists/3* | check if a credential for the user exists. |
exists/2 | check if a Credential of id exists for given user. |
gen_random_id/1* | generate a random unique credential id. |
get_all_creds/0 | DO NOT USE! |
get_cred/2 | retrieve the data if the userid is the same. |
get_cred_pid/3* | get the pid of the data process. |
get_credential/3* | get a crecential for a user. |
handle_call/3 | handle the gen_server:call. |
handle_cast/2 | only support the stop cast. |
handle_info/2 | only support the Down info for a data process. |
init/1 | initialize the gen_server with an empty state. |
start_link/0 | start the gen_server linked. |
stop/0 | stop the process. |
terminate/2 | implementation of terminate, does nothing. |
add_cred(Credential::watts:temp_cred(), UserId::binary()) -> {ok, Id::binary()}
add a credential, this creates a new temp_cred_data process.
add_credential(Credential::watts:temp_cred(), UserId::binary(), State::state()) -> {ok, CredentialId::binary(), NewState::state()}
store a new credential, ensure to have a unique id.
code_change implementation, does nothing
credential_exists(CredentiaId::binary(), UserId::binary(), State::state()) -> boolean()
check if a credential for the user exists
exists(CredId::binary(), UserId::binary()) -> boolean()
check if a Credential of id exists for given user.
gen_random_id(State::state()) -> binary()
generate a random unique credential id
get_all_creds() -> {ok, Creds::list()}
DO NOT USE! get a list of all credentials *ONLY* for testing!
get_cred(CredId::binary(), UserId::binary()) -> {ok, Credential::watts:temp_cred()} | {error, Reason::atom()}
retrieve the data if the userid is the same
get_cred_pid(CredentiaId::binary(), UserId::binary(), State::state()) -> {ok, Pid::pid()} | {error, not_found}
get the pid of the data process.
get_credential(CredentiaId::binary(), UserId::binary(), State::state()) -> {ok, Credential::watts:temp_cred()} | {error, not_found}
get a crecential for a user.
handle the gen_server:call
only support the stop cast
only support the Down info for a data process
init(X1::noparams) -> {ok, state()}
initialize the gen_server with an empty state.
start_link() -> {ok, pid()}
start the gen_server linked
stop() -> ok
stop the process.
terminate(Reason::any(), State::state()) -> ok
implementation of terminate, does nothing
Generated by EDoc