Coherence v0.5.1 Coherence.Authentication.Token
Implements token based authentication. To use add
plug Coherence.Authentication.Token, source: :params, param: "auth_token"
or
plug Coherence.Authentication.Token, source: :session, param: "auth_token"
or
plug Coherence.Authentication.Token, source: :header, param: "x-auth-token"
or
plug Coherence.Authentication.Token, source: { module, function, ["my_param"]} end
or
plug Coherence.Authentication.Token, source: :params_session, param: "auth_token"
to your pipeline.
Options
source
- where to locate the tokenerror
- The error message if not authenticatedassigns_key
- The key to user in assigns (:current_uer)store
- Where to store the token data
Link to this section Summary
Functions
Add the credentials for a token
. user_data
can be any term but must not be nil
Callback implementation for Plug.call/2
Utility function to generate a random authentication token
Callback implementation for Plug.init/1
Remove the credentials for a token
Link to this section Types
Link to this section Functions
Link to this function
add_credentials(token, user_data, store \\ Coherence.CredentialStore.Server)
Add the credentials for a token
. user_data
can be any term but must not be nil
.
Callback implementation for Plug.call/2
.
Link to this function
check_token_from_session(arg, param)
Utility function to generate a random authentication token.
Link to this function
get_token_from_header(conn, param)
Link to this function
get_token_from_params(conn, param)
Link to this function
get_token_from_params_session(conn, param)
Link to this function
get_token_from_session(conn, param)
Callback implementation for Plug.init/1
.
Link to this function
remove_credentials(token, store \\ Coherence.CredentialStore.Server)
Remove the credentials for a token
.