使用静态织法确保弹簧安全 [英] Use static weaving with spring-security

查看:73
本文介绍了使用静态织法确保弹簧安全的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

同事, 在 spring安全文档中我遇到了以下观念:

Colleagues, In the spring security documentation I met following notion:

如果要保护不是由Spring创建的实例(使用 例如新操作符),则需要使用AspectJ.

If you want to secure instances which are not created by Spring (using the new operator, for example) then you need to use AspectJ.

任何人都可以给我看看这种用法的可行示例.最好的情况是在静态编织的帮助下完成.

Could anybody please show me workable example of such usage. The best case if this is done with help of static weaving.

提前谢谢!

推荐答案

有一个

There is an Aspectj sample in the Spring Security codebase. It compiles against the spring-security-aspects module and then uses:

<global-method-security secured-annotations="enabled" mode="aspectj" />

启用安全注释.代码非常简单-实际上只是一组

to enable secured annotations. The code is very simple - it is really just a set of JUnit tests. If you take a look, you'll see that these include tests for both Spring-bean instances and instances created using the new operator.

如果您想了解spring-security-aspects的工作方式,请查看

If you want to know how spring-security-aspects works, check out the aspect source.

这篇关于使用静态织法确保弹簧安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆