• springSecurity5 重定向登录页面后 报错:尝试清除 Cookie.net::ERR_TOO_MANY_REDIRECTS status:200


    springSecurity5 使用:

    http.formLogin().loginPage("/login");
    报错如下图:

    springsucurity5 中 需要给 自己定义的请求加权限:

    失败代码如下:

    public class MySecurityConfig extends WebSecurityConfigurerAdapter {
        @Override
        protected void configure(HttpSecurity http) throws Exception {
    //定制请求的授权规则
            http.authorizeRequests().antMatchers("/").permitAll()
                    .antMatchers("/manage/**").hasRole("manage")
                    .antMatchers("/view/**").hasRole("view")
                    .antMatchers("/db/**").hasRole("db").anyRequest().authenticated();
            http.formLogin().loginPage("/login");

    修正后代码如下:

    public class MySecurityConfig extends WebSecurityConfigurerAdapter {
        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http.authorizeRequests().antMatchers("/").permitAll()
                    .antMatchers("/login").permitAll()
                    .antMatchers("/manage/**").hasRole("manage")
                    .antMatchers("/view/**").hasRole("view")
                    .antMatchers("/db/**").hasRole("db").anyRequest().authenticated();
    //http.formLogin();
            http.formLogin().loginPage("/login");
  • 相关阅读:
    南阳779
    南阳599
    南阳484
    margin叠加相邻两个元素的上下margin是叠加在一起
    margin
    padding
    css05 字体以及行间距
    mysql相似于oracle的to_char() to_date()方法
    sqlite两表更新update
    SQL查找重复项目
  • 原文地址:https://www.cnblogs.com/belen87/p/12004004.html
Copyright © 2020-2023  润新知