Bouncer.Plugs.Authorize

The Authorize plug can be used to scan a connection for an authorization token and use it to retrieve a user session so it can be added to the connection.

Summary

Functions

Adds the user’s session data to the connection so that the controller actions that use the plug can determine what to do with the information

Scans a connection for an authroization token, uses the token to retrieve a user, adds it to the connection, and returns the connection

Returns the value of the request authorization header

Pulls the authorization token out of the request header value

Functions

add_user_to_connection(arg1, conn)

Adds the user’s session data to the connection so that the controller actions that use the plug can determine what to do with the information.

call(conn, )

Scans a connection for an authroization token, uses the token to retrieve a user, adds it to the connection, and returns the connection.

get_authorization_header(conn)

Returns the value of the request authorization header.

get_authorization_token(header_value)

Pulls the authorization token out of the request header value.

Examples

iex> Bouncer.Plugs.Authorize.get_authorization_token "Bearer: test"
"test"
iex> Bouncer.Plugs.Authorize.get_authorization_token nil
nil
init(options)