Skip to content

Add acquia_id and acquia_trials_id modules for Acquia ID SSO#41

Open
mglaman wants to merge 5 commits intoacquia:mainfrom
mglaman:acquia-id-sign-on
Open

Add acquia_id and acquia_trials_id modules for Acquia ID SSO#41
mglaman wants to merge 5 commits intoacquia:mainfrom
mglaman:acquia-id-sign-on

Conversation

@mglaman
Copy link
Copy Markdown

@mglaman mglaman commented Apr 9, 2026

Summary

  • Adds acquia_id — a standalone OAuth2 SSO module using the PKCE authorization code flow against Acquia ID (id.acquia.com). Dispatches OAuth2AuthorizationEvent for subscriber-based user resolution; ships with no default subscriber so implementing modules control user find/create logic.
  • Adds acquia_trials_id — a thin module that subscribes to OAuth2AuthorizationEvent, verifies the authenticated user has access to the current Acquia Cloud application via GET /api/applications/{uuid}, then finds or creates the Drupal user by email.
  • Adds league/oauth2-client: ^2 to the root composer.json.

Key design decisions

  • CLIENT_ID is a service parameter (acquia_id.client_id) rather than a hardcoded constant, making it overridable per environment.
  • The legacy accounts.acquia.com Acquia provider is not included; only the modern Acquia ID (id.acquia.com) provider is used.
  • SSO route is /acquia-id/sso (route name acquia_id.sso).
  • acquia_trials_id reuses %acquia_id.cloud_api_base_uri% and reads the application UUID from AcquiaDrupalEnvironmentDetector::getAhApplicationUuid().

Test plan

  • Configure acquia_id.* service parameters and enable acquia_id
  • Visit /acquia-id/sso — should redirect to Acquia ID authorization URL
  • Complete OAuth flow — OAuth2AuthorizationEvent should be dispatched
  • Enable acquia_trials_id and confirm login grants access when the Cloud API returns 200 for the application UUID
  • Confirm login is denied (redirects to idp_logout_redirect_uri) when the Cloud API returns a non-200

🤖 Generated with Claude Code

acquia_id provides a reusable OAuth2 PKCE authorization code flow
against Acquia ID (id.acquia.com). It dispatches OAuth2AuthorizationEvent
after token exchange; implementing modules subscribe to resolve the
Drupal user. The client_id and IdP URIs are service parameters so they
are overridable per environment without code changes.

acquia_trials_id subscribes to that event, verifies the authenticated
user has access to the current Acquia Cloud application via
GET /api/applications/{uuid}, then finds or creates the Drupal user
by email.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@@ -0,0 +1,26 @@
parameters:
acquia_id.client_id: ''
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

TODO get from IDM team

mglaman and others added 4 commits April 9, 2026 14:24
Removes the getProvider() and getAccessToken() getter methods in favour
of direct public readonly property access ($event->provider,
$event->accessToken). The properties are constructor-injected and never
mutate, so getters add no value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both point to production Acquia endpoints so they only need to be
overridden in non-production environments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Users authenticating via Acquia ID on a trial site are always granted
the administrator role, whether their account is newly created or
already exists.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sets the Drupal user's uuid field to match the Acquia account UUID from
the resource owner data, keeping the identity consistent across systems.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant