Skip to content

Commit

Permalink
docs: Prevent post_assert from throwing an error
Browse files Browse the repository at this point in the history
In strict environments, name_id and session_index are not defined
before they are actually used. Declare `var` before they're used.

Closes #183.
  • Loading branch information
adamsea authored and mcab committed Oct 15, 2022
1 parent 3d328e8 commit cf7e7a1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ app.get("/login", function(req, res) {
});
});

// Variables used in login/logout process
var name_id, session_index;

// Assert endpoint for when login completes
app.post("/assert", function(req, res) {
var options = {request_body: req.body};
Expand All @@ -280,7 +283,7 @@ app.post("/assert", function(req, res) {
name_id = saml_response.user.name_id;
session_index = saml_response.user.session_index;

res.send("Hello #{saml_response.user.name_id}!");
res.send("Hello #{name_id}! session_index: #{session_index}.");
});
});

Expand Down

0 comments on commit cf7e7a1

Please sign in to comment.