Authenticate against keystone API using Application Credential

464 views Asked by At

I can authenticate against the keystone API using the following code:

from keystoneauth1 import session
from keystoneauth1.identity import v3
from openstack import connection

auth = v3.Password(
        auth_url="http://localhost:5000/v3/",
        username="admin",
        password="secret",
        project_name="admin",
        user_domain_name="default",
        project_domain_name="default"
        )
session = keystone_session.Session(auth=auth)
keystone_connection = connection.Connection(session=session)

However, I am trying to use an application credential as mentioned here. It seems like there are three new parameters that I would need to pass to use an application credential(auth_type, application_credential_id, application_credential_secret).

Has anyone used an application credential to authenticate against the keystone API? If so, can you please give some examples? Thanks.

1

There are 1 answers

0
crypticgamer On

This is how authentication using an Application Credential works:

application_credential = v3.ApplicationCredentialMethod(
            application_credential_secret="application_credential_secret",
            application_credential_id="application_credential_id"
            )
        
auth = v3.Auth(auth_url="http://localhost:5000/v3/",
               auth_methods=[application_credential]
              )