-
Notifications
You must be signed in to change notification settings - Fork 6k
Add AuthorizationManager that uses ExpressionHandler #11171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3ab2068
to
75ca7e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @evgeniycheban I've commented inline
|
||
private Expression expression; | ||
|
||
private final String expressionString; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this needs to be tracked separately because you can just set the Expression directly and use Expression.getExpressionString() when you need to update the Expression when a new SecurityExpressionHandler is set.
This would also allow afterPropertiesSet to be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering if it's okay to parse an expression twice when a custom SecurityExpressionHandler
is set.
I personally prefer using afterPropertiesSet
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
...va/org/springframework/security/web/access/expression/WebExpressionAuthorizationManager.java
Show resolved
Hide resolved
@@ -39,6 +40,17 @@ public WebSecurityExpressionRoot(Authentication a, FilterInvocation fi) { | |||
this.request = fi.getRequest(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constructor can use the newly added constructor this(authentication, fi.getRequest())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Thank you for the changes. I've approved it from my side and will leave it to @jzheaux from here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @evgeniycheban! I've left some feedback inline.
...ingframework/security/config/annotation/web/configurers/AuthorizeHttpRequestsConfigurer.java
Outdated
Show resolved
Hide resolved
...org/springframework/security/web/access/expression/DefaultHttpSecurityExpressionHandler.java
Outdated
Show resolved
Hide resolved
...org/springframework/security/web/access/expression/DefaultHttpSecurityExpressionHandler.java
Outdated
Show resolved
Hide resolved
.../main/java/org/springframework/security/web/access/expression/WebSecurityExpressionRoot.java
Show resolved
Hide resolved
...va/org/springframework/security/web/access/expression/WebExpressionAuthorizationManager.java
Outdated
Show resolved
Hide resolved
Also, @evgeniycheban, if you would please rebase against |
6f3ff0d
to
23dca8b
Compare
@jzheaux Thanks for the review. I've made changes according to your comments and rebased this branch on top of |
Thanks again, @evgeniycheban! This is now merged into |
Closes gh-11105