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文件进行配置 于是在极客学院网上学习,感觉挺不错的 ...
随机推荐
- moviepy音视频剪辑:视频剪辑基类VideoClip的__init__构造方法参数has_constant_size的作用
☞ ░ 前往老猿Python博文目录 ░ moviepy音视频剪辑模块的视频剪辑基类VideoClip构造方法: __init__(self, make_frame=None, ismask=Fals ...
- 初识Flask——基于python的web框架
参考教程链接: https://dormousehole.readthedocs.io/en/latest/ (主要)https://www.w3cschool.cn/flask/ 目录: 1.写了一 ...
- WordCount个人项目
1.GitHub地址:https://github.com/lyh27/WordCount 2.题目描述 Word Count1. 实现一个简单而完整的软件工具(源程序特征统计程序).2. 进行单元测 ...
- 【JVM】类加载器与双亲委派
类加载器,顾名思义,即是实现类加载的功能模块,负责将Class的字节码形式加载成内存形式的Class对象.字节码文件可来源于磁盘或者jar包中的Class文件,也可以来自网络字节流. 类加载器 在JV ...
- AtCoder Grand Contest 017 (VP)
contest link Official Editorial 比赛体验--之前做题的时候感觉 AtCoder 挺快的,现在打了VP之后发现还是会挂的--而且不是加载缓慢或者载不出来,直接给你一个无法 ...
- eureka配置说明
以下配置来源于jar中的源码,采用标准两个空格作为缩进 eureka.yml spring: application: name: APPLICATION_NAME # 应用名,在eureka上注册为 ...
- Linux 上安装 mysql
1.通过 yum 命令安装 mysql 可以先通过 yum list |grep mysql 方式查看有哪些版本的 mysql 2.安装 mysql yum install mysql-server ...
- python 使用UUID库生成唯一ID
首先导包: import uuid uuid1(): # make a UUID based on the host ID and current time # 基于MAC地址,时间 ...
- sqli-labs less32-37(宽字节注入)
less-32 Bypass addslashes() less-33 Bypass addslashes() less-34 Bypass Add SLASHES less-35 addslashe ...
- 使用uniapp开发项目来的几点心得体会,供新手参考参考
先说一下提前须要会的技术 要想快速入手uniapp的话,你最好提前学会vue.微信小程序开发,因为它几乎就是这两个东西的结合体,不然,你就只有慢慢研究吧. 为什么要选择uniapp??? 开发多个平台 ...