Spring Security Azure Active Directory - PullRequest
       12

Spring Security Azure Active Directory

0 голосов
/ 12 сентября 2018

Подскажите, пожалуйста, как увеличить время ожидания. Я получаю ниже исключения, и это происходит не каждый раз. Я использую Angular 5 в качестве внешнего интерфейса и внутреннего интерфейса с помощью Spring Boot 2.0.4 и Azure Active Directory версии 2.0.5 (последняя версия).

com.nimbusds.jose.RemoteKeySourceException: не удалось получить удаленный набор JWK: истекло время ожидания. Ниже приведен мой исходный код.

Спасибо заранее.

    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.context.annotation.Bean;
    import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
    import org.springframework.security.config.annotation.web.builders.HttpSecurity;
    import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
    import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
    import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
    import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
    import org.springframework.web.servlet.config.annotation.CorsRegistry;
    import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

    import com.microsoft.azure.spring.autoconfigure.aad.AADAuthenticationFilter;

    @EnableWebSecurity
    @EnableGlobalMethodSecurity(securedEnabled = true,prePostEnabled = true)
    public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private AADAuthenticationFilter aadAuthFilter;


    @Override
    protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/api/ppo/dashboard/dashboardstats").permitAll();


 http.authorizeRequests().antMatchers("/api/ppo/dashboard/castats").permitAll();
     http.authorizeRequests().antMatchers("/api/ppo/authenticate/privileges").permitAll();
     http.authorizeRequests().antMatchers("/api/ppo/**").authenticated();
    //http.authorizeRequests().antMatchers("/api/ppo/autenticate/**").permitAll();

    http.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
        .logoutSuccessUrl("/").deleteCookies("JSESSIONID").invalidateHttpSession(true);

    //http.authorizeRequests().anyRequest().permitAll();
    http.csrf().disable();
     http.cors();
    // http.csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse());

    http.addFilterBefore(aadAuthFilter, UsernamePasswordAuthenticationFilter.class);

}
@Bean
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurer() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/api/ppo/**").allowedMethods("GET", "POST", "PUT", "DELETE").allowedOrigins("*")
                    .allowedHeaders("*");
        }
    };
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...