gandalf v0.2.0 Gandalf.Authentication.Session

Bearer authencation helper module, implements Gandalf.Authentication behaviour.

Summary

Functions

Authenticates resource-owner using session_token token value

Functions

authenticate(session_token, required_scopes)

Authenticates resource-owner using session_token token value.

It matches resource owner with given session_token. Since Session auth represents resource owners direct access to resources, it does not require any scope check for authorization. If any resource owner matched given credentials, it returns {:ok, Gandalf.Model.User struct}, otherwise {:error, Map, :http_status_code}

Examples

# Suppose we have a session_token at 'token store(Gandalf.Token)'
# with token value "st123456789"
# If we pass the token value to the function,
# it will return resource-owner.
Gandalf.Authentication.Session.authenticate("st123456789", [])