Skip to content

Commit

Permalink
adds openid logout to canon-core
Browse files Browse the repository at this point in the history
  • Loading branch information
jhmullen committed Oct 5, 2022
1 parent 4b18964 commit 17860ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,10 @@ export CANON_OPENID_ID="###############"
export CANON_OPENID_SECRET="##############################"
export CANON_OPENID_ROLES="profile,email"
```
3. (Optional) To fully log out of OpenId on Canon Logout, set this variable:
```sh
export CANON_OPENID_LOGOUT="https://login.microsoftonline.com/###/oauth2/v2.0/logout"
```

---

Expand Down
8 changes: 6 additions & 2 deletions packages/core/src/auth/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ module.exports = function (app) {

app.get("/auth/logout", (req, res) => {
req.logout();
//TBD: Force logout for openID? I don't think so. https://github.com/passport/todos-express-auth0/blob/main/routes/auth.js#L43-L50
return res.redirect("/");
if (req.query.openid === "true" && process.env.CANON_OPENID_LOGOUT) {
res.redirect(process.env.CANON_OPENID_LOGOUT)
}
else {
return res.redirect("/");
}
});

app.get("/auth/users", isRole(2), (req, res) => {
Expand Down

0 comments on commit 17860ed

Please sign in to comment.