Skip to content

Commit

Permalink
Change code descriptions to present tense
Browse files Browse the repository at this point in the history
  • Loading branch information
bethh0rn committed Feb 25, 2025
1 parent 427d25f commit a48ba1d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Let's see how the website currently looks before configuring SAML.
docker run --platform=linux/amd64 --rm -v ".:/app" -w "/app" --name app --network faNetwork -p 3000:3000 node:23-alpine3.19 sh -c "npm run start"
```

These commands will install the Node.js packages in `package.json` and run the Express.js web server on the same network as the FusionAuth server in the Docker file, `faNetwork`.
These commands install the Node.js packages in `package.json` and run the Express.js web server on the same network as the FusionAuth server in the Docker file, `faNetwork`.

- Browse to `http://localhost:3000`.
- Log in to the Changebank website with `[email protected]` and `password`.
Expand Down Expand Up @@ -329,7 +329,7 @@ Let's see how the website currently looks before configuring SAML.
docker run --platform=linux/amd64 --rm -v ".:/app" -w "/app" --name app --network faNetwork -p 3000:3000 node:23-alpine3.19 sh -c "npm run start"
```

These commands will install the Node.js packages in `package.json` and run the Express.js web server on the same network as the FusionAuth server in the Docker file, `faNetwork`.
These commands install the Node.js packages in `package.json` and run the Express.js web server on the same network as the FusionAuth server in the Docker file, `faNetwork`.

- Browse to `http://localhost:3000`.
- Log in to the Changebank website with `[email protected]` and `password`.
Expand Down Expand Up @@ -448,9 +448,9 @@ You can now browse to `http://localhost:3000` and log in exactly the same way as

### Explanation Of The New Code

SAML is more strict with security certificates than OAuth. You needed to copy the certificate from FusionAuth into your website in order for SAML to trust it.
SAML is more strict with security certificates than OAuth. You need to copy the certificate from FusionAuth into your website in order for SAML to trust it.

In the authentication JavaScript file, you added SAML as a strategy. Passport can use multiple strategies, so you didn't need to remove OAuth. Each strategy is identified by a different label, like `saml`. The `setupSaml` function sets some options to match the settings in the SAML data from FusionAuth. The function then instantiates the new Passport SAML strategy with two functions that handle the user profile returned from the identity provider. You can further process the user in these functions, for instance by saving the user to a database, but in this example you do nothing except say that you are done. Express.js session storage (`express-session`) is already being used to store the user profile in a cookie that is sent to the user's browser.
In the authentication JavaScript file, you add SAML as a strategy. Passport can use multiple strategies, so you don't need to remove OAuth. Each strategy is identified by a different label, like `saml`. The `setupSaml` function sets some options to match the settings in the SAML data from FusionAuth. The function then instantiates the new Passport SAML strategy with two functions that handle the user profile returned from the identity provider. You can further process the user in these functions, for instance by saving the user to a database, but in this example you do nothing except say that you are done. Express.js session storage (`express-session`) is already being used to store the user profile in a cookie that is sent to the user's browser.

The code changes to the routes file are minimal, barely changing what is in the Passport documentation. You comment out the OAuth login route (because in this example the customer wanted to switch entirely to SAML), you add a SAML login route to direct the user to FusionAuth, and you use a callback handler to direct the logged in user to their account.

Expand Down

0 comments on commit a48ba1d

Please sign in to comment.