美文网首页
拦截器拦截路径写法分析

拦截器拦截路径写法分析

作者: 自由主义者 | 来源:发表于2019-10-18 13:59 被阅读0次

.antMatchers( "/api/","/xhh/user/","/user/**")说明

如果写成" /user/ ",只能识别/user一层
如果写成" /user/* ",只能识别两层
如果写成” /user/** ",可以识别很多层

 @Override
    protected void configure(HttpSecurity http) throws Exception {
        //TODO: 方便开发使用POSTMAN调试
        http.httpBasic();
        //必须放在super前面
        http.authorizeRequests()
            //.antMatchers("/userinfo")
            //.permitAll()
            .antMatchers( "/api/**","/xhh/user/**","/user/**")
            .permitAll();
        super.configure(http);
        http.authorizeRequests().anyRequest().authenticated()
            .and()
            .rememberMe()
            .and()
            .sessionManagement().invalidSessionStrategy(new AjaxInvalidSessionStrategy())
            .and()
            .logout().logoutUrl(properties.getLogoutUrl())
            .logoutSuccessHandler(logoutSuccessHandler).permitAll();
        http.exceptionHandling()
            .authenticationEntryPoint(new AjaxEntryPoint())
            .accessDeniedHandler(accessDeniedHandler);
    }

相关文章

网友评论

      本文标题:拦截器拦截路径写法分析

      本文链接:https://www.haomeiwen.com/subject/klpimctx.html