mirror of
https://github.com/outline/outline.git
synced 2026-11-22 22:02:35 +03:00
- Change Record<string, unknown> to any to match the Strategy interface - Add null check for options parameter
31 lines
821 B
TypeScript
31 lines
821 B
TypeScript
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
import OAuth2Strategy, { Strategy } from "passport-oauth2";
|
|
import { Request } from "express";
|
|
|
|
export class OIDCStrategy extends Strategy {
|
|
constructor(
|
|
options: OAuth2Strategy.StrategyOptionsWithRequest,
|
|
verify: OAuth2Strategy.VerifyFunctionWithRequest
|
|
) {
|
|
super(options, verify);
|
|
|
|
if (process.env.https_proxy) {
|
|
const httpsProxyAgent = new HttpsProxyAgent(process.env.https_proxy);
|
|
this._oauth2.setAgent(httpsProxyAgent);
|
|
}
|
|
}
|
|
|
|
authenticate(req: Request, options?: any) {
|
|
options = options || {};
|
|
options.originalQuery = req.query;
|
|
super.authenticate(req, options);
|
|
}
|
|
|
|
authorizationParams(options: any) {
|
|
return {
|
|
...options.originalQuery,
|
|
...super.authorizationParams?.(options),
|
|
};
|
|
}
|
|
}
|