我已经将构建的angular应用程序添加到资源下的静态文件夹中。当我转到localhost:8080
时,应用程序没有显示。我如何配置spring安全,只允许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();
发布于 2018-05-22 15:47:53
您拥有以下内容:
.anyRequest().authenticated();
因此,如果您没有登录,Spring Security将阻止对根目录http://localhost:8080
的访问。
尝试登录并添加以下行。
.antMatchers("/**").permitAll()
以上代码行必须仅用于测试。
https://stackoverflow.com/questions/50462303
复制相似问题