feat(auth): add Entra ID OIDC authentication for web UI#6345
feat(auth): add Entra ID OIDC authentication for web UI#6345rbstp wants to merge 1 commit intorunatlantis:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-party OIDC authentication to the Atlantis web UI (starting with Entra ID / Azure AD), including support for Azure workload identity, stateless encrypted cookie sessions, and new CLI/config flags to enable/configure the feature.
Changes:
- Introduces
server/oidcpackage (provider, Azure workload identity helper, cookie-based session/state management) plus controller endpoints for login/callback/logout. - Extends web middleware and UI templates to support OIDC sessions (and coexist with basic auth), including displaying the signed-in user and a sign-out link.
- Adds new server flags/docs and bumps Go dependencies for OIDC + OAuth2 support.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
server/user_config.go |
Adds OIDC-related config fields to UserConfig. |
server/server.go |
Wires OIDC initialization and routes; surfaces OIDC state to the index view. |
server/middleware.go |
Extends auth middleware to accept OIDC sessions and redirect unauthenticated users. |
server/middleware_test.go |
Adds unit tests for basic auth / OIDC / combined behavior. |
server/oidc/session.go |
Implements encrypted stateless session cookies + signed state cookie handling. |
server/oidc/session_test.go |
Tests session/state cookie behavior and encryption expectations. |
server/oidc/provider.go |
Adds OIDC discovery + auth code exchange (incl. workload identity assertion) and email extraction. |
server/oidc/azure_workload_identity.go |
Reads/caches federated SA token from AZURE_FEDERATED_TOKEN_FILE. |
server/oidc/azure_workload_identity_test.go |
Tests federated token loading and caching behavior. |
server/controllers/oidc_controller.go |
Adds OIDC login/callback/logout handlers. |
server/controllers/oidc_controller_test.go |
Adds basic controller tests for error paths and logout behavior. |
server/controllers/web_templates/web_templates.go |
Extends index template data; adds login template wiring. |
server/controllers/web_templates/templates/index.html.tmpl |
Shows signed-in user + sign-out link when OIDC is enabled. |
server/controllers/web_templates/templates/login.html.tmpl |
Adds a login page template (currently not clearly wired to a route). |
cmd/server.go |
Adds flags/defaults/validation for OIDC configuration. |
cmd/server_test.go |
Updates test flag map to include new OIDC flags/defaults. |
runatlantis.io/docs/server-configuration.md |
Documents the new OIDC flags and example env vars. |
go.mod |
Adds go-oidc and updates oauth2 dependency versions. |
go.sum |
Updates checksums for new/updated dependencies. |
Signed-off-by: Richard Boisvert <rboisvert@devolutions.net>
|
This PR states "Closes #4452" but it only partially addresses the issue. Issue #4452 requests general SSO/SAML authentication for the Atlantis web UI — not limited to a specific identity provider. However, this PR only implements Entra ID (Azure AD) as a supported OIDC provider. The provider list is hardcoded: var ValidOIDCAuthProviders = []OIDCAuthProvider{OIDCAuthEntraID}Key gaps relative to #4452:
The PR description mentions the design is "extensible for future providers," but as-is, merging this with "Closes #4452" would close the issue while leaving the majority of requested SSO use cases unaddressed. Consider either:
|
what
--web-oidc-authflag accepts a provider name (entraid), designed to be extensible for future providers--web-oidc-auth,--web-oidc-issuer-url,--web-oidc-client-id,--web-oidc-client-secret,--web-oidc-scopes,--web-oidc-cookie-secret,--web-oidc-azure-use-workload-identitywhy
tests
references