summaryrefslogtreecommitdiff
path: root/src/http_auth.erl
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2017-01-23 15:44:55 +0100
committerLinus Nordberg <linus@nordu.net>2017-01-23 15:44:55 +0100
commit7b114604595b2e3bb0816ffb01548b02c43cdea5 (patch)
tree881d8fba74ed5197c51394845e65ef79f8838ae4 /src/http_auth.erl
parent2fa46317bdd4da077d932c58a150cecf08248be2 (diff)
parent784f116ba3fad8e28ef2fefd86d5df71801dbe6f (diff)
Merge remote-tracking branch 'refs/remotes/map/config-api-key'
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),