There was a problem using openstack4j for domain level authentication

21 views Asked by At

Now using the openstack4j development package to develop our OpenStack application, we need to log in to OpenStack as admin, authentication at the Domain level, failed. Now the user admin is in the project admin and is in the admin role. However, when I developed with Java using a server under the LAN, I got an error. The code looks like this:

    @Test
    public void list_projects(){
        OSClient.OSClientV3 os = OSFactory.builderV3()
                .endpoint("http://10.2.10.1:5000/v3")
                .credentials("admin","openstack2023", Identifier.byId("default"))
                .scopeToDomain(Identifier.byId("default"))
                .authenticate();
 
        System.out.println(os.identity().projects().list());
 
    }

There is nothing wrong with http://10.2.10.1:5000/v3. I can actually access the Dashboard using the Dashboard. Besides, the user name and password are also guaranteed to be correct. Domain information is as follows:

[root@openstack ~(keystone_admin)]# openstack domain list 
+----------------------------------+---------+---------+--------------------+
| ID                               | Name    | Enabled | Description        |
+----------------------------------+---------+---------+--------------------+
| 1397d0590ccc481385442a73aadddc1d | heat    | True    |                    |
| default                          | Default | True    | The default domain |
+----------------------------------+---------+---------+--------------------+
[root@openstack ~(keystone_admin)]# 

Code error content:

AuthenticationException{message=Unauthorized
, status=401}
    at org.openstack4j.core.transport.HttpExceptionHandler.mapException(HttpExceptionHandler.java:36)
    at org.openstack4j.core.transport.HttpExceptionHandler.mapException(HttpExceptionHandler.java:23)
    at org.openstack4j.openstack.internal.OSAuthenticator.authenticateV3(OSAuthenticator.java:191)
    at org.openstack4j.openstack.internal.OSAuthenticator.invoke(OSAuthenticator.java:74)
    at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:172)
    at org.openstack4j.openstack.client.OSClientBuilder$ClientV3.authenticate(OSClientBuilder.java:129)
    at cloud.computer.backend.LowLevelAPITest.list_projects(LowLevelAPITest.java:37)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

Therefore, we hope that with the correct user name and password, we can still log in to OpenStack using openstack4j for domain-scoped authentication. Thank you for your time and any help would be appreciated.

0

There are 0 answers