{"id":18321088,"url":"https://github.com/workos/passport-saml-migration-example","last_synced_at":"2025-04-09T14:30:28.551Z","repository":{"id":197323883,"uuid":"696558081","full_name":"workos/passport-saml-migration-example","owner":"workos","description":"An example Node app with migration code from `passport-saml` to WorkOS","archived":false,"fork":false,"pushed_at":"2024-03-29T09:36:27.000Z","size":186,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-02T20:50:18.492Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/workos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-26T01:46:09.000Z","updated_at":"2023-09-29T23:38:48.000Z","dependencies_parsed_at":"2024-01-11T22:39:39.040Z","dependency_job_id":"6e65812e-1822-4df4-93f7-687682dd41fb","html_url":"https://github.com/workos/passport-saml-migration-example","commit_stats":null,"previous_names":["workos/passport-saml-migration-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fpassport-saml-migration-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fpassport-saml-migration-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fpassport-saml-migration-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workos%2Fpassport-saml-migration-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/workos","download_url":"https://codeload.github.com/workos/passport-saml-migration-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054986,"owners_count":21040104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T18:18:18.552Z","updated_at":"2025-04-09T14:30:28.530Z","avatar_url":"https://github.com/workos.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `passport-saml` Migration Example\n\nThis example demonstrates a migration path from a custom SSO implementation running on `passport-saml` to a SSO implementation to WorkOS.\n\n## Try it\n\n#### 1. Clone the repo and install dependencies\n```\ngit clone https://github.com/workos/passport-saml-migration-example.git\ncd passport-saml-migration-example\nnpm i\n```\n\n#### 2. Establish a tunnel\nUsing `ngrok`, we prepare a tunnel to port 3000 on our local machine, and obtain the forwarding URL.\n\n```\nngrok http 3000\n```\n\nMake note of the Forwarding URL, which will look something like `https://7736-2001-871-216-2b68-69bd-a3bb-d4d6-af3f.ngrok-free.app`.  This will be used in the next step.\n\n#### 3. Set up a demo IDP, and configure the example app accordingly\n\nCopy the `.env.example` to `.env`, and edit it with your specific env variables\n```\ncp .env.example .env\n```\n\nGuidence for common identity providers can be found from the [WorkOS SSO Quickstart](https://workos.com/docs/sso).\n**However**, we wish to configure the IDP in its \"pre-migration\" state, therefore we will deviate from the standard WorkOS instructions, omiting WorkOS, and configure the IDP to point directly to our `passport-saml` example.\n\nCreate an APP in your IDP of choice, setting the following:\n\n- **Entity ID** - Sometimes called the \"Issuer\", this effectively a name of your app.  Set it to be the public URL of the example app, i.e. `https://7736-2001-871-216-2b68-69bd-a3bb-d4d6-af3f.ngrok-free.app`.  Set the value of the `EXAMPLE_ISSUER` env variable to the same.\n- **ACS URL** - Sometimes called the \"SSO URL\", this is the URL generated by the IDP for initiating SSO.  Set the `EXAMPLE_SSO_URL` env var to this value.\n- **Public Certificate** - Copy the x509 public certificate provided by the IDP, and use it for the `EXAMPLE_IDP_PUBLIC_CERT` env variable.\n\n#### 4. Create a Configure WorkOS settings\n\nWe will configure the WorkOS side of things, which will be our \"post-migration\" state.\n\n- `WORKOS_CLIENT_ID` and `WORKOS_API_KEY` are obtained from the WorkOS dashboard, on the \"API Keys\" page.\n- In the WorkOS Dashboard, visit the Configuration page and add a new \"Sign in callback\".  Its value will be your tunnel host combined with a `/workos/callback` path; i.e. ``https://7736-2001-871-216-2b68-69bd-a3bb-d4d6-af3f.ngrok-free.app/workos/callback`.  Set the `WORKOS_CALLBACK_URL`\n- In the WorkOS dashboard, create an organization representing one of your customers.\n- Copy the Organization ID to the `EXAMPLE_WORKOS_ORGANIZATION_ID` env var\n- Under the \"Single Sign On\" feature, create a new connection matching the IDP you selected.\n- Copy the ACS URL to the `EXAMPLE_WORKOS_CONNECTION_ACS_URL` env var\n\n#### 4. Run it\n\n```\nnpm run dev\n```\nAnd visit your app via the ngrok tunnel.\n\n#### 5. Sign in via passport-saml\n\nIn this example, the switch between signing in via `passport-saml` and via WorkOS is controlled by a user input.  In a real-world scenario, this should be determined by your app, such as by a feature flag.\n\nFirst, sign in using only passport-saml.  You should be presented with a login flow on the IDP, and returned to the example app, showing your email address.\n\n#### 6. Sign in via WorkOS\n\nLog out, and log in again, selecting \"WorkOS SSO\" as the method.  You should again be logged in, but this time via WorkOS.  You can view the authenticated sessions in the Sessions tab of the connection page in the WorkOS dashboard.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkos%2Fpassport-saml-migration-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkos%2Fpassport-saml-migration-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkos%2Fpassport-saml-migration-example/lists"}