| Profilo di warsgrobeleogao的个人空间FotoBlogElenchi | Guida |
|
|
leogao的个人空间18 dicembre 忽然发现自己还是挺喜欢看些生活片的大片看多了,忽然觉得没什么内涵在里面,今天闲来无事,找了部生活片看了看,Must Love Dogs.也算是部爱情片,恩,不错,虽然我也不知道我领会到了什么,但是还是有些收获的. 30 novembre 基于Acegi 的Spring安全策略(二)---我的实践(五)ecache.xml<!-- edited with XMLSpy v2005 sp1 U (http://www.xmlspy.com) by any (Ru-Board) --> <ehcache> <diskStore path="/data/ehcache"/> <defaultCache maxElementsInMemory="10" eternal="false" timeToIdleSeconds="200" timeToLiveSeconds="400" overflowToDisk="true"/> <!--<cache name="com.sincetimes.service.QueryLogsManager" maxElementsInMemory="1000" eternal="false" timeToIdleSeconds="900" timeToLiveSeconds="3600" overflowToDisk="true" diskPersistent="false"/>--> </ehcache> 基于Acegi 的Spring安全策略(二)---我的实践(四)applicationContext-common-business.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <!--
- Application context containing business beans. - - Used by all artifacts. - - $Id: applicationContext-common-business.xml,v 1.2 2004/11/15 13:04:54 benalex Exp $ --> <beans>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource"><ref bean="dataSource"/></property> </bean> <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"><ref bean="transactionManager"/></property> <property name="transactionAttributeSource"> <value> cn.com.sincetimes.controler.MethodControler.list=PROPAGATION_REQUIRED cn.com.sincetimes.controler.MethodControler.check=PROPAGATION_REQUIRED </value> </property> </bean> <bean id="methodControllerAOP" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<!-- <property name="proxyInterfaces"><value>cn.com.sincetimes.controler.MethodControler</value></property> --> <property name="interceptorNames"> <list> <idref local="transactionInterceptor"/> <idref bean="methodsecurityInterceptor"/> <!--<idref bean="methodController"/> --> </list> </property> <property name="beanNames"> <list> <value>methodController</value> </list> </property> </bean> <bean id="paraMethodResolver" class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver"> <property name="paramName"> <value>method</value> </property> <property name="defaultMethodName"> <value>list</value> </property> </bean> <bean id="methodController" class="cn.com.sincetimes.controler.MethodControler"> <property name="methodNameResolver"> <ref bean="paraMethodResolver"/> </property> <property name="defaultView"> <value>methodshow</value> </property> <property name="output"> <value>this is the methodshow</value> </property> </bean> </beans> 基于Acegi 的Spring安全策略(二)---我的实践(三)applicationContext-acegi-security.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- ========================= CACHE DEFINITIONS ========================= --> <bean id="filterChainProxy" class="net.sf.acegisecurity.util.FilterChainProxy"> <property name="filterInvocationDefinitionSource"> <value> CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON PATTERN_TYPE_APACHE_ANT /**=httpSessionContextIntegrationFilter,authenticationProcessingFilter,securityEnforcementFilter </value> </property> </bean> <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"> <value>java:comp/env/jdbc/acegi</value> </property> </bean> <bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager"> <property name="providers"> <list> <ref bean="authenticationProvider"/> </list> </property> </bean> <bean id="authenticationProvider" class="net.sf.acegisecurity.providers.dao.DaoAuthenticationProvider"> <property name="authenticationDao"> <ref bean="authenticationDao"/> </property> <property name="userCache"> <ref bean="userCache"/> </property> <!-- --> </bean> <!-- <bean id="authenticationDao" class="net.sf.acegisecurity.providers.dao.jdbc.JdbcDaoImpl"> <property name="dataSource"> <ref bean="dataSource"/> </property> <property name="usersByUsernameQuery"> <value>select name,name,'true' from Users where name = ?</value> </property> <property name="authoritiesByUsernameQuery"> <value>select name, role from Users WHERE name = ?</value> </property> </bean> --> <bean id="authenticationDao" class="cn.com.sincetimes.util.acegi.JdbcDaoImpl"> <property name="dataSource"> <ref bean="dataSource"/> </property> <property name="usersByUsernameQuery"> <value>select name,name,enable from Users where name = ?</value> </property> <property name="authoritiesByUsernameQuery"> <value>select name,role,reward from Users WHERE name = ?</value> </property> <property name="roleMap"> <map> <entry key="0" value="ROLE_USER"> </entry> <entry key="300" value="ROLE_SUPER"> </entry> <entry key="3000" value="ROLE_ADMIN"> </entry> </map> </property> <!--<property name="roleDecisions"> <list> <list> <value>book</value> <value>score</value> <value>ROLE_ADMIN</value> </list> </list> </property> --> </bean> <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> <property name="configLocation"> <value>classpath:/ehcache.xml</value> </property> </bean> <bean id="userCacheBackend" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> <property name="cacheManager"> <ref local="cacheManager"/> </property> <property name="cacheName"> <value>userCache</value> </property> </bean> <bean id="userCache" class="net.sf.acegisecurity.providers.dao.cache.EhCacheBasedUserCache"> <property name="cache"><ref local="userCacheBackend"/></property> </bean> <bean id="accessDecisionManager" class="net.sf.acegisecurity.vote.ConsensusBased">
<property name="decisionVoters"> <list> <ref bean="roleVoter"/> </list> </property> </bean> <bean id="roleVoter" class="net.sf.acegisecurity.vote.RoleVoter"> <property name="rolePrefix"> <value>ROLE_</value> </property> </bean> <!--filter--> <bean id="securityInterceptor" class="net.sf.acegisecurity.intercept.web.FilterSecurityInterceptor"> <property name="authenticationManager"> <ref bean="authenticationManager"/> </property> <property name="accessDecisionManager"> <ref bean="accessDecisionManager"/> </property> <property name="objectDefinitionSource"> <value> CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON \A/secure/secret.jsp.*\Z=ROLE_ADMIN \A/secure/.*\Z=ROLE_SUPER,ROLE_ADMIN \A/jsp/.*\Z=ROLE_USER <!-- \A/method.spr.*\Z=ROLE_ADMIN --> </value> </property> </bean> <bean id="authenticationEntryPoint" class="net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint"> <property name="loginFormUrl"> <value>/NoPrivilage.jsp</value> </property> <property name="forceHttps"> <value>false</value> </property> </bean> <bean id="securityEnforcementFilter" class="net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter"> <property name="filterSecurityInterceptor"> <ref bean="securityInterceptor"/> </property> <property name="authenticationEntryPoint"> <ref bean="authenticationEntryPoint"/> </property> </bean> <!-- <bean id="authenticationProcessingFilter" class="net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilter"> <property name="filterProcessesUrl"> <value>/j_acegi_security_check</value> </property> <property name="authenticationFailureUrl"> <value>/login.jsp?failed=true</value> </property> <property name="defaultTargetUrl"> <value>/</value> </property> <property name="authenticationManager"> <ref bean="authenticationManager"/> </property> </bean> --> <!-- ======================== SITEMINDER AUTHENTICATION PROCESSING FILTER======================= --> <bean id="authenticationProcessingFilter" class="net.sf.acegisecurity.ui.webapp.SiteminderAuthenticationProcessingFilter"> <property name="authenticationManager"><ref bean="authenticationManager"/></property> <property name="authenticationFailureUrl"><value>/login.jsp?login_error=1</value></property> <property name="defaultTargetUrl"><value>/</value></property> <property name="filterProcessesUrl"><value>/j_acegi_security_check</value></property> <property name="siteminderUsernameHeaderKey"><value>SM_USER</value></property> <property name="siteminderPasswordHeaderKey"><value>SM_USER</value></property> <property name="formUsernameParameterKey"><value>j_username</value></property> <property name="formPasswordParameterKey"><value>j_password</value></property> </bean> <bean id="httpSessionContextIntegrationFilter" class="net.sf.acegisecurity.context.HttpSessionContextIntegrationFilter"> <property name="context"> <value>net.sf.acegisecurity.context.SecurityContextImpl</value> </property> </bean> <!--for method security can be comment out wher using just url--> <!-- <bean id="autoproxy" class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/> <bean id="methodSecurityAdvisor" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodDefinitionSourceAdvisor" autowire="constructor"/> --> <bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="interceptorNames"> <list> <value>methodsecurityInterceptor</value> </list> </property> <property name="beanNames"> <list> <value>methodController</value> </list> </property> </bean> <bean id="methodsecurityInterceptor" class="net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor"> <property name="authenticationManager"> <ref bean="authenticationManager"/> </property> <property name="accessDecisionManager"> <ref bean="accessDecisionManager"/> </property> <property name="objectDefinitionSource"> <value> cn.com.sincetimes.controler.MethodControler.list=ROLE_USER cn.com.sincetimes.controler.MethodControler.check=ROLE_ADMIN </value> </property> </bean> </beans> 基于Acegi 的Spring安全策略(二)---我的实践(二)action-servlet.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> <property name="basename"> <value>/WEB-INF/classes/application</value> </property> <property name="cacheSeconds"> <value>1</value> </property> </bean> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass"> <value>org.springframework.web.servlet.view.JstlView</value> </property> <property name="prefix"> <value>/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="exceptionMappings"> <props> <prop key="java.lang.Exception">exception</prop> </props> </property> </bean> <!--<bean id="paraMethodResolver" class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver"> <property name="paramName"> <value>method</value> </property> <property name="defaultMethodName"> <value>list</value> </property> </bean> --> <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="/method.spr">methodControllerAOP</prop> </props> </property> </bean> <!--add by gb 2005 1111
<bean id="methodController" class="cn.com.sincetimes.controler.MethodControler">
<property name="methodNameResolver"> <ref local="paraMethodResolver"/> </property> <property name="defaultView"> <value>methodshow</value> </property> <property name="output"> <value>this is the methodshow</value> </property> </bean>--> <!--===========================================================================--> </beans> |
|
||||
|
|