Callback Route

Once JHU SSO has authenticated a user, it will send back a POST request to the SP (our app) with user data (assertions). It is up to us what that POST endpoint will be (but we shall let JHU IdP know about it through our metadata file).

app.post(
  "/jhu/login/callback",
  (req, res, next) => {
    next();
  },
  passport.authenticate("samlStrategy"),
  (req, res) => {
    // the user data is in req.user
    res.send(`welcome ${req.user.first_name}`);
  }
);
Diff
diff --git a/code/index.js b/code/index.js
index acb9c69..826206b 100644
--- a/code/index.js
+++ b/code/index.js
@@ -21,6 +21,19 @@ app.get(
   passport.authenticate("samlStrategy")
 );
 
+// callback route
+app.post(
+  "/jhu/login/callback",
+  (req, res, next) => {
+    next();
+  },
+  passport.authenticate("samlStrategy"),
+  (req, res) => {
+    // the user data is in req.user
+    res.send(`welcome ${req.user.first_name}`);
+  }
+);
+
 // Start the server.
 app.listen(port, () => {
   console.log(`Listening on http://localhost:${port}/`);