aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/middleware/saml.ts
blob: 86155c56dd78e994687d7289d2c32c94fd3e6ac7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
import BasicAuthenticator from 'umn-shib-nodejs';
import { Request, Response, NextFunction } from 'express';

const saml = function (req: Request, res: Response, next: NextFunction): void {
  const authenticator = new BasicAuthenticator(req, res);
  if (!authenticator.hasSession()) {
    authenticator.redirectToLogin();
    return;
  }
  next();
};

export default saml;