Spring下用Acegi的配置文件实例
来源:互联网 发布:mysql登录失败限制 编辑:程序博客网 时间:2024/05/20 01:47
Spring下用Acegi的配置文件实例:一个简单但齐全的配置实例,所有参数都写在xml文件里,以后会贴出使用Hibernate调用数据库中用户身份、权限参数的例子。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- 过滤器代理bean,代理其它过滤器-->
<bean name="filterBean" class="org.acegisecurity.util.FilterChainProxy" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
<property name="filterInvocationDefinitionSource">
<value>
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT
/**=authentFilter,exceptionTranslationFilter,securityInterceptor
</value>
</property>
</bean>
<!-- 认证管理器-->
<bean id="aManager" class="org.acegisecurity.providers.ProviderManager" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
<property name="providers">
<list>
<ref bean="daoAProvider" />
<bean class="org.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider">
<property name="key" value="changeThis"/>
</bean>
</list>
</property>
</bean>
<!-- 认证提供者,从数据库获得-->
<bean id="daoAProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
<property name="userDetailsService">
<ref bean="memoryUser"/>
</property>
</bean>
<!-- 内存DAO数据,存放用户信息,暂时,测试用-->
<bean id="memoryUser" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
<property name="userMap">
<value>
chun2000=chun2000,ROLE_SUPERVISION
abc=abc,ROLE_USER</value>
</property>
</bean>
<!-- 访问决策管理器-->
<bean id="accessDecisionManager" class="org.acegisecurity.vote.UnanimousBased" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
<property name="decisionVoters">
<list>
<ref bean="roleVoter" />
</list>
</property>
</bean>
<!-- 投票决策-->
<bean id="roleVoter" class="org.acegisecurity.vote.RoleVoter" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default"></bean>
<!-- 安全拦截过滤器-->
<bean id="securityInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
<property name="objectDefinitionSource">
<value>
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT
/do/*=ROLE_SUPERVISION
/show.jsp=ROLE_USER
</value>
</property>
<property name="authenticationManager">
<ref bean="aManager" />
</property>
<property name="accessDecisionManager">
<ref bean="accessDecisionManager"/>
</property>
</bean>
<!-- 记住我服务-->
<bean id="rembermeService" class="org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
<property name="userDetailsService">
<ref bean="memoryUser"/>
</property>
<property name="key">
<value>Can be change</value>
</property>
</bean>
<!-- 基于表单的身份验证过滤器-->
<bean id="authentFilter" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
<property name="filterProcessesUrl">
<value>/j_acegi_security_check</value>
</property>
<property name="defaultTargetUrl">
<value>/do/showStudent</value>
</property>
<property name="authenticationManager">
<ref bean="aManager" />
</property>
<property name="authenticationFailureUrl">
<value>/MyJsp.jsp</value>
</property>
<property name="rememberMeServices">
<ref bean="rembermeService" />
</property>
</bean>
<!-- 身份验证认证入口点-->
<bean id="authenticationProcessingFilterEntryPoint" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
<property name="loginFormUrl">
<value>/MyJsp.jsp</value>
</property>
<property name="forceHttps">
<value type="boolean">false</value>
</property>
</bean>
<!-- 异常过滤器 -->
<bean id="exceptionTranslationFilter" class="org.acegisecurity.ui.ExceptionTranslationFilter" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
<property name="accessDeniedHandler">
<bean class="org.acegisecurity.ui.AccessDeniedHandlerImpl" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
<property name="errorPage">
<value>/AccessDenied.jsp</value>
</property>
</bean>
</property>
<property name="authenticationEntryPoint">
<ref bean="authenticationProcessingFilterEntryPoint"/>
</property>
</bean>
</beans>
- Spring下用Acegi的配置文件实例
- 解读acegi的配置文件
- Spring的配置文件实例
- Spring的配置文件实例
- Spring的配置文件实例
- Spring的配置文件实例
- Acegi Security -- Spring下最优秀的安全系统
- Acegi Security -- Spring下最优秀的安全系统
- Acegi Security -- Spring下最优秀的安全系统
- Acegi Security -- Spring下最优秀的安全系统(zhuan)
- Acegi Security -- Spring下最优秀的安全系统
- acegi配置文件
- Spring Acegi Security实例解析一
- Spring Acegi Security实例解析二
- Spring Acegi Security实例解析三
- 用Acegi为你的Spring应用加把锁!
- 用Acegi为你的Spring应用加把锁!
- 用Acegi为你的Spring应用加把锁!
- 在WAS v5.x中编译一个大的JSP文件时,出现编译中断
- 在java中调用windows命令
- Java异常处理
- 如何改变iframe的滚动条样式?
- WAS传输大文件时出现“413 Request Entity Too Large”的错误
- Spring下用Acegi的配置文件实例
- webwork中实现扩展用例方案1
- 同一机器上不同应用服务器之间的Session问题
- 创建文件夹,用系统日期命名。
- castor使用
- Java中异常机制的研究
- 符合web标准的弹出菜单集(div+css+js)
- 用Remoting 实现一个文件传输组件
- C#面向对象的设计模式 抽象工厂模式