authorization
authorization copied to clipboard
Add unauthorizedRedirect
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
Routersupport? - Shall we append the previous URL to the redirect?
Looks like a good idea, yeah.
Codecov Report
Merging #131 into master will decrease coverage by
0.19%. The diff coverage is66.66%.
@@ 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 dataPowered by Codecov. Last update 0fa5d65...5efaf41. Read the comment docs.
Do we still want to finish this?
Can't this be done using the AuthorizationMiddleware exception handling? That can redirect from a ForbiddenException.
@cleptric What do you think?
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?
Redirection is now possible through 'unauthorizedHandler` added in #211