jaydoane commented on a change in pull request #2661: Enhance alg check
URL: https://github.com/apache/couchdb/pull/2661#discussion_r392382793
 
 

 ##########
 File path: src/jwtf/src/jwtf.erl
 ##########
 @@ -139,10 +139,11 @@ validate_alg(Props, Checks) ->
     case {Required, Alg} of
         {undefined, _} ->
             ok;
-        {true, undefined} ->
+        {Required, undefined} when Required /= undefined ->
             throw({bad_request, <<"Missing alg header parameter">>});
-        {true, Alg} ->
-            case lists:member(Alg, valid_algorithms()) of
+        {Required, Alg} when Required == true; is_list(Required) ->
+            AllowedAlg = if Required == true -> true; true -> 
lists:member(Alg, Required) end,
 
 Review comment:
   This logic is a bit awkward, but I assume it's being done for backward 
compatibility.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to