Я попытался разработать простую весеннюю загрузку и Oauth с использованием Spring boot2.1.4 и Oauth2, я разработал несколько примеров программ в Интернете, в которых есть клиент Oauth и сервер авторизации, проблема в том, где я получаю приведенную ниже ошибку при обращении к клиенту наlocalhost: 8082 /
<oauth>
<error_description>
Full authentication is required to access this resource
</error_description>
<error>unauthorized</error>
</oauth>
Я упомянул здесь несколько упрощенных вопросов, но не нашел решения своей проблемы.
Вот как определяется клиент WebSecurity
Открытый класс @Configuration SecurityConfiguration расширяет WebSecurityConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http.antMatcher("/**").authorizeRequests()
.antMatchers("/", "/login**").permitAll()
.anyRequest().authenticated()
.and()
.oauth2Login();
}
Вот свойства приложения, определенные в application.yml
spring:
thymeleaf:
cache: false
security:
oauth2:
client:
registration:
custom-client:
client-id: R2dpxQ3vPrtfgF72
client-secret: fDw7Mpkk5czHNuSRtmhGmAGL42CaxQB9
client-name: Auth Server
scope: user_info
provider: custom-provider
redirect-uri: http://localhost:8082/login/oauth2/code/
client-authentication-method: basic
authorization-grant-type: authorization_code
provider:
custom-provider:
token-uri: http://localhost:8081/auth/oauth/token
authorization-uri: http://localhost:8081/auth/oauth/authorize
user-info-uri: http://localhost:8081/auth/user/me
user-name-attribute: name
Я ожидаю попадания на страницу индекса (index.html), которая имеетссылка для входа в систему.
но фактический результат, который получается при доступе к localhost: 8082 / это
<oauth>
<error_description>
Full authentication is required to access this resource
</error_description>
<error>unauthorized</error>
</oauth>