Я пытаюсь войти в Redhat docker реестр, но он не работает с ошибкой ниже
{
"errors": [{
"code" : "UNAUTHORIZED",
"message" : "Please login to the Red Hat Registry
using your Customer Portal credentials.
Further instructions can be found here:
https://access.redhat.com/articles/3399531",
"detail": [] }]
}
Это код, который я запускаю: -
public void sendPostRequestWithAuthorizationUsingHttpClient() throws IOException, AuthenticationException {
final CloseableHttpClient client = HttpClients.createDefault();
final HttpGet httpPost = new HttpGet("https://sso.redhat.com/auth/realms/rhcc/protocol/redhat-docker-v2/auth?service=docker-registry&client_id=curl&scope=repository:rhel:pull");
final UsernamePasswordCredentials creds = new UsernamePasswordCredentials("username", "password");
httpPost.addHeader(new BasicScheme().authenticate(creds, httpPost, null));
final CloseableHttpResponse response = client.execute(httpPost);
String body = EntityUtils.toString(response.getEntity());
System.out.println("=====>" + body);
client.close();
}
Но тот же URL, когда я выполняю, используя curl с тем же именем пользователя и паролем, он работает нормально
sudo curl -Lv -u username:password "https://sso.redhat.com/auth/realms/rhcc/protocol/redhat-docker-v2/auth?service=docker-registry&client_id=curl&scope=repository:rhel:pull"