-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4315 from Quobis/support-loading-elixir-modules-f…
…or-auth feat: support loading Elixir modules for auth
- Loading branch information
Showing
4 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
defmodule ModAuthExample do | ||
@moduledoc """ | ||
This is a dummy auth module to demonstrate the usage of Elixir to | ||
create Ejabberd Auth modules. | ||
""" | ||
import Ejabberd.Logger | ||
@behaviour :ejabberd_auth | ||
|
||
@impl true | ||
def start(host) do | ||
info("Using mod_auth_example to authenticate #{host} users") | ||
nil | ||
end | ||
|
||
@impl true | ||
def stop(host) do | ||
info("Stop using mod_auth_example to authenticate #{host} users") | ||
nil | ||
end | ||
|
||
@impl true | ||
def check_password("alice", _authz_id, _host, "secret"), do: {:nocache, true} | ||
def check_password(_username, _authz_id, _host, _secret), do: {:nocache, false} | ||
|
||
@impl true | ||
def user_exists("alice", _host), do: {:nocache, true} | ||
def user_exists(_username, _host), do: {:nocache, false} | ||
|
||
@impl true | ||
def plain_password_required(_binary), do: true | ||
|
||
@impl true | ||
def store_type(_host), do: :external | ||
|
||
@impl true | ||
def use_cache(_host), do: false | ||
end |
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
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
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