authorization icon indicating copy to clipboard operation
authorization copied to clipboard

Add unauthorizedRedirect

Open cleptric opened this issue 5 years ago • 6 comments

Quick draft to add an unauthorizedRedirect option to the RequestAuthorizationMiddleware. Some open questions:

  • Shall we handle a 404 by the RoutingMiddleware?
  • Is a simple string enough, or do we need Router support?
  • Shall we append the previous URL to the redirect?

cleptric avatar Apr 14 '20 07:04 cleptric

Looks like a good idea, yeah.

dereuromark avatar Apr 14 '20 18:04 dereuromark

Codecov Report

Merging #131 into master will decrease coverage by 0.19%. The diff coverage is 66.66%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #131      +/-   ##
============================================
- Coverage     95.83%   95.64%   -0.20%     
- Complexity      195      196       +1     
============================================
  Files            18       18              
  Lines           456      459       +3     
============================================
+ Hits            437      439       +2     
- Misses           19       20       +1     
Impacted Files Coverage Δ Complexity Δ
src/Policy/MapResolver.php 100.00% <ø> (ø) 14.00 <0.00> (ø)
src/Middleware/RequestAuthorizationMiddleware.php 94.73% <66.66%> (-5.27%) 6.00 <0.00> (+1.00) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0fa5d65...5efaf41. Read the comment docs.

codecov[bot] avatar Apr 29 '20 14:04 codecov[bot]

Do we still want to finish this?

dereuromark avatar Dec 29 '20 20:12 dereuromark

Can't this be done using the AuthorizationMiddleware exception handling? That can redirect from a ForbiddenException.

othercorey avatar May 19 '21 15:05 othercorey

@cleptric What do you think?

dereuromark avatar Feb 14 '22 14:02 dereuromark

Can't this be done using the AuthorizationMiddleware exception handling?

Is a simple string enough, or do we need Router support?

Router support will available after merging #192 so do mentioned PR can cover this PR?

saeideng avatar Feb 14 '22 15:02 saeideng

Redirection is now possible through 'unauthorizedHandler` added in #211

ADmad avatar Sep 29 '22 05:09 ADmad