mirror of
https://github.com/outline/outline.git
synced 2026-11-21 21:44:30 +03:00
30 lines
787 B
TypeScript
30 lines
787 B
TypeScript
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
import type OAuth2Strategy from "passport-oauth2";
|
|
import { Strategy } from "passport-oauth2";
|
|
|
|
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: any, options: any) {
|
|
options.originalQuery = req.query;
|
|
super.authenticate(req, options);
|
|
}
|
|
|
|
authorizationParams(options: any) {
|
|
return {
|
|
...options.originalQuery,
|
|
...super.authorizationParams?.(options),
|
|
};
|
|
}
|
|
}
|