Проблемы с внедрением диспетчера нестандартной аутентификации - PullRequest
0 голосов
/ 03 декабря 2018

Я пытаюсь использовать собственный менеджер аутентификации, но стандартный менеджер провайдеров вызывается для .authenticate.Я подозреваю, что это как-то связано с AuthSever или Web Config.Любая помощь очень ценится.

Конфигурация AuthServer:

@Configuration
@EnableAuthorizationServer
public class AuthServerConfig extends AuthorizationServerConfigurerAdapter {

@Autowired
private final DataSource dataSource;

@Autowired
public AuthServerConfig(DataSource dataSource){
    this.dataSource = dataSource;
}

@Autowired
MicrosJwtConfig microsJwtConfig;


@Autowired
@Qualifier("microsProviderManager")
AuthenticationManager authenticationManager;


public BCryptPasswordEncoder encoder(){
    return new BCryptPasswordEncoder(10);
}

@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
    clients.jdbc(dataSource);
}


@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) {
    endpoints
            .tokenServices(microsJwtConfig.microsTokenServices())
            .authenticationManager(authenticationManager);
}

@Override
public void configure(AuthorizationServerSecurityConfigurer security) {
    security.allowFormAuthenticationForClients();
    security.passwordEncoder(encoder());
    security.tokenKeyAccess("permitAll()");
}
}

Конфигурация WebSecurity:

@EnableWebSecurity
@Configuration
public class WebSecConfig extends WebSecurityConfigurerAdapter {

@Autowired
private ClientDetailsService clientDetailsService;
@Autowired
private MECAuthenticationProvider mecAuthenticationProvider;

@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return new MicrosProviderManager(clientDetailsService, mecAuthenticationProvider );
}

@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .authorizeRequests().antMatchers("actuator/health").permitAll().and()
            .authorizeRequests().antMatchers("oauth/token").permitAll().and()
            .authorizeRequests().antMatchers("actuator/info").permitAll();
}
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...