日期:2014-05-19  浏览次数:20650 次

appfuse 2.0 框架怎么做两个不同的登陆页面
我现在用APPFUSE框架做项目,前台有一个会员登录。后台有管理员的登陆,由于appfuse用的是spring 
spring-security-2.0.1 自己对于这个配置不是很懂,希望有经验的前辈指点下,谢谢
配置如下:需要更多,我可以都贴出来。急帮忙解决,谢谢!
XML code

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:beans="http://www.springframework.org/schema/beans"
             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.1.xsd">

    <http auto-config="true" lowercase-comparisons="false">
        <!--intercept-url pattern="/images/*" filters="none"/>
        <intercept-url pattern="/styles/*" filters="none"/>
        <intercept-url pattern="/scripts/*" filters="none"/-->
        <intercept-url pattern="/system.html" access="ROLE_ADMIN"/>
        <intercept-url pattern="/system/*" access="ROLE_ADMIN"/>
        <intercept-url pattern="/admin/*" access="ROLE_ADMIN"/>
        <intercept-url pattern="/member/*" access="ROLE_ADMIN,ROLE_USER"/>
        <intercept-url pattern="/passwordHint.html*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
        <intercept-url pattern="/signup.html*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
        <intercept-url pattern="/a4j.res/*.html*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
        <!-- APF-737, OK to remove line below if you're not using JSF -->
        <intercept-url pattern="/**/*.html*" access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
        
        <form-login login-page="/login.jsp" authentication-failure-url="/login.jsp?error=true" login-processing-url="/j_security_check"/>
        <remember-me user-service-ref="userDao" key="e37f4b31-0c45-11dd-bd0b-0800200c9a66"/>
    </http>

    <authentication-provider user-service-ref="userDao">
        <password-encoder ref="passwordEncoder"/>
    </authentication-provider>

    <!-- Override the default password-encoder (SHA) by uncommenting the following and changing the class -->
    <!-- <bean id="passwordEncoder" class="org.springframework.security.providers.encoding.ShaPasswordEncoder"/> -->

    <global-method-security>
        <protect-pointcut expression="execution(* *..service.UserManager.getUsers(..))" access="ROLE_ADMIN"/>
        <protect-pointcut expression="execution(* *..service.UserManager.removeUser(..))" access="ROLE_ADMIN"/>
    </global-method-security>
</beans:beans>




APPFUSE 2.0

------解决方案--------------------
顶下 没学过
------解决方案--------------------
你贴出来的是security.xml配置,这类配好了URL的pattern的访问权限,即pattern和role之间的对应关系。这里定义了3种role: ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER。

你可以直接使用AppFuse内置的管理员账号admin用于后端,对于前端若你想自己创建一个一般用户,只要在AppFuse里,在src/test/resources/sample-data.xml中,照着里面user账号,自己写一个一般用户表记录,再配好role表的对应关系,再运行mvn clean package,让maven把你自己的账号存入数据库就好了。