PlugAuth.Authentication.Token

Implements token based authentication. To use add

plug PlugAuth.Authentication.Token, source: :params, param: "auth_token"

or

plug PlugAuth.Authentication.Token, source: :session, param: "auth_token"

or

plug PlugAuth.Authentication.Token, source: :header, param: "X-Auth-Token"

or

plug PlugAuth.Authentication.Token, source: { module, function, ["my_param"]} end

to your pipeline.

Summary

add_credentials(token, user_data)

Add the credentials for a token. user_data can be any term but must not be nil

call(conn, opts)

Callback implementation for c:Plug.call/2

generate_token()

Utility function to generate a random authentication token

get_token_from_header(conn, param)
get_token_from_params(conn, param)
get_token_from_session(conn, param)
init(opts)

Callback implementation for c:Plug.init/1

remove_credentials(token)

Remove the credentials for a token

Functions

add_credentials(token, user_data)

Add the credentials for a token. user_data can be any term but must not be nil.

call(conn, opts)

Callback implementation for c:Plug.call/2.

generate_token()

Utility function to generate a random authentication token.

get_token_from_header(conn, param)
get_token_from_params(conn, param)
get_token_from_session(conn, param)
init(opts)

Callback implementation for c:Plug.init/1.

remove_credentials(token)

Remove the credentials for a token.