- 浏览: 7960017 次
- 性别:
- 来自: 广州
-
文章分类
- 全部博客 (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 1602方法1: 三个线程,t1,t2,t3,如果一定要按顺序执行, ... -
(转)不错的前后端处理异常的方法
2019-01-02 23:16 2027前言 在 Web 开发中, 我们经常会需要处理各种异常, 这是 ... -
info q的极客时间大咖说等资料下载
2018-08-15 08:40 3484info q的极客时间大咖说等资料下载,还有不少思维导图 链 ... -
CXF 客户端超时时间设置(非Spring配置方式)
2018-07-03 22:38 2248import org.apache.cxf.endpoint. ... -
(转)synchronized关键字画像:正确打开方式
2018-06-14 09:25 501https://mp.weixin.qq.com/s/b3Sx ... -
CountDownLatch的例子
2018-06-13 14:10 700public class StatsDemo { ... -
两道面试题,带你解析Java类加载机制
2018-06-12 16:29 626https://mp.weixin.qq.com/s/YTa0 ... -
Spring中获取request的几种方法,及其线程安全性分析
2018-06-11 09:03 679https://mp.weixin.qq.com/s/KeFJ ... -
内部类小结
2018-06-06 10:25 445https://mp.weixin.qq.com/s/hErv ... -
JVM虚拟机小结1
2018-06-04 20:43 5571 jps -l //列出详细的类名和进程ID 2)jps ... -
windows下自带命令行工具查看CPU资源情况等
2018-06-04 12:53 3114微软提供了不少命令行 ... -
(收藏)深入分析Java的序列化与反序列化
2018-05-30 15:21 628https://mp.weixin.qq.com/s/T2Bn ... -
apache common包中的序列化工具
2018-05-30 09:10 1851什么是序列化 我们的 ... -
JAVA8 JVM的变化: 元空间(Metaspace)
2018-05-24 22:30 974本文将会分享至今为至我收集的关于永久代(Permanent G ... -
(转)服务器性能指标(一)——负载(Load)分析及问题排查
2018-05-21 21:03 1384原创: Hollis Hollis 负载 ... -
(转)对象复用
2018-05-20 15:27 874public class Student { priv ... -
mapreduce中入门中要注意的几点
2018-05-06 08:59 680在 mapreduce中,比如有如下的词: I love b ... -
HDFS的基本操作
2018-05-02 21:47 948-mkdir 在HDFS创建目录 ... -
一个不错的开源工具类,专门用来解析日志头部的,好用
2018-05-02 20:00 778一个不错的开源工具类,专门用来解析日志头部的,好用。 http ... -
介绍个不错的RESTFUL MOCK的工具wiremock
2018-04-27 21:02 1915介绍个不错的RESTFUL MOCK的工具wiremock,地 ...
相关推荐
Spring Security3是Spring框架中的一个模块,它提供了全面的安全服务,旨在为Web和非Web应用程序提供访问控制、认证、授权等功能。Spring Security3通过其强大的配置能力和丰富的特性,帮助开发者构建安全的应用程序...
总结起来,"springSecurityTest.zip"文件提供了一个完整的环境,让你可以动手实践Spring Security的基础用法。通过学习其中的代码、笔记和文档,你将理解Spring Security如何与Spring框架协同工作,如何设置认证和...
3. 如果认证成功,Spring Security创建一个`Authentication`对象并存储在Security Context中。 4. 接下来的请求会被安全拦截器检查,判断用户是否有访问资源的权限。 ### 4. 权限控制 Spring Security使用访问决策...
在提供的压缩包中,可能包含了Spring Security的基本配置、自定义登录页面、权限控制等示例代码,你可以参考这些代码了解Spring Security的具体用法。 总之,Spring Security 是一个强大而灵活的框架,它提供了一...
### Spring Security 安全...以上是对《Spring+Security+安全权限管理手册》中部分章节的知识点总结。通过学习这些内容,开发者可以深入了解Spring Security的各种特性和应用场景,从而更好地构建安全可靠的应用程序。
总结,"spring-security-helloworld-annotation"项目是一个很好的起点,它展示了Spring Security如何通过注解实现Web应用的安全控制。通过理解和实践这个示例,开发者可以快速掌握Spring Security的基本用法,进而为...
Spring Security是一个强大的安全框架,用于保护Spring应用免受各种安全威胁。它可以实现认证(Authentication)、授权(Authorization)等功能,同时支持OAuth2和其他安全协议。 【Spring Cloud】 Spring Cloud是...
《深入理解Spring Security 4.2.3:基于实战项目“demo-security”》 Spring Security是Java领域中广泛使用...这个实战项目不仅有助于学习Spring Security的基本用法,还能帮助开发者提升在实际项目中的安全防护能力。
随着时间的发展,Spring 不断进化,增加了更多高级功能和模块,如Spring MVC、Spring Security等。目前最新的版本为6.0.8-SNAPSHOT,这个版本引入了许多新的特性和改进,进一步增强了框架的功能性和灵活性。 ##### ...
3. 在Spring Security中配置用户、角色和权限,实现认证和授权。 4. 在Action、Service或DAO层中使用Spring Security的注解进行权限控制。 5. 实现具体的业务逻辑,使用JPA操作数据库。 **总结** Struts2、Spring...
Spring ACEGI是Spring Security的前身,它是一个强大的、高度可配置的安全框架,专为Java企业级应用设计。这个框架旨在提供全面的身份验证、授权和服务层安全功能,允许开发者轻松地在Spring应用中实现复杂的安全...
下面将从几个方面来总结和解释Spring 2.0的主要知识点。 ### 一、Spring框架概述 Spring框架是一个开源的Java平台,它为开发企业级应用提供了一种简洁的方式。Spring的核心特性包括依赖注入(Dependency Injection...
3. **Web MVC增强**:Spring的MVC框架在4.2.1版本中进行了优化,如支持WebSocket、RESTful API设计,以及更强大的数据绑定和验证功能。同时,模板引擎的集成也更加完善,如FreeMarker、Thymeleaf等。 4. **数据访问...
- **定义与作用**:Spring 是一个开源的轻量级 Java 开发框架,它主要的目标是解决企业级应用开发中的复杂性问题。Spring 提供了全面的基础架构支持,简化了开发过程。 - **特点**:非侵入式设计、可测试性强、...
Spring Boot 是一个由 Pivotal Team 开发的 Java 框架,旨在简化Spring应用程序的初始设置和日常开发。它提供了预配置的依赖项、自动配置功能以及内嵌的HTTP服务器,如Tomcat或Jetty,让开发者可以快速地创建独立...
本教程将引导初学者逐步掌握Spring的核心概念和基本用法,帮助你快速上手并投入实际项目开发。 一、Spring概述 Spring框架是由Rod Johnson创建的,旨在简化企业级Java应用的开发。它提供了一个全面的基础设施,涵盖...
Acegi Security是一个已退役的安全框架,它在Java社区中曾被广泛使用,特别是在Spring框架的早期版本中。这个"acegi-security-1.0.7-osgi.jar.zip"压缩包包含的是Acegi Security 1.0.7版本,适配于OSGi(Open ...
Spring Security(原名Acegi)在2.5.4中提供了一套全面的安全管理框架,涵盖了认证、授权、会话管理等多个方面,帮助开发者构建安全的应用。 总结来说,Spring Framework 2.5.4是一个强大且成熟的版本,它在依赖...
- **教程示例**:通过一个简单的示例项目,演示Spring Security的基本用法及其主要功能。 - **联系人管理应用**:详细介绍如何在实际的应用场景中使用Spring Security实现用户管理、权限控制等功能。 #### 四、社区...
**Spring In Action(Third Edition)** 这本书主要介绍了 **Spring 3.0** 的新特性和用法,同时也涵盖了 **Spring Security 2.0** 和 **Spring WebFlow 2.0** 的相关内容。下面我们将根据提供的部分目录来详细分析书...