aboutsummaryrefslogtreecommitdiff
path: root/src/server/authentication/config/passport.ts
diff options
context:
space:
mode:
authorkimdahey <claire_kim1@brown.edu>2020-01-16 11:31:41 -0500
committerkimdahey <claire_kim1@brown.edu>2020-01-16 11:31:41 -0500
commit6be0e19ed0bd13f3796f542affa5a2e52674650c (patch)
tree1be222ea9341ecd8020fad3149035fa650a8a07f /src/server/authentication/config/passport.ts
parent5cde81d8c6b4dcd8d0796f8669b668763957f395 (diff)
parente410cde0e430553002d4e1a2f64364b57b65fdbc (diff)
merged w master
Diffstat (limited to 'src/server/authentication/config/passport.ts')
-rw-r--r--src/server/authentication/config/passport.ts21
1 files changed, 1 insertions, 20 deletions
diff --git a/src/server/authentication/config/passport.ts b/src/server/authentication/config/passport.ts
index 0ced99b0d..286209b20 100644
--- a/src/server/authentication/config/passport.ts
+++ b/src/server/authentication/config/passport.ts
@@ -1,8 +1,6 @@
import * as passport from 'passport';
import * as passportLocal from 'passport-local';
-import _ from "lodash";
import { default as User } from '../models/user_model';
-import { Request, Response, NextFunction } from "express";
const LocalStrategy = passportLocal.Strategy;
@@ -28,21 +26,4 @@ passport.use(new LocalStrategy({ usernameField: 'email', passReqToCallback: true
return done(undefined, user);
});
});
-}));
-
-export let isAuthenticated = (req: Request, res: Response, next: NextFunction) => {
- if (req.isAuthenticated()) {
- return next();
- }
- return res.redirect("/login");
-};
-
-export let isAuthorized = (req: Request, res: Response, next: NextFunction) => {
- const provider = req.path.split("/").slice(-1)[0];
-
- if (_.find(req.user && "tokens" in req.user ? req.user["tokens"] : undefined, { kind: provider })) {
- next();
- } else {
- res.redirect(`/auth/${provider}`);
- }
-}; \ No newline at end of file
+})); \ No newline at end of file