mirror of
https://github.com/mgerb/classic-wow-forums
synced 2026-01-10 09:02:50 +00:00
40 lines
1.4 KiB
Elixir
40 lines
1.4 KiB
Elixir
defmodule MyApp.Guardian.Auth.Pipeline.User do
|
|
use Guardian.Plug.Pipeline, otp_app: :MyApp,
|
|
module: MyApp.Guardian,
|
|
error_handler: MyApp.Auth.ErrorHandler
|
|
|
|
plug Guardian.Plug.VerifyHeader, realm: "Bearer"
|
|
plug Guardian.Permissions.Bitwise, one_of: [
|
|
%{user: [:read, :write]},
|
|
%{mod: [:read, :write]},
|
|
%{admin: [:read, :write]},
|
|
]
|
|
plug Guardian.Plug.EnsureAuthenticated
|
|
plug Guardian.Plug.LoadResource, allow_blank: true
|
|
end
|
|
|
|
defmodule MyApp.Guardian.Auth.Pipeline.Mod do
|
|
use Guardian.Plug.Pipeline, otp_app: :MyApp,
|
|
module: MyApp.Guardian,
|
|
error_handler: MyApp.Auth.ErrorHandler
|
|
|
|
plug Guardian.Plug.VerifyHeader, realm: "Bearer"
|
|
plug Guardian.Permissions.Bitwise, one_of: [
|
|
%{mod: [:read, :write]},
|
|
%{admin: [:read, :write]},
|
|
]
|
|
plug Guardian.Plug.EnsureAuthenticated
|
|
plug Guardian.Plug.LoadResource, allow_blank: true
|
|
end
|
|
|
|
defmodule MyApp.Guardian.Auth.Pipeline.Admin do
|
|
use Guardian.Plug.Pipeline, otp_app: :MyApp,
|
|
module: MyApp.Guardian,
|
|
error_handler: MyApp.Auth.ErrorHandler
|
|
|
|
plug Guardian.Plug.VerifyHeader, realm: "Bearer"
|
|
plug Guardian.Permissions.Bitwise, one_of: [%{admin: [:read, :write]}]
|
|
plug Guardian.Plug.EnsureAuthenticated
|
|
plug Guardian.Plug.LoadResource, allow_blank: true
|
|
end
|