SpringSecurity配置文件
@EnableWebSecurity
public class seccurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
//首页所有人可以访问,功能也只有对应有权限的人才能访问
http.authorizeRequests()
.antMatchers("/").permitAll()
.antMatchers("/templates下的文件夹/**表示所有文件").hasRole("")
.antMatchers("/templates下的文件夹/**表示所有文件").hasRole("");
//没有权限跳到登录页面,需要开启登录的页面
http.formLogin();
} }
官方的
protected void configure(HttpSecurity http) throws Exception {
* http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin()
* .usernameParameter("username") // default is username
* .passwordParameter("password") // default is password
* .loginPage("/authentication/login") // default is /login with an HTTP get
* .failureUrl("/authentication/login?failed") // default is /login?error
* .loginProcessingUrl("/authentication/login/process"); // default is /login
* // with an HTTP
* // post
* }
SpringSecurity配置文件的更多相关文章
- spring4.2.3+mybatis+spring-security配置文件
1.web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi=&qu ...
- spring-security 配置文件
转自:spring-security学习笔记--配置文件 <?xml version="1.0" encoding="UTF-8"?> <be ...
- 【JavaWeb】Spring+SpringMVC+MyBatis+SpringSecurity+EhCache+JCaptcha 完整Web基础框架(五)
SpringSecurity(2) 好久没有写了,之前只写了一半,我是一边开发一边写Blog一边上班,所以真心没有那么多时间来维护Blog,项目已经开发到编写逻辑及页面部分了,框架基本上已经搭建好不会 ...
- SpringSecurity数据库中存储用户、角色、资源
这几天项目中用到了SpringSecurity做登陆安全.所以在这写一下也许可以帮助一下其他人,自己也熟悉一下 SpringSecurity配置文件如下: <beans:beans xmlns= ...
- Spring Security 入门(1-6-1)Spring Security - 配置文件解析和访问请求处理
1.在pom.xml中添加maven坐标 <dependency> <groupId>org.springframework.security</groupId> ...
- springsecurity的退出登陆
登陆成功就有退出,退出的实质就是让session失效 要实现退出登录只需要在spring-security配置文件中在加一行代码就可以了 <!--退出登陆--> <security: ...
- springsecurity基于数据库验证用户
之前的springsecurity程序都是将数据存放在内存中的,通过 <security:user-service> <security:user name="user&q ...
- SpringSecurity自定义登陆页面和跳转页面
如果我们不用form-login说明登陆界面,springsecurity框架将自动为我们生成登陆界面 现在我们不想用自动生成的登陆界面了,而想使用自定义的漂亮的登陆界面 则需要使用<secur ...
- SpringSecurity入门例子及遇到的问题解决
最近学习<Spring 实战>学习到了SpringSecurity,觉得书本上的例子过于复杂,而且不喜欢它基于java配置,更喜欢用xml文件进行配置 于是在极客学院网上学习,感觉挺不错的 ...
随机推荐
- linux下gdb命令大全
感谢国内的ACM同行们的支持,今年应该会是难忘的一年,谢谢大家的帮助啦 gdb命令如下,记全!!!
- [BJDCTF 2nd]简单注入
[BJDCTF 2nd]简单注入 hint.txt出现了内容. 大概意思和国赛一道题相同. username处注入\来转义单引号,password处使用sql语句整数型注入. 例如: 传入admin\ ...
- windows+jenkins+iis 部署
1.安装jenkins 下载地址:https://www.jenkins.io/download/ 2.需要配置java环境 配置教程:https://www.cnblogs.com/liuxiaoj ...
- 查询时间倒退一天-项目中惊现神秘BUG-JsonFormat使用采坑记
一.问题由来 前一天下午正在写代码的时候,领导突然走过来跟我说,让我去看一个神秘的BUG,说是在数据库中查询时的一个日期 返回到页面后,查询时间倒退了一天.一听到这个BUG,我就感觉很奇怪,还有这样的 ...
- unity入门—五分钟制作一个理论上的游戏
unity入门 前言:这可不是标题党,虽然都是基础的操作,不过含括了基本的流程,比起脑海中的五花八门的画面,入门还是这个现实一点. 这里插两句,unity国外官网下载会推荐你看一个简短的视频,国内官网 ...
- Codeforces Round #631 (Div. 1) A-C
在 \(\text{Div. 2/3}\) 混了一个多月后,四个号终于都上紫了,也没用理由不打 \(\text{Div. 1}\) 了.这是我人生中的第一场 \(\text{Div .1}\) ,之前 ...
- AcWing 337. 扑克牌
大型补档计划 题目链接 把状态实质相同的划分为一类... 发现花色.具体牌值的多少均不影响方案,考虑等效转化题目. 设 \(f[A][B][C][D][k]\) A 个 1 张相同,B 个 2 张相同 ...
- 部署在GitHub的个人博客如何绑定个人域名
前提是已经搭建好了自己的个人博客 如果想要搭建自己的个人博客可以来我的个人博客学习呀 地址 购买域名 首先想要绑定域名,总归需要去购买一个属于自己的域名吧,我是在腾讯云上面购买的域名(不是广告) 在腾 ...
- STL——容器(deque) 元素的存取&迭代器
1. deque 的数据存取 这个部分和 vector 几乎一样 第一 使用下标操作 dequeName[0] = 100; //小心越界 第二 使用at 方法 如: dequeName.at(2 ...
- docker 连接MySQL·集群
1 指定端口 docker run -p 3307:3306 --name root -e MYSQL_ROOT_PASSWORD=root -d mysql # 6380 root password ...