atrauzzi 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_r396724895
 
 

 ##########
 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">>]
     assert resp.body["info"]["authenticated"] == "jwt"
 
 Review comment:
   I've added assertions to this portion of the test to ensure we're verifying 
what comes out of the session endpoint.

----------------------------------------------------------------
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