当前位置:网站首页> 原创 Acegi 1.03 安全机制
原创 Acegi 1.03 安全机制
2022-07-30 05:44:00 【victorkevin】
xml 代码
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
- <beans>
- <!-- Acegi security-->
- <!-- FilterChainProxy -->
- <!--注意:配置时要按业务要求排定过滤链处理的顺序-->
- <bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy">
- <property name="filterInvocationDefinitionSource">
- <value>
- CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
- PATTERN_TYPE_APACHE_ANT
- /**=httpSessionContextIntegrationFilter,authenticationProcessingFilter,securityContextHolderAwareRequestFilter,remeberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterSecurityInterceptor
- </value>
- </property>
- </bean>
- <!-- Channel Servlet 过滤器 -->
- <bean id="channelProcessingFilter" class="org.acegisecurity.securechannel.ChannelProcessingFilter">
- <property name="channelDecisionManager">
- <ref bean="channelDecisionManager"/>
- </property>
- <property name="filterInvocationDefinitionSource">
- <value>
- CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
- PATTERN_TYPE_APACHE_ANT
- /usersjsp/**=REQUIRES_INSECURE_CHANNEL
- /*.do=REQUIRES_INSECURE_CHANNEL
- /*=REQUIRES_INSECURE_CHANNEL
- </value>
- </property>
- </bean>
- <bean id="channelDecisionManager" class="org.acegisecurity.securechannel.ChannelDecisionManagerImpl">
- <property name="channelProcessors">
- <list>
- <ref bean="secureChannelProcessor"/>
- <ref bean="insecureChannelProcessor"/>
- </list>
- </property>
- </bean>
- <bean id="secureChannelProcessor" class="org.acegisecurity.securechannel.SecureChannelProcessor"></bean>
- <bean id="insecureChannelProcessor" class="org.acegisecurity.securechannel.InsecureChannelProcessor"/>
- <!-- LogOut Filter -->
- <!-- SecurityContextHolderAwareRequestFilter 过滤器 -->
- <bean id="securityContextHolderAwareRequestFilter" class="org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter">
- </bean>
- <!-- ExceptionTranslationFilter 过滤器 -->
- <bean id="exceptionTranslationFilter" class="org.acegisecurity.ui.ExceptionTranslationFilter">
- <property name="authenticationEntryPoint">
- <ref local="authenticationProcessingFilterEntryPoint"/>
- </property>
- <property name="accessDeniedHandler">
- <bean class="org.acegisecurity.ui.AccessDeniedHandlerImpl">
- <property name="errorPage" value="/ErrorJSP/accessDenied.jsp"/>
- </bean>
- </property>
- </bean>
- <bean id="authenticationProcessingFilterEntryPoint" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
- <property name="loginFormUrl"><value>/security/SecurityLogin.jsp?error=2</value></property>
- <property name="forceHttps"><value>false</value></property>
- </bean>
- <!-- Authenication Process Filter 过滤器 -->
- <bean id="authenticationProcessingFilter" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter">
- <property name="filterProcessesUrl">
- <value>/security/j_acegi_security_check</value>
- </property>
- <property name="authenticationManager">
- <ref local="authenticationManager"/>
- </property>
- <property name="defaultTargetUrl">
- <value>/forumShow.do</value>
- </property>
- <property name="authenticationFailureUrl">
- <value>/security/SecurityLogin.jsp?error=1</value>
- </property>
- <property name="rememberMeServices">
- <ref local="rememberMeServices"/>
- </property>
- </bean>
- <!-- DAO authentication Provider -->
- <bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
- <property name="userDetailsService"><ref local="userDetailsService"/></property>
- </bean>
- <!-- In memory DAO Implmention -->
- <bean id="userDetailsService" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
- <property name="userMap">
- <value>
- victor=1234,ROLE_SUPERVISOR
- kevin=1234,ROLE_USER
- </value>
- </property>
- </bean>
- <!-- Concurrent Session Controller -->
- <bean id="concurrentSessionController" class="org.acegisecurity.concurrent.ConcurrentSessionControllerImpl">
- <property name="maximumSessions"><value>1</value></property>
- <property name="sessionRegistry">
- <bean class="org.acegisecurity.concurrent.SessionRegistryImpl"></bean>
- </property>
- </bean>
- <!-- HttpSession Integration Filter-->
- <bean id="httpSessionContextIntegrationFilter" class="org.acegisecurity.context.HttpSessionContextIntegrationFilter">
- </bean>
- <!-- 过滤安全拦截器 -->
- <bean id="filterSecurityInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
- <property name="authenticationManager">
- <ref local="authenticationManager"/>
- </property>
- <property name="accessDecisionManager">
- <ref local="accessDecisionManager"/>
- </property>
- <property name="objectDefinitionSource">
- <value>
- CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
- PATTERN_TYPE_APACHE_ANT
- /security/securitylogin.jsp=ROLE_ANONYMOUS,ROLE_SUPERVISOR
- /forumshow.do=ROLE_ANONYMOUS,ROLE_SUPERVISOR,ROLE_USER
- /viewjsp/index.jsp=ROLE_ANONYMOUS,ROLE_SUPERVISOR,ROLE_USER
- /**=ROLE_SUPERVISOR,ROLE_ANONYMOUS
- </value>
- </property>
- </bean>
- <!--================== Access decision Manager ======================-->
- <bean id="accessDecisionManager" class="org.acegisecurity.vote.AffirmativeBased">
- <property name="decisionVoters">
- <list>
- <ref bean="roleVoter"/>
- </list>
- </property>
- <property name="allowIfAllAbstainDecisions">
- <value>false</value>
- </property>
- </bean>
- <!-- Role voter -->
- <bean id="roleVoter" class="org.acegisecurity.vote.RoleVoter"></bean>
- <!-- Authenication Manager -->
- <bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager">
- <property name="providers">
- <list>
- <ref local="daoAuthenticationProvider"/>
- <bean class="org.acegisecurity.providers.anonymous.AnonymousAuthenticationProvider">
- <property name="key" value="changeThis"></property>
- </bean>
- <bean class="org.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider">
- <property name="key">
- <value>victorOK</value>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- <!-- Remember me Process Filter -->
- <bean id="remeberMeProcessingFilter" class="org.acegisecurity.ui.rememberme.RememberMeProcessingFilter">
- <property name="authenticationManager">
- <ref local="authenticationManager"/>
- </property>
- <property name="rememberMeServices">
- <ref local="rememberMeServices"/>
- </property>
- </bean>
- <bean id="rememberMeServices" class="org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices">
- <property name="userDetailsService">
- <ref local="userDetailsService"/>
- </property>
- <property name="key">
- <value>victor</value>
- </property>
- </bean>
- <!-- 密码 编码器 -->
- <bean id="passwordEncoder" class="org.acegisecurity.providers.encoding.Md5PasswordEncoder"></bean>
- <!-- 登录事件监听器 -->
- <bean id="loggerListener" class="org.acegisecurity.event.authentication.LoggerListener"></bean>
- <!-- 匿名 过滤器 -->
- <bean id="anonymousProcessingFilter" class="org.acegisecurity.providers.anonymous.AnonymousProcessingFilter">
- <property name="key">
- <value>victorOK</value>
- </property>
- <property name="userAttribute">
- <value>anonymousUser,ROLE_ANONYMOUS</value>
- </property>
- </bean>
- </beans>
边栏推荐
- 十一、Kotlin进阶学习:1、集合;2、List操作;3、可变集合——MutableList;4、Set;5、Map;6、MutableMap;
- Using PyQt5 to add an interface to YoloV5 (1)
- Jdbc & Mysql timeout analysis
- GraphQL(一)基础介绍及应用示例
- Pytorch(二):数据读取机制(DataLoader、DataSet)与图像预处理模块(transforms)
- The most powerful and most commonly used SQL statements in history
- Xcode 绑定按钮点击事件
- 二十一、Kotlin进阶学习:实现简单的网络访问封装
- [Ten years of network security engineers finishing] - 100 penetration testing tools introduction
- 十四、Kotlin进阶学习:一、内联函数 inline;二、泛型;三、泛型约束;四、子类与子类型;
猜你喜欢
随机推荐
The most powerful and most commonly used SQL statements in history
Awd summary
JVM Learning (2) Garbage Collector
【零基础搞定C语言——导航汇总篇】
工厂模式(Swift 实现)
FastAPI 快速入门
Arthas 命令解析(jvm/thread/stack/heapdump)
Kotlin协程的简单用法:1、GlobalScope(不建议使用);2、lifecycleScope、viewModelScope(建议使用);
"MySQL Advanced Chapter" four, the storage structure of the index
MySQL data types and footprint
[MATLAB]图像处理——交通标志的识别
Redis 客户端常见异常分析
sqli-labs shooting range SQL injection learning Less-1
学生成绩管理系统(C语言版)
利用自定义注解,统计方法执行时间
TDengineGUI无法连接TDengine
MySQL 5.7 安装教程(全步骤、保姆级教程)
在不同的服务器上基于docker部署redis主从同步
C语言实战小项目(传统卡牌游戏)
MySQL开窗函数







