conductor v0.4.0 Conductor.Plugs.Authorize View Source
Plug added to controllers by Conductor macro
It takes list of scopes as option, concatenates it with list of root scopes and check assings inside conn.
If at least one scope from conn is on list of authorized scopes then
action can be performed. Otherwise it will respond according to
choosen failure strategy (default: raise Conductor.Error
)
If you would like to require multiple scopes at once, inclose them in tuple. For example:
@authorize scope: {"scope1", "scope2"}
def action(conn, _params), do: ...
In order to perform action both "scope1" and "scope2" must be assigned inside conn.
Link to this section Summary
Link to this section Functions
Callback implementation for Plug.call/2
.
Callback implementation for Plug.init/1
.