-
Notifications
You must be signed in to change notification settings - Fork 6.1k
When using @EnableReactiveMethodSecurity there doesn't seem to be a way to mechanism to override or replace the PermissionEvaluator #15715
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
Labels
in: config
An issue in spring-security-config
status: duplicate
A duplicate of another issue
type: enhancement
A general enhancement
Comments
As a workaround, I've had to add the following configuration @Configuration
class WebFluxPermissionEvaluatorConfiguration(
@Autowired(required = false)
private val methodSecurityExpressionHandler: DefaultMethodSecurityExpressionHandler?, // Injecting existing handler
private val aclService: MutableAclService
) {
@PostConstruct
fun configureExistingMethodSecurityExpressionHandler() {
if (methodSecurityExpressionHandler != null) {
val permissionEvaluator = AclPermissionEvaluator(aclService)
methodSecurityExpressionHandler.setPermissionEvaluator(permissionEvaluator)
methodSecurityExpressionHandler.setPermissionCacheOptimizer(AclPermissionCacheOptimizer(aclService))
}
}
} |
kse-music
added a commit
to kse-music/spring-security
that referenced
this issue
Sep 1, 2024
kse-music
added a commit
to kse-music/spring-security
that referenced
this issue
Sep 1, 2024
This is similar enough to #11598 that I'll close this and let's continue the conversation over there. |
kse-music
added a commit
to kse-music/spring-security
that referenced
this issue
Sep 4, 2024
kse-music
added a commit
to kse-music/spring-security
that referenced
this issue
Sep 5, 2024
jzheaux
pushed a commit
to kse-music/spring-security
that referenced
this issue
Sep 10, 2024
jzheaux
pushed a commit
that referenced
this issue
Sep 10, 2024
jzheaux
added a commit
that referenced
this issue
Sep 10, 2024
- Rename to follow convention - Use a mock object to verify usage Issue gh-15715
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
in: config
An issue in spring-security-config
status: duplicate
A duplicate of another issue
type: enhancement
A general enhancement
Uh oh!
There was an error while loading. Please reload this page.
Description
When using @EnableReactiveMethodSecurity the "ReactiveAuthorizationManagerMethodSecurityConfiguration" is loaded. This contains a @bean which defines a DefaultMethodSecurityExpressionHandler. This class defines a default DenyAllPermissionEvaluator.
This appears to be result in all methods which use the permission evaluator to be denied.
To Reproduce
Expected behavior
The DefaultMethodSecurityExpressionHandler should find the AclPermissionEvaluator as an available bean and use it
Sample
https://github.com/grantlittle/security-demo
The text was updated successfully, but these errors were encountered: