该帖已经被评为精华帖
|
|
---|---|
作者 | 正文 |
发表时间:2010-01-21
surpass 写道 Araxis Merge 比较强的比较工具
多谢,我去尝试一下 |
|
返回顶楼 | |
发表时间:2010-01-21
最后修改:2010-01-21
首先感谢LZ,看到这篇文章我才开始学习Spring Security,提个问题:看到第十章(http://www.family168.com/oa/springsecurity/html/ch102-concurrent-session.html),找不到 10.1.里添加监听器里提到的这个类,
org.springframework.security.ui.session.HttpSessionEventPublisher,这个在哪个Jar文件中可以找到?谢谢!! 还有10.1下面给出的链接是个无效链接。 |
|
返回顶楼 | |
发表时间:2010-01-21
01404421 写道 首先感谢LZ,看到这篇文章我才开始学习Spring Security,提个问题:看到第十章(http://www.family168.com/oa/springsecurity/html/ch102-concurrent-session.html),找不到 10.1.里添加监听器里提到的这个类,
org.springframework.security.ui.session.HttpSessionEventPublisher,这个在哪个Jar文件中可以找到?谢谢!! 还有10.1下面给出的链接是个无效链接。 org.springframework.security.ui.session.HttpSessionEventPublisher在spring-security-core-2.0.5.RELEASE.jar中,我们写的文档是基于spring security-2.0.5而不是spring security-3.x。 spring security-3.x中包名都发生了变化,对应类名为: org.springframework.security.web.session.HttpSessionEventPublisher,在spring-security-3.0.1.RELEASE.jar中。 链接问题已修正,多谢指出问题。 |
|
返回顶楼 | |
发表时间:2010-01-25
xyz20003 写道 zhxing 写道 期待ptf 版。。。
用官方提供的maven配置尝试生成了一下pdf,失败了,不知道为何。 满江红现在也被封掉了。。。 ![]() 为什么满江红会被封啊 |
|
返回顶楼 | |
发表时间:2010-03-23
有CHM版的吗?
|
|
返回顶楼 | |
发表时间:2010-04-08
http://www.family168.com/oa/springsecurity/html/index.html
在上面的网址中,是基于2.0的教程,其中有关于“使用数据库管理资源”的章节。请问在3.0的条件下,是如何实现的啊。(包括配置文件)谢谢。参考代码如下: package com.family168.springsecuritybook.ch005; import java.sql.ResultSet; import java.sql.SQLException; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javax.sql.DataSource; import org.springframework.beans.factory.FactoryBean; import org.springframework.jdbc.core.support.JdbcDaoSupport; import org.springframework.jdbc.object.MappingSqlQuery; import org.springframework.security.ConfigAttributeDefinition; import org.springframework.security.ConfigAttributeEditor; import org.springframework.security.intercept.web.DefaultFilterInvocationDefinitionSource; import org.springframework.security.intercept.web.FilterInvocationDefinitionSource; import org.springframework.security.intercept.web.RequestKey; import org.springframework.security.util.AntUrlPathMatcher; import org.springframework.security.util.UrlMatcher; public class JdbcFilterInvocationDefinitionSourceFactoryBean extends JdbcDaoSupport implements FactoryBean { private String resourceQuery; public boolean isSingleton() { return true; } public Class getObjectType() { return FilterInvocationDefinitionSource.class; } public Object getObject() { return new DefaultFilterInvocationDefinitionSource(this .getUrlMatcher(), this.buildRequestMap()); } protected Map<String, String> findResources() { ResourceMapping resourceMapping = new ResourceMapping(getDataSource(), resourceQuery); Map<String, String> resourceMap = new LinkedHashMap<String, String>(); for (Resource resource : (List<Resource>) resourceMapping.execute()) { String url = resource.getUrl(); String role = resource.getRole(); if (resourceMap.containsKey(url)) { String value = resourceMap.get(url); resourceMap.put(url, value + "," + role); } else { resourceMap.put(url, role); } } return resourceMap; } protected LinkedHashMap<RequestKey, ConfigAttributeDefinition> buildRequestMap() { LinkedHashMap<RequestKey, ConfigAttributeDefinition> requestMap = null; requestMap = new LinkedHashMap<RequestKey, ConfigAttributeDefinition>(); ConfigAttributeEditor editor = new ConfigAttributeEditor(); Map<String, String> resourceMap = this.findResources(); for (Map.Entry<String, String> entry : resourceMap.entrySet()) { RequestKey key = new RequestKey(entry.getKey(), null); editor.setAsText(entry.getValue()); requestMap.put(key, (ConfigAttributeDefinition) editor.getValue()); } return requestMap; } protected UrlMatcher getUrlMatcher() { return new AntUrlPathMatcher(); } public void setResourceQuery(String resourceQuery) { this.resourceQuery = resourceQuery; } private class Resource { private String url; private String role; public Resource(String url, String role) { this.url = url; this.role = role; } public String getUrl() { return url; } public String getRole() { return role; } } private class ResourceMapping extends MappingSqlQuery { protected ResourceMapping(DataSource dataSource, String resourceQuery) { super(dataSource, resourceQuery); compile(); } protected Object mapRow(ResultSet rs, int rownum) throws SQLException { String url = rs.getString(1); String role = rs.getString(2); Resource resource = new Resource(url, role); return resource; } } } 配置文件: <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd"> <http auto-config="true"/> <authentication-provider> <jdbc-user-service data-source-ref="dataSource" users-by-username-query="select username,password,status as enabled from user where username=?" authorities-by-username-query="select u.username,r.name as authority from user u join user_role ur on u.id=ur.user_id join role r on r.id=ur.role_id where u.username=?"/> </authentication-provider> <beans:bean id="filterSecurityInterceptor" class="org.springframework.security.intercept.web.FilterSecurityInterceptor" autowire="byType"> <custom-filter before="FILTER_SECURITY_INTERCEPTOR" /> <beans:property name="objectDefinitionSource" ref="filterInvocationDefinitionSource" /> </beans:bean> <beans:bean id="filterInvocationDefinitionSource" class="com.family168.springsecuritybook.ch05.JdbcFilterInvocationDefinitionSourceFactoryBean"> <beans:property name="dataSource" ref="dataSource"/> <beans:property name="resourceQuery" value=" select re.res_string,r.name from role r join resc_role rr on r.id=rr.role_id join resc re on re.id=rr.resc_id order by re.priority "/> </beans:bean> <beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <beans:property name="driverClassName" value="org.hsqldb.jdbcDriver"/> <beans:property name="url" value="jdbc:hsqldb:res:/hsqldb/test"/> <beans:property name="username" value="sa"/> <beans:property name="password" value=""/> </beans:bean> </beans:beans> |
|
返回顶楼 | |
发表时间:2010-05-19
楼主更新的真快呀!也希望楼主能提供pdf或者chm版的!
|
|
返回顶楼 | |
发表时间:2010-05-30
临远大哥,谢谢你的贡献
|
|
返回顶楼 | |
发表时间:2010-06-10
只过用Spring Security2 ,3的版本还没有用过,近端时间有打算升级
|
|
返回顶楼 | |
发表时间:2010-06-10
有没有下载的chm或者其他可以在本地看的文件样式?
|
|
返回顶楼 | |