diff options
author | Matt Strapp <matt@mattstrapp.net> | 2022-04-01 17:50:13 +0200 |
---|---|---|
committer | Matt Strapp <matt@mattstrapp.net> | 2022-04-01 17:50:13 +0200 |
commit | 5717af872df070a50b9c27ccb21e2753339ae8fe (patch) | |
tree | 70dc16e57f4e4c552f92810eaf9d16c2dfaa56aa /src/routes/middleware | |
parent | Bump @typescript-eslint/parser from 5.16.0 to 5.17.0 (#37) (diff) | |
download | ee4511w-web-5717af872df070a50b9c27ccb21e2753339ae8fe.tar ee4511w-web-5717af872df070a50b9c27ccb21e2753339ae8fe.tar.gz ee4511w-web-5717af872df070a50b9c27ccb21e2753339ae8fe.tar.bz2 ee4511w-web-5717af872df070a50b9c27ccb21e2753339ae8fe.tar.lz ee4511w-web-5717af872df070a50b9c27ccb21e2753339ae8fe.tar.xz ee4511w-web-5717af872df070a50b9c27ccb21e2753339ae8fe.tar.zst ee4511w-web-5717af872df070a50b9c27ccb21e2753339ae8fe.zip |
Attempt to add basic SAML
Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to '')
-rw-r--r-- | src/routes/middleware/saml.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/routes/middleware/saml.ts b/src/routes/middleware/saml.ts new file mode 100644 index 0000000..ad9d50d --- /dev/null +++ b/src/routes/middleware/saml.ts @@ -0,0 +1,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(); + next(); + } + next(); +}; + +export default saml; |