경로 /gateways
은 인증이 필요합니다.
/gateways
은 내가 /login
로 리디렉션하고 브라우저에서 액세스 다음과 같은 화면이 나타납니다 때 : angular2 응용 프로그램에서 액세스 할 수Spring 서버 설정에서 '인증 필요'팝업을 비활성화하는 방법은 무엇입니까?
/gateways
경우 다음과 같은 팝업이 나타납니다
스프링 보안 구성은 다음과 같습니다.
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private static String REALM="Authentication";
@Autowired
public void configureGlobalSecurity(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("cris").password("123").roles("ADMIN");
auth.inMemoryAuthentication().withUser("felix").password("felix123").roles("USER");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.httpBasic()
.and()
.csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.and()
.formLogin()
.and()
.authorizeRequests()
.antMatchers("/user", "/vehicles", "/signin", "/isautheticated").permitAll().anyRequest()
.authenticated();
}
// Access-Control-Allow-Origin header to be present
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**");
}
};
}
/* To allow Pre-flight [OPTIONS] request from browser */
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers(HttpMethod.OPTIONS, "/**");
}
어떻게 팝업을 비활성화 할 수 있습니까?
'HttpBasic'을 입력하지 않으면 로그인이 작동하지 않습니다. – Cristian