Skip to content

Commit

Permalink
Revert "Fixing auth route handling in keymaster() by decorating rou…
Browse files Browse the repository at this point in the history
…tes in config of server, fixes #88, updating router"

This reverts commit d08d636.
  • Loading branch information
avoidwork committed Aug 18, 2017
1 parent d08d636 commit 311ae0d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
16 changes: 0 additions & 16 deletions lib/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ function auth (obj, config) {
if (async || config.auth.local.enabled) {
obj.get("/auth/basic", passportAuth).blacklist(passportAuth);
obj.get("/auth/basic", redirect);
obj.config.routes.get["/auth/basic"] = "";
} else {
obj.router.use(passportAuth, all).blacklist(passportAuth);
}
Expand Down Expand Up @@ -308,7 +307,6 @@ function auth (obj, config) {
if (async || config.auth.local.enabled) {
obj.get("/auth/bearer", passportAuth).blacklist(passportAuth);
obj.get("/auth/bearer", redirect);
obj.config.routes.get["/auth/bearer"] = "";
} else {
obj.router.use(passportAuth, all).blacklist(passportAuth);
}
Expand All @@ -334,11 +332,9 @@ function auth (obj, config) {

obj.get("/auth/facebook", middleware.asyncFlag);
obj.get("/auth/facebook", passport.authenticate("facebook"));
obj.config.routes.get["/auth/facebook"] = "";
obj.get("/auth/facebook/callback", middleware.asyncFlag);
obj.get("/auth/facebook/callback", passport.authenticate("facebook", {failureRedirect: "/login"}));
obj.get("/auth/facebook/callback", redirect);
obj.config.routes.get["/auth/facebook/callback"] = "";
}

if (config.auth.google.enabled) {
Expand All @@ -359,11 +355,9 @@ function auth (obj, config) {

obj.get("/auth/google", middleware.asyncFlag);
obj.get("/auth/google", passport.authenticate("google"));
obj.config.routes.get["/auth/google"] = "";
obj.get("/auth/google/callback", middleware.asyncFlag);
obj.get("/auth/google/callback", passport.authenticate("google", {failureRedirect: "/login"}));
obj.get("/auth/google/callback", redirect);
obj.config.routes.get["/auth/google/callback"] = "";
}

if (config.auth.jwt.enabled) {
Expand Down Expand Up @@ -416,11 +410,9 @@ function auth (obj, config) {

obj.get("/auth/linkedin", middleware.asyncFlag);
obj.get("/auth/linkedin", passport.authenticate("linkedin", {"scope": config.auth.linkedin.scope || ["r_basicprofile", "r_emailaddress"]}));
obj.config.routes.get["/auth/linkedin"] = "";
obj.get("/auth/linkedin/callback", middleware.asyncFlag);
obj.get("/auth/linkedin/callback", passport.authenticate("linkedin", {failureRedirect: "/login"}));
obj.get("/auth/linkedin/callback", redirect);
obj.config.routes.get["/auth/linkedin/callback"] = "";
}

if (config.auth.local.enabled) {
Expand Down Expand Up @@ -479,11 +471,9 @@ function auth (obj, config) {

obj.get("/auth/oauth2", middleware.asyncFlag);
obj.get("/auth/oauth2", passport.authenticate("oauth2"));
obj.config.routes.get["/auth/oauth2"] = "";
obj.get("/auth/oauth2/callback", middleware.asyncFlag);
obj.get("/auth/oauth2/callback", passport.authenticate("oauth2", {failureRedirect: "/login"}));
obj.get("/auth/oauth2/callback", redirect);
obj.config.routes.get["/auth/oauth2/callback"] = "";
}

if (config.auth.saml.enabled) {
Expand All @@ -509,11 +499,9 @@ function auth (obj, config) {

obj.get("/auth/saml", middleware.asyncFlag);
obj.get("/auth/saml", passport.authenticate("saml"));
obj.config.routes.get["/auth/saml"] = "";
obj.get("/auth/saml/callback", middleware.asyncFlag);
obj.get("/auth/saml/callback", passport.authenticate("saml", {failureRedirect: "/login"}));
obj.get("/auth/saml/callback", redirect);
obj.config.routes.get["/auth/saml/callback"] = "";
}

if (config.auth.slack.enabled) {
Expand All @@ -534,11 +522,9 @@ function auth (obj, config) {

obj.get("/auth/slack", middleware.asyncFlag);
obj.get("/auth/slack", passport.authenticate("slack"));
obj.config.routes.get["/auth/slack"] = "";
obj.get("/auth/slack/callback", middleware.asyncFlag);
obj.get("/auth/slack/callback", passport.authenticate("slack", {failureRedirect: "/login"}));
obj.get("/auth/slack/callback", redirect);
obj.config.routes.get["/auth/callback"] = "";
}

if (config.auth.twitter.enabled) {
Expand All @@ -560,13 +546,11 @@ function auth (obj, config) {

obj.get("/auth/twitter", middleware.asyncFlag);
obj.get("/auth/twitter", passport.authenticate("twitter"));
obj.config.routes.get["/auth/twitter"] = "";
obj.get("/auth/twitter/callback", middleware.asyncFlag);
obj.get("/auth/twitter/callback", passport.authenticate("twitter", {
successRedirect: config.auth.redirect,
failureRedirect: "/login"
}));
obj.config.routes.get["/auth/twitter/callback"] = "";
}

return config;
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tenso",
"description": "Tensō is an elastic REST API gateway for node.js",
"version": "5.1.5",
"version": "5.1.4",
"homepage": "http://avoidwork.github.io/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down Expand Up @@ -50,7 +50,7 @@
"tiny-uuid4": "~1.0.1",
"tiny-xml": "~1.0.6",
"uws": "^8.14.0",
"woodland": "^2.2.2",
"woodland": "^2.1.0",
"yamljs": "~0.2.10"
},
"devDependencies": {
Expand Down

0 comments on commit 311ae0d

Please sign in to comment.