rnewson commented on a change in pull request #2694: Add support for roles to 
be obtained from JWTs.
URL: https://github.com/apache/couchdb/pull/2694#discussion_r397028323
 
 

 ##########
 File path: test/elixir/test/jwtauth_test.exs
 ##########
 @@ -103,13 +103,14 @@ defmodule JwtAuthTest do
   end
 
   def test_fun(alg, key) do
-    {:ok, token} = :jwtf.encode({[{"alg", alg}, {"typ", "JWT"}]}, {[{"sub", 
"co...@apache.org"}]}, key)
+    {:ok, token} = :jwtf.encode({[{"alg", alg}, {"typ", "JWT"}]}, {[{"sub", 
"co...@apache.org"}, {"roles", ["testing"]}]}, key)
 
     resp = Couch.get("/_session",
       headers: [authorization: "Bearer #{token}"]
     )
 
     assert resp.body["userCtx"]["name"] == "co...@apache.org"
+    assert resp.body["userCtx"]["roles"] == [<<"testing">>]
 
 Review comment:
   this should be `["testing"]` for parity with the input and in deference to 
elixir's syntax where strings are binaries.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to