If you run an OpenStack cloud with federated identity, you probably know this pain. Horizon works great. Users sign in via OpenID Connect or SAML, complete their MFA challenge in the browser, and land on their dashboard.
The CLI doesn't. Keystone's standard auth plugins expect a username and password passed directly. That breaks the moment your IdP requires a browser redirect or a second factor prompt. The common workaround is application specific passwords, static credentials created outside the IdP's normal auth flow. They bypass MFA entirely, rarely get rotated, and create the exact kind of long lived secret that federated identity was supposed to eliminate.
We built keystoneauth-websso to fix this. It lets any OpenStack CLI tool use the same browser based WebSSO flow Horizon uses, directly from your terminal.
Why the CLI doesn't "just work" with WebSSO
Keystone's WebSSO flow was designed for Horizon. Every step assumes a browser: the IdP redirect, the MFA challenge, the cookie-based session, and the auto-submitted HTML form that carries the token back. A CLI tool driving this with raw HTTP calls would basically need a full browser engine. Not practical.
How the plugin works
Instead of replicating a browser, we just use the actual browser. The plugin opens your default browser to kick off the WebSSO flow and spins up a short-lived HTTP server on localhost to catch the token when the flow completes.
Here's the full sequence:
1. You run an OpenStack CLI command (e.g. openstack server list) with auth_type set to v3websso.
2. The plugin constructs the federated WebSSO URL for your configured IdP/protocol, with ?origin=http://localhost:9990/auth/websso/ so Keystone knows where to POST the token.
3. A single-request HTTP server binds to localhost:9990 (Python's built-in http.server — no external deps, no framework). 60-second socket timeout so it won't hang if you walk away.
4. Your default browser opens to the constructed URL.
5. You authenticate normally in the browser. MFA, hardware tokens, conditional access — all work because auth happens where those flows were designed to run.
6. After auth, Keystone renders its callback template. Because the origin points to localhost:9990, the form auto-submits the unscoped token to the plugin's waiting server.
7. The server parses the POST body, extracts the token, sends back a "you can close this tab" page, and shuts down.
8. The plugin retrieves token metadata via GET /v3/auth/tokens and proceeds with your original command.
From your perspective: terminal pauses → browser tab opens → you authenticate → tab says "close me" → terminal prints results.
It plugs into keystoneauth1 with zero client changes
The plugin registers via stevedore/setuptools entry points as v3websso. Set auth_type: v3websso in your clouds.yaml or pass --os-auth-type v3websso and keystoneauth1 discovers it automatically. No patches to python-openstackclient. No vendor forks. No monkey-patching.
Under the hood it subclasses FederationBaseAuth and only implements get_unscoped_auth_ref. Catalog lookups, endpoint discovery, scoping — all work unchanged downstream.
Token caching (you don’t get a browser tab on every command)
After a successful auth, the plugin caches the unscoped token + metadata to a JSON file in your platform's user cache directory (via platformdirs). Filename is derived from auth_url + identity_provider so different clouds don't collide.
On subsequent runs, if a cached token is still valid, the plugin uses it directly. The browser flow only happens once per token lifetime (typically a few hours). Everything else is instant.
Security notes
· Callback server only binds to localhost. Accepts one request, then shuts down.
· 60-second socket timeout — no indefinite blocking.
· Cache files written with 0600 permissions.
· The plugin never sees your IdP password. Auth happens entirely in the browser. The only artifact captured is the Keystone token (same thing Horizon gets).
What you need to set up
- One Keystone config change: add http://localhost:9990/auth/websso/ to
trusted_dashboard in keystone.conf. - Two runtime deps beyond keystoneauth1:
multipart (POST body parsing) and platformdirs (cache path resolution). - The whole thing is ~300 lines of Python.
No changes to any CLI client.
TL;DR
If you've invested in federated identity for your OpenStack cloud, this plugin closes the last gap. Your users authenticate the same way whether they're in Horizon or the terminal. Same access policies, same session controls, same audit logs. No application passwords. No MFA exceptions for CLI workflows.
Apache 2.0 — github.com/vexxhost/keystoneauth-websso
If you're running into this problem or have questions about setting it up, drop a comment or reach out to us at VEXXHOST. We'd love to hear how you're handling CLI auth with federated identity.