- 浏览: 7851220 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (2425)
- 软件工程 (75)
- JAVA相关 (662)
- ajax/web相关 (351)
- 数据库相关/oracle (218)
- PHP (147)
- UNIX/LINUX/FREEBSD/solaris (118)
- 音乐探讨 (1)
- 闲话 (11)
- 网络安全等 (21)
- .NET (153)
- ROR和GOG (10)
- [网站分类]4.其他技术区 (181)
- 算法等 (7)
- [随笔分类]SOA (8)
- 收藏区 (71)
- 金融证券 (4)
- [网站分类]5.企业信息化 (3)
- c&c++学习 (1)
- 读书区 (11)
- 其它 (10)
- 收藏夹 (1)
- 设计模式 (1)
- FLEX (14)
- Android (98)
- 软件工程心理学系列 (4)
- HTML5 (6)
- C/C++ (0)
- 数据结构 (0)
- 书评 (3)
- python (17)
- NOSQL (10)
- MYSQL (85)
- java之各类测试 (18)
- nodejs (1)
- JAVA (1)
- neo4j (3)
- VUE (4)
- docker相关 (1)
最新评论
-
xiaobadi:
jacky~~~~~~~~~
推荐两个不错的mybatis GUI生成工具 -
masuweng:
(转)JAVA获得机器码的实现 -
albert0707:
有些扩展名为null
java 7中可以判断文件的contenttype了 -
albert0707:
非常感谢!!!!!!!!!
java 7中可以判断文件的contenttype了 -
zhangle:
https://zhuban.me竹板共享 - 高效便捷的文档 ...
一个不错的网络白板工具
spring security 3比较庞大,但功能很强,下面小结下spring security 3中值得
注意的10个典型用法
1)多个authentication-provide可以同时使用
2 传统的<security:http>
3 可以使用一大堆密码加密器:
aseDigestPasswordEncoder
BasePasswordEncoder
LdapShaPasswordEncoder
Md4PasswordEncoder,
Md5PasswordEncoder
MessageDigestPasswordEncoder
MessageDigestPasswordEncoder
PlaintextPasswordEncoder
ShaPasswordEncoder
4 SPRING security的标签
这是根据角色判断是否显示
还可以根据URL判断是否显示
5 方法级的鉴别
@PreAuthorize @PostAuthorize @Secure
要启用上面三者,要
<global-method-security pre-post-annotations='enabled' />
这三个是在方法调用前,先鉴别是否有权限使用,比如
感觉这个其实不是很常用
6 同5,可以使用JSR-250 注解去做
<global-method-security jsr250-annotations=”enabled”/>
@RolesAllowed({“ROLE_USER”,”ROLE_ADMIN”})
@PermitAll
@DenyAll
这样使用:
@RolesAllowed({"ROLE_ADMIN","ROLE_USER"})
public void deleteUser(String username);
这个东西反正没用到,具体见手册
7 配置open-id,步骤
<http auto-config='true'>
<openid-login/>
</http>
当然要加上:spring-security-openid.jar
8 spring secruity能使用ldap
<ldap-server ldif='classpath:my-ldif-file.ldif' id='localserver' />
当然要加上:spring-security-openid.jar
9 使用远程 ldap-server
<ldap-server url='ldap://myServer/dc=captaindebug,dc=com:389' id='ldapExternal'
manager-dn='uid=admin,ou=users,ou=systems' manager-password='s3cret'/>
8和9还没用过,估计配置起来还有更多东西
10 使用https
<http auto-config='true' use-expressions='true'>
<intercept-url pattern='/login' requires-channel='https'/>
</https>
这个比较简单,用requires-channel='https'
如果是自定义MetadataSource,需要配置
只有当stripQueryStringFromUrls属性为true,才会过滤掉参数串
注意的10个典型用法
1)多个authentication-provide可以同时使用
<authentication-manager alias='authenticationManager'> <authentication-provider> <user-service> <user authorities='ROLE_GUEST' name='guest' password=''/> </user-service> </authentication-provider> <authentication-provider> <jdbc-user-service data-source-ref='dataSource'/> </authentication-provider> </authentication-manager>
2 传统的<security:http>
<security:http> <security:intercept-url pattern='/admin/**' access='hasRole('ROLE_ADMIN')'/> <security:intercept-url pattern='/account/**' access='hasRole('ROLE_USER')' /> <security:intercept-url pattern='/**' access='hasRole('ROLE_ANONYMOUS')' /> <!-- other elements removed for clarity --> </security:http>
3 可以使用一大堆密码加密器:
aseDigestPasswordEncoder
BasePasswordEncoder
LdapShaPasswordEncoder
Md4PasswordEncoder,
Md5PasswordEncoder
MessageDigestPasswordEncoder
MessageDigestPasswordEncoder
PlaintextPasswordEncoder
ShaPasswordEncoder
4 SPRING security的标签
<sec:authorize access='hasRole('supervisor')'> This content will only be visible to users who have the 'supervisor' authority in their list of <tt>GrantedAuthority</tt>s. </sec:authorize>
这是根据角色判断是否显示
还可以根据URL判断是否显示
<sec:authorize url='/admin'> This content will only be visible to users who are authorized to send requests to the '/admin' URL. </sec:authorize>
5 方法级的鉴别
@PreAuthorize @PostAuthorize @Secure
要启用上面三者,要
<global-method-security pre-post-annotations='enabled' />
这三个是在方法调用前,先鉴别是否有权限使用,比如
public interface IUserService { @PreAuthorize("hasRole('ROLE_USER')") public void changePassword(String username, password); }
感觉这个其实不是很常用
6 同5,可以使用JSR-250 注解去做
<global-method-security jsr250-annotations=”enabled”/>
@RolesAllowed({“ROLE_USER”,”ROLE_ADMIN”})
@PermitAll
@DenyAll
这样使用:
@RolesAllowed({"ROLE_ADMIN","ROLE_USER"})
public void deleteUser(String username);
这个东西反正没用到,具体见手册
7 配置open-id,步骤
<form action='j_spring-openid-security-check' method='post'> <label for='openid_idenifier'>Login</label>: <input id='openid_identifier' name='openid_identifier' type='text'/> <input type='submit' value='Login' /> </form>
<http auto-config='true'>
<openid-login/>
</http>
当然要加上:spring-security-openid.jar
8 spring secruity能使用ldap
<ldap-server ldif='classpath:my-ldif-file.ldif' id='localserver' />
当然要加上:spring-security-openid.jar
9 使用远程 ldap-server
<ldap-server url='ldap://myServer/dc=captaindebug,dc=com:389' id='ldapExternal'
manager-dn='uid=admin,ou=users,ou=systems' manager-password='s3cret'/>
8和9还没用过,估计配置起来还有更多东西
10 使用https
<http auto-config='true' use-expressions='true'>
<intercept-url pattern='/login' requires-channel='https'/>
</https>
这个比较简单,用requires-channel='https'
评论
2 楼
Dead_knight
2013-02-18
tywo45 写道
请教博主一个spring security的问题
http://192.168.20.92:8080/pubang-caigou/materieloffer/myMaterieloffer.action?id=3232
在url后面加上这个id=3232就拦截不了,不知道有没有好办法解决,我的spring security版本是3.1.2的
http://192.168.20.92:8080/pubang-caigou/materieloffer/myMaterieloffer.action?id=3232
在url后面加上这个id=3232就拦截不了,不知道有没有好办法解决,我的spring security版本是3.1.2的
如果是自定义MetadataSource,需要配置
<property name="stripQueryStringFromUrls" value="true"></property>
只有当stripQueryStringFromUrls属性为true,才会过滤掉参数串
1 楼
tywo45
2012-12-28
请教博主一个spring security的问题
http://192.168.20.92:8080/pubang-caigou/materieloffer/myMaterieloffer.action?id=3232
在url后面加上这个id=3232就拦截不了,不知道有没有好办法解决,我的spring security版本是3.1.2的
http://192.168.20.92:8080/pubang-caigou/materieloffer/myMaterieloffer.action?id=3232
在url后面加上这个id=3232就拦截不了,不知道有没有好办法解决,我的spring security版本是3.1.2的
发表评论
-
复习:强迫线程顺序执行方式
2019-01-03 23:42 1476方法1: 三个线程,t1,t2,t3,如果一定要按顺序执行, ... -
(转)不错的前后端处理异常的方法
2019-01-02 23:16 1965前言 在 Web 开发中, 我们经常会需要处理各种异常, 这是 ... -
info q的极客时间大咖说等资料下载
2018-08-15 08:40 3410info q的极客时间大咖说等资料下载,还有不少思维导图 链 ... -
CXF 客户端超时时间设置(非Spring配置方式)
2018-07-03 22:38 2178import org.apache.cxf.endpoint. ... -
(转)synchronized关键字画像:正确打开方式
2018-06-14 09:25 445https://mp.weixin.qq.com/s/b3Sx ... -
CountDownLatch的例子
2018-06-13 14:10 628public class StatsDemo { ... -
两道面试题,带你解析Java类加载机制
2018-06-12 16:29 550https://mp.weixin.qq.com/s/YTa0 ... -
Spring中获取request的几种方法,及其线程安全性分析
2018-06-11 09:03 621https://mp.weixin.qq.com/s/KeFJ ... -
内部类小结
2018-06-06 10:25 394https://mp.weixin.qq.com/s/hErv ... -
JVM虚拟机小结1
2018-06-04 20:43 4611 jps -l //列出详细的类名和进程ID 2)jps ... -
windows下自带命令行工具查看CPU资源情况等
2018-06-04 12:53 3038微软提供了不少命令行 ... -
(收藏)深入分析Java的序列化与反序列化
2018-05-30 15:21 553https://mp.weixin.qq.com/s/T2Bn ... -
apache common包中的序列化工具
2018-05-30 09:10 1773什么是序列化 我们的 ... -
JAVA8 JVM的变化: 元空间(Metaspace)
2018-05-24 22:30 904本文将会分享至今为至我收集的关于永久代(Permanent G ... -
(转)服务器性能指标(一)——负载(Load)分析及问题排查
2018-05-21 21:03 1262原创: Hollis Hollis 负载 ... -
(转)对象复用
2018-05-20 15:27 804public class Student { priv ... -
mapreduce中入门中要注意的几点
2018-05-06 08:59 617在 mapreduce中,比如有如下的词: I love b ... -
HDFS的基本操作
2018-05-02 21:47 877-mkdir 在HDFS创建目录 ... -
一个不错的开源工具类,专门用来解析日志头部的,好用
2018-05-02 20:00 705一个不错的开源工具类,专门用来解析日志头部的,好用。 http ... -
介绍个不错的RESTFUL MOCK的工具wiremock
2018-04-27 21:02 1852介绍个不错的RESTFUL MOCK的工具wiremock,地 ...
相关推荐
spring security3 中文版本
Spring Security3中文文档
Spring Security 3.pdf Spring Security 3.pdf Spring Security 3.pdf Spring Security 3.pdf
Spring Security3 中文开发文档
spring security spring security 中文文档
第一章:一个不安全应用的剖析 第二章:springsecurity起步 第三章:增强用户体验 第四章:凭证安全存储 第五章:精确的访问控制 第六章:高级配置和扩展 第七章:访问控制列表(ACL)...第十二章:spring Security扩展
iteye上搞过来的,翻译成中文的,资源还是挺不错的
Spring Security三份资料,实战Spring Security 3.x.pdf;Spring Security 3.pdf;Spring Security使用手册.pdf
SpringSecurity学习总结源代码
3、Spring Security 2.x Overview 4、Dive Into Spring Security Authentication Authorization 5、Development Experiences & Demo 6、Q & A 张明星 5年以上保险、电信大中型项目开发经验,对JavaEE有较深入理解...
SpringSecurity中文文档 2个 学习SpringSecurity必备
简单的 springSecurity3例子代码
Spring Security3 拦截 过滤器 安全,框架原理入门
struts2 + spring3 + hibernate3 + spring security3 + mysql + tomcat sys_users;sys_roles;sys_authorities;sys_resources;sys_users_roles;sys_roles_authorities;sys_authorities_resources; PS:此项目运行不...
即使用一个基于Spring3的web工程作为基础,以理解使用Spring Security3使其保证安全的概念和策略。 不管你是不是已经使用Spring Security还是只是对这个软件有兴趣,就都会在本书中得到有用的信息。
即使用一个基于Spring3的web工程作为基础,以理解使用Spring Security3使其保证安全的概念和策略。 不管你是不是已经使用Spring Security还是只是对这个软件有兴趣,就都会在本书中得到有用的信息。 在本节的内容中,你...
Spring_Security-3.0.1_中文官方文档(翻译版).pdf
Spring Security in Action
应用中涉及到安全认证,目前项目有独立的统一认证网关,所以登录时只需要将安全认证网关的认证后信息塞到spring security中,由security3来管理用户的权限设置。目前项目由spring security2升级到spring security3。...
官方文档 chm中文版 + 权限管理手册 chm中文版 + springsecurity3x + 教程