@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配置文件的更多相关文章

  1. spring4.2.3+mybatis+spring-security配置文件

    1.web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi=&qu ...

  2. spring-security 配置文件

    转自:spring-security学习笔记--配置文件 <?xml version="1.0" encoding="UTF-8"?> <be ...

  3. 【JavaWeb】Spring+SpringMVC+MyBatis+SpringSecurity+EhCache+JCaptcha 完整Web基础框架(五)

    SpringSecurity(2) 好久没有写了,之前只写了一半,我是一边开发一边写Blog一边上班,所以真心没有那么多时间来维护Blog,项目已经开发到编写逻辑及页面部分了,框架基本上已经搭建好不会 ...

  4. SpringSecurity数据库中存储用户、角色、资源

    这几天项目中用到了SpringSecurity做登陆安全.所以在这写一下也许可以帮助一下其他人,自己也熟悉一下 SpringSecurity配置文件如下: <beans:beans xmlns= ...

  5. Spring Security 入门(1-6-1)Spring Security - 配置文件解析和访问请求处理

    1.在pom.xml中添加maven坐标 <dependency> <groupId>org.springframework.security</groupId> ...

  6. springsecurity的退出登陆

    登陆成功就有退出,退出的实质就是让session失效 要实现退出登录只需要在spring-security配置文件中在加一行代码就可以了 <!--退出登陆--> <security: ...

  7. springsecurity基于数据库验证用户

    之前的springsecurity程序都是将数据存放在内存中的,通过 <security:user-service> <security:user name="user&q ...

  8. SpringSecurity自定义登陆页面和跳转页面

    如果我们不用form-login说明登陆界面,springsecurity框架将自动为我们生成登陆界面 现在我们不想用自动生成的登陆界面了,而想使用自定义的漂亮的登陆界面 则需要使用<secur ...

  9. SpringSecurity入门例子及遇到的问题解决

    最近学习<Spring 实战>学习到了SpringSecurity,觉得书本上的例子过于复杂,而且不喜欢它基于java配置,更喜欢用xml文件进行配置 于是在极客学院网上学习,感觉挺不错的 ...

随机推荐

  1. PyQt(Python+Qt)学习随笔:工具箱(QToolBox)编程使用的步骤及示例代码

    老猿Python博文目录 专栏:使用PyQt开发图形界面Python应用 老猿Python博客地址 使用toolBox开发应用时,通过Designer设计ui界面时,只能在Designer中设计too ...

  2. PyQt(Python+Qt)学习随笔:什么是信号绑定(Unbound and Bound Signals)?

    老猿Python博文目录 专栏:使用PyQt开发图形界面Python应用 老猿Python博客地址 1.概述 信号的绑定是由在类的实例变量中第一次通过类实例的方式(即"self.信号&quo ...

  3. Fiddle重定向请求

    以当当网和淘宝网为例: 1.打开浏览器,在地址栏中输入www.dangdang.com,进入当当主页. 2.在规则编辑器中设置规则,将dangdang重定向至taobao,并打开规则. 3.再次刷新当 ...

  4. pandas 标签映射成数值的几种方法

    1. preprocessing.LabelEncoder() import pandas as pd from sklearn import preprocessing le = preproces ...

  5. python学生管理名片

    name=['刘备','关羽','张飞','赵云','马超'] print('名片管理系统1.0\n1.增加一个新的名片\n2.删除一个名片\n3.修改一个名片\n4.查找一个名片\n5.退出名片管理 ...

  6. 剑指offer二刷——数组专题——数字在升序数组中出现的次数

    题目描述 统计一个数字在升序数组中出现的次数. 我的想法 完整的解法我只想到了遍历数组然后依次统计,但这是不聪明的解法,而且没有利用上"升序数组"的这个条件. 题目标签有提醒可以用 ...

  7. 敏捷开发 | DSDM 在非 IT 领域也同样适用?

    动态系统开发方法(Dynamic Systems Development Method:DSDM)是在快速应用程序开发(RAD)方法的基础上改进的.作为敏捷方法论的一种,DSDM方法倡导以业务为核心, ...

  8. 恕我直言,你可能连 GitHub 搜索都不会用 - 如何精准搜索的神仙技巧

    大家好,我是你们的 前端章鱼猫,一个不喜欢喵.又不喜欢吃鱼的超级猫 ~ 今天给大家带来的是 在 GitHub 上如何精准搜索的神仙技巧. [前端GitHub:https://github.com/bi ...

  9. 1、MyCat入门

    1.Mycat简介 [1].Mycat是什么 Mycat 是数据库中间件 [2].why使用Mycat ①.Java与数据库紧耦合 ②.高访问量高并发对数据库的压力 ③.读写请求数据不一致 [3].数 ...

  10. linux下postgresql安装

    1.下载地址 https://www.enterprisedb.com/download-postgresql-binaries 2.创建用户并修改密码 [root@node01 ~]# userad ...