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
Extracts an authorization token from the request header and adds it back into the connection. Retreives a user’s session information from the session store using the authorization token and adds that information back into the connection
Extracts the value of the request authorization header
Extracts the authorization token out of the request header value
Extracts the authorization header from the connection, extracts the authorization token from the header, and finally adds the token to the connection
Puts the extracted authorization token into the connection
Functions
Extracts an authorization token from the request header and adds it back into the connection. Retreives a user’s session information from the session store using the authorization token and adds that information back into the connection.
Extracts the value of the request authorization header.
Examples
iex> conn = %Plug.Conn{}
iex> conn = Plug.Conn.put_req_header(conn, "authorization", "Bearer: 1")
iex> Bouncer.Plugs.Authorize.get_auth_header conn
"Bearer: 1"
iex> Bouncer.Plugs.Authorize.get_auth_header %Plug.Conn{}
nil
Extracts the authorization token out of the request header value.
Examples
iex> Bouncer.Plugs.Authorize.get_auth_token "Bearer: test"
"test"
iex> Bouncer.Plugs.Authorize.get_auth_token nil
nil
Extracts the authorization header from the connection, extracts the authorization token from the header, and finally adds the token to the connection.