Skip to content

identity: add OIDC client credentials authentication - #3942

Open
rm-you wants to merge 3 commits into
gophercloud:mainfrom
rm-you:feat/oidc-client-credentials
Open

identity: add OIDC client credentials authentication#3942
rm-you wants to merge 3 commits into
gophercloud:mainfrom
rm-you:feat/oidc-client-credentials

Conversation

@rm-you

@rm-you rm-you commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #3283

Adds Identity v3 authentication using the OpenID Connect client-credentials grant. It obtains an access token from an explicitly configured or discovered token endpoint, exchanges it for an unscoped Keystone token through the federation API, and optionally scopes the result with the existing token API.

The same flow supports reauthentication.

Links to the line numbers/files in the OpenStack source code that support the code in this PR:

@github-actions github-actions Bot added edit:openstack This PR updates common OpenStack code edit:identity This PR updates identity code labels Aug 12, 2026
@rm-you
rm-you force-pushed the feat/oidc-client-credentials branch from 9abdbf9 to 812d9c3 Compare August 12, 2026 09:15
@rm-you
rm-you marked this pull request as ready for review August 13, 2026 06:39
@github-actions github-actions Bot added semver:minor Backwards-compatible change backport-v2 This PR will be backported to v2 labels Aug 13, 2026
@coveralls

coveralls commented Aug 13, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 63.648% (+0.06%) from 63.588% — rm-you:feat/oidc-client-credentials into gophercloud:main

@rm-you
rm-you force-pushed the feat/oidc-client-credentials branch from 812d9c3 to 1c66b75 Compare August 18, 2026 07:32
@rm-you
rm-you force-pushed the feat/oidc-client-credentials branch from 1c66b75 to 7d9a69c Compare September 6, 2026 07:51
rm-you added a commit to rm-you/gophercloud that referenced this pull request Sep 8, 2026

@winiciusallan winiciusallan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rm-you for proposing all these identity-related things. I'm doing my best to give useful insights while avoiding making wrong assumptions (I'm not familiar with keystone flow).

Comment thread openstack/identity/v3/oidc/requests.go Outdated
Comment on lines +126 to +140
func validateAuthOptions(opts *AuthOptions) error {
if opts.IdentityProviderName == "" {
return fmt.Errorf("missing required field: IdentityProviderName")
}
if opts.Protocol == "" {
return fmt.Errorf("missing required field: Protocol")
}
if opts.ClientID == "" {
return fmt.Errorf("missing required field: ClientID")
}
if opts.AccessTokenEndpoint == "" && opts.DiscoveryEndpoint == "" {
return fmt.Errorf("at least one of AccessTokenEndpoint or DiscoveryEndpoint must be provided")
}
return nil
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use the required:"true" json tag in AuthOptions to use our existing validation. Then call gophercloud.BuildRequestBody(any, parent) in ToTokenV3CreateMap which you'd also need to call it at creation.

@rm-you rm-you Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 3083622: validation now uses required/or tags via BuildRequestBody, called through ToTokenV3CreateMap during creation. Either endpoint (or both) is still accepted, explicit endpoint precedence is unchanged, and regression tests cover both entry points.

Good call, missed this. :)
Also adjusted a couple other PRs to match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v2 This PR will be backported to v2 edit:identity This PR updates identity code edit:openstack This PR updates common OpenStack code semver:minor Backwards-compatible change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to use v3oidcclientcredentials for OpenStack keystone authentication (auth_type)

3 participants