summaryrefslogtreecommitdiff
path: root/src/http_auth.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/http_auth.erl')
-rw-r--r--src/http_auth.erl20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/http_auth.erl b/src/http_auth.erl
index a187e05..16d7dfa 100644
--- a/src/http_auth.erl
+++ b/src/http_auth.erl
@@ -17,24 +17,10 @@ init_key_table() ->
read_key_table().
read_key_table() ->
- PublickeyDir = application:get_env(plop, publickey_path, none),
- ServersACL = application:get_env(plop, allowed_servers, []),
- ClientsACL = application:get_env(plop, allowed_clients, []),
- Keys = sets:from_list(
- lists:flatmap(fun ({_, Keys}) ->
- case Keys of
- noauth ->
- [];
- _ when is_list(Keys) ->
- Keys
- end
- end, ServersACL ++ ClientsACL)),
lists:foreach(
- fun (KeyName) ->
- Key = sign:read_keyfile_ec(PublickeyDir ++ "/" ++
- KeyName ++ ".pem"),
- true = ets:insert(?KEY_TABLE, {KeyName, Key})
- end, sets:to_list(Keys)),
+ fun ({KeyName, Der}) ->
+ true = ets:insert(?KEY_TABLE, {KeyName, sign:pem_entry_decode({'SubjectPublicKeyInfo', Der, []})})
+ end, application:get_env(plop, apikeys, [])),
case application:get_env(plop, own_key, none) of
{_OwnKeyName, OwnKeyFile} ->
OwnKey = sign:read_keyfile_ec(OwnKeyFile),