appfuse 2.0 框架怎么做两个不同的登陆页面

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

<?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
...全文
102 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
亦弄 2011-04-27
  • 打赏
  • 举报
回复
你贴出来的是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把你自己的账号存入数据库就好了。

yuanjun_xf 2011-04-25
  • 打赏
  • 举报
回复
谢谢兄台!
wzjmjx 2010-09-19
  • 打赏
  • 举报
回复
顶下 没学过

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧