Java 使用spring security时,如何允许任何用户访问资源而不必通过配置的过滤器?
我的登录/身份验证逻辑基于jhipster并实现了记住我的过滤器。我希望允许所有用户(无需身份验证)访问配置端点/configuration。这样做的正确方法似乎是在过滤器链中添加以下内容:Java 使用spring security时,如何允许任何用户访问资源而不必通过配置的过滤器?,java,spring,jhipster,Java,Spring,Jhipster,我的登录/身份验证逻辑基于jhipster并实现了记住我的过滤器。我希望允许所有用户(无需身份验证)访问配置端点/configuration。这样做的正确方法似乎是在过滤器链中添加以下内容: protected void configure(HttpSecurity http) throws Exception { http .csrf() .and() .addFilterAfter(new CsrfCookieG
protected void configure(HttpSecurity http) throws Exception {
http
.csrf()
.and()
.addFilterAfter(new CsrfCookieGeneratorFilter(), CsrfFilter.class)
.exceptionHandling()
.authenticationEntryPoint(authenticationEntryPoint)
.and()
.addFilterBefore(new SimpleCORSFilter(), ChannelProcessingFilter.class)
.exceptionHandling()
.and()
.rememberMe()
.rememberMeServices(rememberMeServices)
.rememberMeParameter("remember-me")
.key(securityRememberMeKey)
.and()
.formLogin()
.loginProcessingUrl("/api/v1/authentication")
.successHandler(ajaxAuthenticationSuccessHandler)
.failureHandler(ajaxAuthenticationFailureHandler)
.usernameParameter("some")
.passwordParameter("some")
.permitAll()
.and()
.logout()
.logoutUrl("/api/v1/logout")
.logoutSuccessHandler(ajaxLogoutSuccessHandler)
.deleteCookies("JSESSIONID")
.permitAll()
.and()
.authorizeRequests()
.antMatchers("/api/v1/configuration").permitAll()
.antMatchers("/api/v1/generalEvent*").permitAll()
.antMatchers("/api/v1/account").permitAll()
.antMatchers("/api/v1/register").permitAll()
.antMatchers("/api/v1/activate").permitAll()
.antMatchers("/api/v1/authenticate").permitAll()
.antMatchers("/api/v1/account/reset_password/init").permitAll()
.antMatchers("/api/v1/account/reset_password/finish").permitAll()
.anyRequest().authenticated();
}
可以看到,/configuration端点具有permitAll(),它允许用户在不进行身份验证的情况下获取配置,但仍将调用memberme筛选器,这是一个不希望出现的结果。有没有办法避免“记住我”过滤器