spring security 3 自定义认证,授权示例
?
Spring Security 3.x 出来一段时间了,跟Acegi是大不同了,与2.x的版本也有一些小小的区别,网上有一些文档,也有人翻译Spring Security 3.x的guide,但通过阅读guide,无法马上就能很容易的实现一个完整的实例。
?
我花了点儿时间,根据以前的实战经验,整理了一份完整的入门教程,供需要的朋友们参考。
1,建一个web project,并导入所有需要的lib,这步就不多讲了。
2,配置web.xml,使用Spring的机制装载:
?
?这个文件中的内容我相信大家都很熟悉了,不再多说了。
?
?
2,来看看applicationContext-security.xml这个配置文件,关于SpringSecurity的配置均在其中:
?
最近一直在学习当中,spring security的动态角色控制机制不是很清楚,通过你的博文,有所明白! 哥们,好样的! 2 楼 Dping 2011-08-16 不错的文章,适合有一定基础的人阅读!加油! 3 楼 wei8424779 2012-02-01 配置出现错误。
Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext-security.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/web/util/AntPathRequestMatcher
谁可以帮忙解释下 4 楼 wei8424779 2012-02-01 策器,决定某个用户具有的角色,是否有足够的权限去访问某个资源 wei8424779 写道配置出现错误。
Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext-security.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/web/util/AntPathRequestMatcher
谁可以帮忙解释下
jar 包冲突。楼主配置没有问题。谢谢~