Skullabs/kikaha

Allow to extend and customize the Permission Denied behavior

jardelnovaes opened this issue · 4 comments

Permission Denied has two options:

Redirect to the URL set in permission-denied-page

OR

Send the response 403-Permission Denied

Unfortunately it'll be the same for all kind of requests and we need to response a JSON for APIs and a HTML for user pages.

Expected behavior:

Allow to extend and customize the Permission Denied behavior implementing a custom class.
Keep the current behavior as default behave.

Suggestion:

  • Create an interface PermissionDeniedHandler.
  • Implement a default class that will behave as today.
  • Change the AuthenticationRunner.tryExecuteChain method to use the interface PermissionDeniedHandler rather than the current code.
  • Create the property server.auth.permission-denied-handler for the PermissionDeniedHandler
  • Set a default class into defaults.yml

@roneigebert asked me to implement this issue.

miere commented

I'm already working on it!

released.