Guardian v0.13.0 Guardian.Serializer behaviour

Guardian Serializer Behaviour.

Guardian requires a serializer. This serializer is responsible for fetching the resource from the encoded value in the JWT and also encoding a resource into a String so that it may be stored in the JWT

Summary

Callbacks

Serializes the object into the token. Suggestion: “User:2”

De-serializes the object from a token

Callbacks

for_token(object)

Specs

for_token(object :: term) ::
  {:ok, String.t} |
  {:error, String.t}

Serializes the object into the token. Suggestion: “User:2”

from_token(subject)

Specs

from_token(subject :: String.t) ::
  {:ok, object :: term} |
  {:error, String.t}

De-serializes the object from a token