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
         *     }
  • 相关阅读:
    template(2.2)
    Filter过滤链条
    The 3n + 1 problem
    Struts2.3+Spring4.0
    康托展开
    templates(2.1)
    templates(1.2)
    templates(1.1)
    我和你
    Android 的上下文菜单: Context Menu
  • 原文地址:https://www.cnblogs.com/HezhenbinGoGo/p/13268614.html
Copyright © 2011-2022 走看看