zoukankan      html  css  js  c++  java
  • 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
         *     }
  • 相关阅读:
    CRM4.0多组织安装和设置
    如何找回你的VirtualPC2007控制台
    线性表
    时间复杂度
    栈与队列
    字符串排序问题
    浙江企业网喜讯之一
    初次体验到C#范型的魅力
    ajax 或 js 异步判断用户名是否存在
    html基础知识1(基本标签)20170307
  • 原文地址:https://www.cnblogs.com/HezhenbinGoGo/p/13268614.html
Copyright © 2011-2022 走看看