AuthPlugOptional (auth_plug v1.5.2)
AuthPlugOptional
handles any route where authentication is optional
e.g. if you're building a CMS where content is public
but seeing comments requires auth, the same page can show different
content depending on if the person has logged in or not.
Please see README.md
for for optional auth usage.
Link to this section Summary
Functions
call/2
is invoked to handle each HTTP request which auth_plug
protects.
If the conn
contains a valid JWT in Authentication Headers, URL or Cookie,
then continue to the optionally protected route with the conn.assigns.person
defined so that the controller can determine what content to show the person.
NOTE: this plug does NOT set the HTTP Status on a request, that is left to you.
init/1
returns options unmodified
Link to this section Functions
call(conn, options)
call/2
is invoked to handle each HTTP request which auth_plug
protects.
If the conn
contains a valid JWT in Authentication Headers, URL or Cookie,
then continue to the optionally protected route with the conn.assigns.person
defined so that the controller can determine what content to show the person.
NOTE: this plug does NOT set the HTTP Status on a request, that is left to you.
init(options)
init/1
returns options unmodified