您的位置:首页 > 其它

如何高效的阅读论文--思维导图

2014-12-29 14:41 281 查看
 web.xml

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/context/applicationContext.xml,/WEB-INF/context/applicationContext-security.xml
</param-value>
</context-param>
<!-- Spring Security2 配置DelegatingFilterProxy -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>
org.springframework.web.filter.DelegatingFilterProxy
</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<listener>
<listener-class>org.springframework.security.ui.session.HttpSessionEventPublisher</listener-class>
</listener>

 

applicationContext-security.xml 

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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.4.xsd"> 
<!--
url过滤是按照顺序执行的,所以最前面的是最想先过滤的
1.form-login 指定了登陆界面,如果没具体指定,spring security将用自身的登陆界面,default-target-url: 登录成功后转到那个页面
2.http-basic 加载系列默认的过滤器
3.logout 加载离开过滤器, logout-success-url: 登出成功跳转到的页面(跳转)
4.max-sessions="1": 一个用户第二次登陆时,第一次失效
5.exception-if-maximum-exceeded="true": 防止第二次登陆
6. access-denied-page: 该用户无权限时转到指定页面(转向)
-->
<http access-denied-page="/AccessDenied.html">
<intercept-url pattern="/Login.jsp*" 	filters="none" />
<intercept-url pattern="/User/**" 		access="ROLE_ADMIN" />
<intercept-url pattern="/user*" 		access="ROLE_ADMIN" />
<intercept-url pattern="/Article/**" 	access="ROLE_ADMIN,ROLE_USER" />
<intercept-url pattern="/art*" 			access="ROLE_ADMIN,ROLE_USER" />
<intercept-url pattern="/**" 			access="ROLE_ADMIN,ROLE_USER" />

<form-login login-page="/Login.jsp" 	default-target-url="/Success.html"/>
<logout logout-success-url="/Login.jsp"/>
<http-basic/>
<concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="true"/>

</http>

<!-- 认证供应商 -->
<authentication-provider>
<password-encoder hash="plaintext"/>
<user-service>
<user name="admin" password="admin" authorities="ROLE_ADMIN" />
<user name="zhangsan" password="zhangsan" authorities="ROLE_USER" />
</user-service>
</authentication-provider>

</beans:beans>

 Login.jsp

<form name="f" action="j_spring_security_check" method="POST">
<table>
<tr>
<td>用户名:</td>
<td><input type="text" name="j_username" /></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="j_password" /></td>
</tr>
<tr>
<td><input type="checkbox" name="_spring_security_remember_me"></td>
<td>两周之内不用输入密码</td>
</tr>
<tr><td colspan="2"><input name="submit" type="submit" value="登 录"></td></tr>
<tr><td colspan="2"><input name="reset" type="reset" value="重 置"></td></tr>
</table>
</form>

 现在想更深入的学习,网上的资料没合适的。

想实现的功能

1. 当用户登录时,用户名和密码要与数据库中的对应,然后存到session里,以备用。

2.管理员可以给 用户分配和取消权限,不像上面是固定的。

3.听说还要写的什么类?UserDetailsServiceImp?

最近,天天到网上搜索,有的打着spring security2 或acegi2.x的旗号,其配置那是相当的繁琐(估计是1.x的,骗人),而且相关的代码和类都没展现全,对我这菜鸟级的感到很迷茫。希望高手们能献出自己的完整小例子,倡导资源共享。能帮上忙的尽管来吧。谢谢!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: