我正在配置Security中的端点访问。我想要做的是:
下面是我的配置,它满足了两个需求,并防止了未登录用户访问/logout。
http.authorizeRequests()
.antMatchers("/register").permitAll()
.antMatchers("/register/*").permitAll()
.antMatchers("/favicon.ico").permitAll()
.antMatchers("**/*.html").permitAll()
.antMatchers("**/*.css").permitAll()
.antMatchers("**/*.js").permitAll()
.and()
.formLogin().loginPage("/login").failureUrl("/login-error").defaultSuccessUrl("/")
.usernameParameter("username").passwordParameter("password")
.and()
.logout().logoutSuccessUrl("/login").deleteCookies("JSESSIONID").logoutUrl("/logout");发布于 2017-05-29 06:37:42
要确保对应用程序的请求需要对用户进行身份验证,请使用.anyRequest().authenticated()
https://stackoverflow.com/questions/42935208
复制相似问题