现因项目需要用spring security管理权限,想请教应如何配置,需要配置哪些信息啊?
权限管理的数据结构为,users(用户)、roles(角色\组)、resources(资源),角色和用户多对多、角色和资源多对多
以下代码是项目经理的初期配置(CAS的),如何改成本地的呢?
望高人指点一下啊!急! <beans:bean id="loggerListener"
class="org.springframework.security.event.authentication.LoggerListener" /> <http access-denied-page="/403.jsp"
entry-point-ref="casProcessingFilterEntryPoint">
<intercept-url pattern="/manage/system/**" access="ROLE_ADMIN" />
<intercept-url pattern="/static/**" filters="none" />
<intercept-url pattern="/template/**" filters="none" />
<intercept-url pattern="/" filters="none" />
<intercept-url pattern="/goManage.action?myUrl=login"
filters="none" />
<form-login login-page="/goManage.action?myUrl=login"
authentication-failure-url="/goManage.action?myUrl=login&amp;error=true"
default-target-url="/" />
<logout logout-success-url="/goManage.action?myUrl=login" />
<http-basic />
</http> <authentication-manager alias="authenticationManager" /> <authentication-provider user-service-ref="securityManager">
<password-encoder hash="md5" />
</authentication-provider> <beans:bean id="accessDecisionManager"
class="org.springframework.security.vote.AffirmativeBased">
<beans:property name="allowIfAllAbstainDecisions" value="false" />
<beans:property name="decisionVoters">
<beans:list>
<beans:bean
class="org.springframework.security.vote.RoleVoter" />
<beans:bean
class="org.springframework.security.vote.AuthenticatedVoter" />
</beans:list>
</beans:property>
</beans:bean> <beans:bean id="resourceSecurityInterceptor"
class="org.springframework.security.intercept.web.FilterSecurityInterceptor">
<beans:property name="authenticationManager"
ref="authenticationManager" />
<beans:property name="accessDecisionManager"
ref="accessDecisionManager" />
<beans:property name="objectDefinitionSource"
ref="secureResourceFilterInvocationDefinitionSource" />
<beans:property name="observeOncePerRequest" value="false" />
<custom-filter after="LAST" />
</beans:bean> <beans:bean id="secureResourceFilterInvocationDefinitionSource"
class="cn.crazyasp.common.rights.role.SecureResourceFilterInvocationDefinitionSource" />
<beans:bean id="securityManager"
class="cn.crazyasp.common.rights.role.SecurityManager">
<beans:property name="option" ref="tableoption" />
</beans:bean> <!-- cas information -->
<beans:bean id="casProcessingFilter"
class="org.springframework.security.ui.cas.CasProcessingFilter">
<custom-filter after="CAS_PROCESSING_FILTER" />
<beans:property name="authenticationManager"
ref="authenticationManager" />
<beans:property name="authenticationFailureUrl"
value="/casfailed.jsp" />
<beans:property name="defaultTargetUrl" value="/" />
</beans:bean> <beans:bean id="casProcessingFilterEntryPoint"
class="org.springframework.security.ui.cas.CasProcessingFilterEntryPoint">
<beans:property name="loginUrl"
value="http://sso.crazysns.cn/login" />
<beans:property name="serviceProperties"
ref="casServiceProperties" />
</beans:bean> <beans:bean id="casServiceProperties"
class="org.springframework.security.ui.cas.ServiceProperties">
<beans:property name="service"
value="http://localhost:8080/hr/j_spring_cas_security_check" />
<beans:property name="sendRenew" value="false" />
</beans:bean> <beans:bean id="casAuthenticationProvider"
class="org.springframework.security.providers.cas.CasAuthenticationProvider">
<custom-authentication-provider />
<!-- user control with db -->
<beans:property name="userDetailsService" ref="userControl" />
<beans:property name="serviceProperties"
ref="casServiceProperties" />
<beans:property name="ticketValidator">
<beans:bean
class="org.jasig.cas.client.validation.Cas20ServiceTicketValidator">
<beans:constructor-arg index="0"
value="http://127.0.0.1:8080/hr" />
</beans:bean>
</beans:property>
<beans:property name="key" value="crazysns" />
</beans:bean>
userControl是相关DAO,http://127.0.0.1:8080/hr是项目的本地测试网址。

解决方案 »

  1.   

    我的QQ:523975404
    MSN:[email protected]
    Email:[email protected]
      

  2.   

    应该需要改动loginUrl去本地的CAS地址。
    <beans:bean id="casProcessingFilterEntryPoint"
            class="org.springframework.security.ui.cas.CasProcessingFilterEntryPoint">
            <beans:property name="loginUrl"
                value="http://sso.crazysns.cn/login" />
            <beans:property name="serviceProperties"
                ref="casServiceProperties" />
        </beans:bean>
      

  3.   

    org.springframework.security.intercept.web.FilterSecurityInterceptor 更改这个的实现,不要使用CAS的登录过滤器和认证过滤器对你的请求进行过滤,而是使用你自己的过滤器,然后你自己的认证做在这个过滤器里面。
      

  4.   

    是本地建一个CAS,然后连到本地CAS登录界面。
      

  5.   

    不确定楼主改成本地配置是什么意思,是换成本地的CAS还是在本地直接登录(不使用CAS).
    如果是要使用本地CAS,那么需要先建立本地CAS服务器,然后修改CAS登录地址信息
    <beans:bean id="casProcessingFilterEntryPoint"
            class="org.springframework.security.ui.cas.CasProcessingFilterEntryPoint">
            <beans:property name="loginUrl"
                value="http://sso.crazysns.cn/login" />
            <beans:property name="serviceProperties"
                ref="casServiceProperties" />
        </beans:bean>如果不用CAS,去掉http中的
    entry-point-ref="casProcessingFilterEntryPoint"
    就可以了
      

  6.   

    项目经理说要把cas的改成本地的,其它不用改,可我不知道如何改啊?
      

  7.   


    过滤器拦截器什么的,项目经理已经建好了。
    另外,除了去掉
    entry-point-ref="casProcessingFilterEntryPoint"外,其他的还用改吗?
      

  8.   

    这位大哥,能否留个QQ或MSN啊?
      

  9.   

    楼上各位高人,能否留个QQ或MSN,小弟想进一步请教下啊?可否?