You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/03/06 15:47:40 UTC

[GitHub] [apisix] soulbird commented on a change in pull request #6485: feat: authz-keycloak plugin support redirect not authorized user

soulbird commented on a change in pull request #6485:
URL: https://github.com/apache/apisix/pull/6485#discussion_r820174477



##########
File path: apisix/plugins/authz-keycloak.lua
##########
@@ -592,9 +593,13 @@ local function evaluate_permissions(conf, ctx, token)
         permission = conf.permissions
     end
 
-    -- Return 403 if permission is empty and enforcement mode is "ENFORCING".
+    -- Return 403 or 302 if permission is empty and enforcement mode is "ENFORCING".
     if #permission == 0 and conf.policy_enforcement_mode == "ENFORCING" then
         -- Return Keycloak-style message for consistency.
+        if conf.access_denied_redirect_uri then
+            core.response.set_header("Location", conf.access_denied_redirect_uri)
+            return 302

Review comment:
       I noticed that there is no judgment request method here. And if the request method is `POST`,  302 status code can not achieve the expected effect, 307 might be more appropriate.




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

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org