[英]Spring Boot + Security configuration for communication with Angular app
[英]Integrating Angular 5 App and Spring boot. Spring security blocks the app
我已将构建的角度应用程序添加到资源下的静态文件夹中。 当我转到localhost:8080
,未显示该应用程序。 我如何配置弹簧安全性以仅允许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();
您有以下内容:
.anyRequest().authenticated();
因此,如果您未登录,则访问Spring会阻止访问根目录http://localhost:8080
。
尝试登录添加以下行。
.antMatchers("/**").permitAll()
上面的行只能用于测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.