Skip to content

feat: Enterprise Connect implementation - #52

Open
Piyush-85 wants to merge 4 commits into
mainfrom
feat/enterprise-connect
Open

feat: Enterprise Connect implementation#52
Piyush-85 wants to merge 4 commits into
mainfrom
feat/enterprise-connect

Conversation

@Piyush-85

Copy link
Copy Markdown

Description

Adds Enterprise Connect (EC) support to the auth0-express SDK.

In EC mode Auth0 acts as a pure SSO relay, it writes no Auth0 session, and the application owns its own session (established in the onCallback hook). This PR adds the full EC surface:

  • enterpriseConnect: true config flag, with a required onCallback hook (validated at config time).
  • startEnterpriseLogin(req, res, { email, returnTo? }) - email-domain Home Realm Discovery (WebFinger) followed by an interactive login redirect; returns true when federated, false otherwise.
  • Re-exports isFederatedDomain and EnterpriseConnectNotSupportedError from @auth0/auth0-server-js, and the EnterpriseConnectCallbackHook type, so integrators can compose the flow themselves (isFederatedDomain + /auth/login?login_hint=).
  • EC-aware callback: invokes onCallback with { idTokenClaims, user, appState } and writes no Auth0 session.
  • Always-federated logout in EC mode (ends the upstream enterprise IdP session).
  • requiresAuth() is documented as unsupported in EC mode (session-backed methods throw EnterpriseConnectNotSupportedError; enforcement lives in auth0-server-js).

The public API and usage are documented in the SDK docs - README (Features table) and EXAMPLES.md → Enterprise Connect — not repeated here.

References

  • Runnable example (separate PR, targets this branch): examples/example-express-enterprise-connect

Testing

  • Added unit/integration coverage for config validation, the EC callback path (onCallback invoked, no session cookie, appState forwarded, error handling), startEnterpriseLogin (federated / non-federated / returnTo persistence), federated logout, and method enforcement in EC mode.
  • Full package suite green: 292 tests passing; lint and build clean.

Environment: Node.js / TypeScript, Express 5, macOS.

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs — README + EXAMPLES included
  • All active GitHub checks for tests, formatting, and security are passing

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