Предоставляется client_id, secret, grant _type, username и password в теле вместе с basi c auth, но получение 401 несанкционированного - PullRequest
0 голосов
/ 22 апреля 2020

Я создаю базовый c сервер аутентификации и предоставил следующее в файле application.properties

server.port=9000
server.servlet.context-path=/services
security.oauth2.client.client-id=oauth2client
security.oauth2.client.client-secret=oauth2secret
security.oauth2.client.authorized-grant- 
types=authorization_code,refresh_token,password,client_credentials
security.oauth2.client.scope=read,report

, а класс конфигурации выглядит следующим образом: @Configuration publi c Класс ServiceConfig расширяет GlobalAuthenticationConfigurerAdapter {

@Override
public void init(AuthenticationManagerBuilder auth) throws Exception {
    auth.inMemoryAuthentication()
    .withUser("user1").password("{noop}pass1").roles("USER").and()
    .withUser("user2").password("{noop}pass2").roles("USER","ADMIN");

}

}

Теперь, когда я пытаюсь получить токен oauth2 с помощью запроса POST oauth / token, я получаю 401 несанкционированный. Я предоставил идентификатор клиента и секрет в качестве basi c auth в POSTMAN, а идентификатор клиента, пароль, пользователь, grant_type в теле запроса. Любое решение?

...