Skip to content

Commit

Permalink
Initial commit with passport-slack module added, updated config
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Aug 17, 2017
1 parent e99f27a commit e9c93ff
Show file tree
Hide file tree
Showing 4 changed files with 972 additions and 2 deletions.
7 changes: 7 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"jwt": {
"enabled": false,
"auth": null,
"audience": "",
"algorithms": ["HS256", "HS384", "HS512"],
"ignoreExpiration": false,
Expand Down Expand Up @@ -53,6 +54,12 @@
"enabled": false,
"auth": null
},
"slack": {
"enabled": false,
"auth": null,
"client_id": "",
"client_secret": ""
},
"twitter": {
"enabled": false,
"auth": null,
Expand Down
25 changes: 25 additions & 0 deletions lib/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,31 @@ function auth (obj, config) {
obj.get("/auth/saml/callback", redirect);
}

// @todo finish!
if (config.auth.slack.enabled) {
passport.use(new FacebookStrategy({
clientID: config.auth.facebook.client_id,
clientSecret: config.auth.facebook.client_secret,
callbackURL: realm + "/auth/facebook/callback"
}, (accessToken, refreshToken, profile, done) => {
delay(() => {
config.auth.facebook.auth(accessToken, refreshToken, profile, (err, user) => {
if (err) {
done(err);
} else {
done(null, user);
}
});
});
}));

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

if (config.auth.twitter.enabled) {
passport.use(new TwitterStrategy({
consumerKey: config.auth.twitter.consumer_key,
Expand Down
Loading

0 comments on commit e9c93ff

Please sign in to comment.