Переход на Spring Boot (Security) 2 из 1.x - PullRequest
0 голосов
/ 10 марта 2020

В текущем переходе проекта с Spring boot 1.X на 2.0.9 я столкнулся с трудностью с модулем Spring Security. На первом этапе мне нужно изменить свойства для доступа к источникам данных (на jdb c -url), и теперь эта часть работает нормально, но теперь модуль безопасности, похоже, неправильно подключен.

Итак, в свойствах я попытался добавить следующее: spring.security.user.name=admin spring.security.user.password=secret Но даже если я прокомментирую это или откажусь от этого, у меня будет тот же результат, когда я вызываю веб-сервисы, диалоговое окно запрашивает запрашивая учетные данные:

enter image description here Конфигурация аутентификации следующая:

class OAuth2Configuration extends AuthorizationServerConfigurerAdapter {

    @Configuration
    @EnableAuthorizationServer // [1]
    @EnableGlobalMethodSecurity(prePostEnabled = true)
    @EnableWebSecurity
    protected static class OAuth2Config extends AuthorizationServerConfigurerAdapter {

        @Autowired
        private TokenStore tokenStore;

        @Autowired
        private DataSource oauthDataSource;

        @Autowired
        private PhrqlAuthenticationManager phrqlAuthenticationManager;


        /**
         * Config clientDetail storage
         * @param endpoints
         * @throws Exception
         */
        @Override
        public void configure(AuthorizationServerEndpointsConfigurer endpoints)
                throws Exception {
            endpoints.authenticationManager(phrqlAuthenticationManager);
            endpoints.tokenStore(tokenStore);
            //          endpoints.tokenStore(tokenStore).pathMapping("/oauth/token", "/p/oauth/token");

        }


        @Override // [3]
        public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
            clients.jdbc(oauthDataSource);
        } 

    }

По некоторым причинам, я думаю, что автоконфигурация не обращается к имя-пароль, поэтому клиент запрашивает учетные данные. Любая помощь будет высоко ценится. Заранее спасибо!

...