-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
As part of the oauth2 guard, when the access token is extracted, set it as property req.accessToken so it can be consumed easily by subsequent middlewares.
Example
import express from 'express';
import {
cachedJwtKeySupplier,
defaultJwtKeySupplier,
defaultJwtVerifier,
defaultUserInfoRetriever,
oauth2Guard,
} from '@quickcase/node-toolkit';
const jwtKeySupplier = cachedJwtKeySupplier()(defaultJwtKeySupplier({jwksUri: 'https://...'}));
const app = express();
app.use(oauth2Guard({
jwtVerifier: defaultJwtVerifier(jwtKeySupplier),
userInfoRetriever: defaultUserInfoRetriever({userInfoUri: 'https://...'}),
}));
app.use((req, res, next) => {
// req.accessToken = 'eyeyeye...'; <--- new property
// req.grantedAuthorities = ['caseworker', 'caseworker-jid'];
// req.userClaims = {
// sub: '',
// ...
// };
next();
});Reactions are currently unavailable