[英]Integrating Angular 5 App and Spring boot. Spring security blocks the app
I have added the built angular app to the static folder under resources. 我已将构建的角度应用程序添加到资源下的静态文件夹中。 when i go to
localhost:8080
, the app is not shown. 当我转到
localhost:8080
,未显示该应用程序。 How do i configure spring security to allow only the angular 5 app through. 我如何配置弹簧安全性以仅允许angular 5应用程序通过。
My Http configuration: 我的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();
You have following: 您有以下内容:
.anyRequest().authenticated();
So accessing http://localhost:8080
which is the root will be blocked by Spring Security if you are not logged in. 因此,如果您未登录,则访问Spring会阻止访问根目录
http://localhost:8080
。
Try logging in adding following line. 尝试登录添加以下行。
.antMatchers("/**").permitAll()
The above line must be only for testing. 上面的行只能用于测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.