summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2020-03-20 19:07:51 +0000
committerRobert Newson <rnewson@apache.org>2020-03-22 23:16:29 +0000
commit16b3c8d6e1c39e2bd0b0bb8524e3b28ce5457973 (patch)
treef04a22bb858f37869f19e81862962715e094352d
parentdc88e3623f839246028b722dbe3b4235c27dc69e (diff)
downloadcouchdb-jwt-enhancements.tar.gz
base64 the symmetric jwt keysjwt-enhancements
-rw-r--r--src/jwtf/src/jwtf_keystore.erl2
-rw-r--r--test/elixir/test/jwtauth_test.exs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/jwtf/src/jwtf_keystore.erl b/src/jwtf/src/jwtf_keystore.erl
index 82df54e5b..2f2f24744 100644
--- a/src/jwtf/src/jwtf_keystore.erl
+++ b/src/jwtf/src/jwtf_keystore.erl
@@ -109,7 +109,7 @@ get_from_config(Alg, KID) ->
Key ->
case jwtf:verification_algorithm(Alg) of
{hmac, _} ->
- list_to_binary(Key);
+ base64:decode(Key);
{public_key, _} ->
BinKey = iolist_to_binary(string:replace(Key, "\\n", "\n", all)),
[PEMEntry] = public_key:pem_decode(BinKey),
diff --git a/test/elixir/test/jwtauth_test.exs b/test/elixir/test/jwtauth_test.exs
index a8f9c50e0..3f26e1eaf 100644
--- a/test/elixir/test/jwtauth_test.exs
+++ b/test/elixir/test/jwtauth_test.exs
@@ -11,7 +11,7 @@ defmodule JwtAuthTest do
%{
:section => "jwt_keys",
:key => "_default",
- :value => secret
+ :value => :base64.encode(secret)
},
%{
:section => "jwt_auth",