Guardian v0.14.5 Guardian.Plug.LoadResource
Fetches the resource specified in a set of claims.
The current resource is loaded by calling from_token/1
on your
Guardian.Serializer
with the value of the sub
claim. See the :serializer
option for more details.
If the resource is loaded successfully, it is accessible by calling
Guardian.Plug.current_resource/2
.
If there is no valid JWT in the request so far (Guardian.Plug.VerifySession
/ Guardian.Plug.VerifyHeader
) did not find a valid token
then nothing will occur, and Guardian.Plug.current_resource/2
will be nil.
Options
:serializer
- The serializer to use to load the current resource from the subject claim of the token. Defaults to the result ofGuardian.serializer/0
.:claim
- The claim to look for to pass value to serializer. Defaults tosub
.