【发布时间】:2018-10-31 21:42:33
【问题描述】:
我已将构建的 Angular 应用程序添加到资源下的静态文件夹中。当我转到localhost:8080 时,该应用程序未显示。如何配置 Spring Security 以仅允许 Angular 5 应用程序通过。
我的Http配置:
http
.cors()
.and()
.csrf()
.disable()
.exceptionHandling()
.authenticationEntryPoint(unauthorizedHandler)
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers("/auth/**").permitAll()
.antMatchers("/h2-console/**").permitAll()
.antMatchers("/users/checkUsernameAvailability",
"/users/checkEmailAvailability")
.permitAll()
.anyRequest().authenticated();
【问题讨论】:
-
你得到什么回应?有任何错误消息或 HTTP 状态吗?您的日志中的消息是什么?
-
@dur 我收到 401 Not Authenticated 消息
标签: spring angular spring-boot spring-security