gandalf v0.2.0 Gandalf.Authentication.Token
Base token authentication helper, implements Gandalf.Authentication behaviour. Differently from Bearer or Session, this module is a generic helper module. It enables to match with any token type from ‘token store(Gandalf.Token)’.
Summary
Functions
Authenticates resource-owner using given token name and value pairs
Functions
Authenticates resource-owner using given token name and value pairs.
It matches resource owner with given token name and value.
If any resource owner matched given credentials,
it returns Gandalf.Model.User
struct, otherwise
{:error, Map, :http_status_code}
.
Examples
# Suppose we store a confirmation_token at 'token store'
# with token value "ct123456789"
# If we pass the token value to the function,
# it will return resource-owner.
Gandalf.Authentication.Token.authenticate({"confirmation_token",
"ct123456789"}, ["read", "write"])