Skip to content

feat: add Enterprise Connect support - #1017

Draft
gyaneshgouraw-okta wants to merge 1 commit into
mainfrom
enterprise-connect
Draft

feat: add Enterprise Connect support#1017
gyaneshgouraw-okta wants to merge 1 commit into
mainfrom
enterprise-connect

Conversation

@gyaneshgouraw-okta

Copy link
Copy Markdown
Contributor

Summary

Adds Enterprise Connect support to auth0-angular by re-exporting the isFederatedDomain function from auth0-spa-js for enterprise domain discovery, then using the existing AuthService.loginWithRedirect with login_hint for SSO login.

Enterprise Connect lets a B2B SaaS layer enterprise SSO (SAML, OIDC federation) on top of its own auth server: Auth0 authenticates the enterprise user against their IdP and returns an enriched ID token, which the SDK caches like any other login.

Because the spa-js surface is a single standalone function (not a client method), this is a thin pass-through rather than a new service method: the flow reuses the existing loginWithRedirect / logout Observables.

Changes

  • Re-export isFederatedDomain and its IsFederatedDomainOptions type from @auth0/auth0-spa-js through the public API, matching the spa-js signature (caller passes auth0Domain and emailDomain).
  • Add a public-API export-contract test guarding the isFederatedDomain re-export.
  • Add an Enterprise Connect example route to the playground demonstrating domain discovery, SSO login with login_hint, org_id validation, and federated logout end to end.
  • Document the Enterprise Connect login, callback, org validation, and federated logout flow in EXAMPLES.md.

Example

import{AuthService,isFederatedDomain}from'@auth0/auth0-angular';constemailDomain=email.split('@')[1];// Routing hint only: returns false on any failure, never authorises.if(awaitisFederatedDomain('YOUR_AUTH0_DOMAIN',emailDomain)){// Home Realm Discovery resolves the connection and organization from the// domain -- do not pass organization yourself.auth.loginWithRedirect({authorizationParams: {login_hint: email}}).subscribe();}// Federated logout terminates the enterprise IdP session (SAML SLO).auth.logout({logoutParams: {federated: true,returnTo: window.location.origin}}).subscribe();

Important

Enterprise Connect is an Early Access feature. isFederatedDomain is a routing hint, not a security control: always validate org_id from the ID token claims after the callback, and enforce it server-side on every request that trusts the token.

Testing

  • npm run test:ci: 191 tests pass across 8 suites, including the new public-API export test.
  • npm run build: library builds cleanly; isFederatedDomain and IsFederatedDomainOptions resolve in the generated dist typings.
  • npm run lint: no lint errors.
  • Manually tested the full flow (discovery, SSO redirect, org validation, federated logout) via the playground Enterprise Connect route against an EC-enabled tenant.

@coderabbitai

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
auto_review:
drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for freeto 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

@gyaneshgouraw-okta