diff options
author | Magnus Ahltorp <map@kth.se> | 2017-01-20 00:30:36 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2017-01-30 09:15:09 +0100 |
commit | 85b20a1a07e0eb9e4a7c0cedc169b2ad210b30b6 (patch) | |
tree | 881d8fba74ed5197c51394845e65ef79f8838ae4 /src/http_auth.erl | |
parent | 2fa46317bdd4da077d932c58a150cecf08248be2 (diff) |
API keys are now provided in config file
Also added CA cert verification for internal TLS connections.
Diffstat (limited to 'src/http_auth.erl')
-rw-r--r-- | src/http_auth.erl | 20 |
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), |