Created
August 26, 2015 06:56
-
-
Save olivermt/91c2892e515b7b82f298 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule RestAuth.RestAuthHandler do | |
use Behaviour | |
@doc "Loads a user from the database, will be used by `get_user_roles/1` function and ´get_user_metadata/1` functions" | |
defcallback load_user(username :: String.t, password :: String.t) :: Any | |
@doc "Fetches user roles from user object" | |
defcallback get_user_roles(user :: Any) :: [] | |
@doc "Returns default set of roles, for example `[\"ROLE_USER\"]`." | |
defcallback get_user_default_roles() :: [] | |
@doc "Fetches any optional metadata you want to store as a map. Can be accessed through `RestAuth.Utility.get_user_metadata`" | |
defcallback get_user_metadata(user :: Any) :: Map | |
@doc "The uri to look for that is used for `POST` to login, for example `/api/auth/login`" | |
defcallback get_login_path() :: String.t | |
@doc "The uri to look for that is used for `POST` to logout, for example `/api/auth/logout`" | |
defcallback get_logout_path() :: String.t | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment