Skip to content
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

AuthorizationManagerAfterMethodInterceptor custom annotations and aspecj support #14970

Open
mira-silhavy opened this issue Apr 26, 2024 · 2 comments
Assignees
Labels
status: feedback-provided Feedback has been provided

Comments

@mira-silhavy
Copy link

mira-silhavy commented Apr 26, 2024

HI, in our application based on spring security 5 we used PostInvocationAdviceProvider with AfterInvocationProviderManager and also defined few custom annotations to limit access to methods based on our internal roles.
We are also using aspectj weaving and we want to make sure some security checks happen inside transaction. For that we use AspectJMethodSecurityInterceptor and aspectj transactional support.

After updating to spring security 6 it's not really understandable how we should migrate all that code to AuthorizationManagerAfterMethodInterceptor as a replacement for AspectJMethodSecurityInterceptor. Furthermore there is no mention on how to use this new interceptor with aspectj (it seems like only Spring AOP is supported). Are we missing something or are you planning to add more support for aspectj into spring security 6? Are there any guides how we could define custom annotations in spring security 6 and potentially use the new interceptor code also as an aspect?

@mira-silhavy mira-silhavy added status: waiting-for-triage An issue we've not yet triaged type: enhancement A general enhancement labels Apr 26, 2024
@jzheaux
Copy link
Contributor

jzheaux commented Apr 26, 2024

Thanks for reaching out. You are correct that the new MethodInterceptors make no special accommodation for AspectJ. But, I'm thinking that shouldn't stop you from using AspectJ to describe your pointcuts and invoke it, similarly to how it's done with AbstractMethodInterceptorAspect in spring-security-aspects.

If not, then I may be missing something. Could you provide a sample of what did work in Spring Security 5 where the migration is now unclear?

@jzheaux jzheaux added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged type: enhancement A general enhancement labels Apr 26, 2024
@jzheaux jzheaux self-assigned this Apr 26, 2024
@mira-silhavy
Copy link
Author

mira-silhavy commented Apr 29, 2024

Hi @jzheaux, it's that the deprecated AspectJMethodSecurityInterceptor that we used internally used an instance of Spring's package private MethodInvocationAdapter.
After migrating this to new aspect based on the code in AbstractMethodInterceptorAspect I'm required to provide instance of MethodInvocation, but spring-security doesn't give access to any implementation e.g. JoinPointMethodInvocation used in AbstractMethodInterceptorAspect is package private.

If you're not planning to create an AspectJ compatible version of the interceptor similar to what was in version 5 it would be great to if you make the JoinPointMethodInvocation public.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: feedback-provided Feedback has been provided
Projects
None yet
Development

No branches or pull requests

3 participants