【发布时间】:2019-02-19 18:41:22
【问题描述】:
我有一个 Angular 应用程序作为 Spring Boot 应用程序的静态内容提供。角度应用程序位于 spring boot 应用程序的 target/classes/static/index.html 内。我还有一个从 spring boot 提供的 rest api,它需要启用基本身份验证。我已将我的安全配置配置如下
@Configuration
@EnableWebSecurity
public class SecrityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private AuthenticationEntryPoint authEntryPoint;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("john123").password("password").roles("USER");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests()
.anyRequest().authenticated()
.and().httpBasic()
.authenticationEntryPoint(authEntryPoint);
}}
基本身份验证对其余端点按预期工作。但是当我尝试从 localhost:8080/springbootappname/ 加载角度应用程序时,它会提示凭据。当我提供已配置的凭据时,正在加载 Angular 应用程序。
所以,我需要帮助禁用正在解压缩到 classes/static/ 中的 Angular 应用程序的基本身份验证
【问题讨论】:
标签: spring angular spring-boot spring-security