Skip to content

Commit

Permalink
🛤️ feat: Proxy Support for OpenID Login (danny-avila#3051)
Browse files Browse the repository at this point in the history
  • Loading branch information
btribonde authored Jun 15, 2024
1 parent 6f8a9a6 commit c521d91
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion api/strategies/openidStrategy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const fetch = require('node-fetch');
const passport = require('passport');
const jwtDecode = require('jsonwebtoken/decode');
const { Issuer, Strategy: OpenIDStrategy } = require('openid-client');
const { HttpsProxyAgent } = require('https-proxy-agent');
const { Issuer, Strategy: OpenIDStrategy, custom } = require('openid-client');
const { getStrategyFunctions } = require('~/server/services/Files/strategies');
const { findUser, createUser, updateUser } = require('~/models/userMethods');
const { logger } = require('~/config');
Expand Down Expand Up @@ -67,6 +68,13 @@ function convertToUsername(input, defaultValue = '') {

async function setupOpenId() {
try {
if (process.env.PROXY) {
const proxyAgent = new HttpsProxyAgent(process.env.PROXY);
custom.setHttpOptionsDefaults({
agent: proxyAgent
});
logger.info(`[openidStrategy] proxy agent added: ${process.env.PROXY}`);
}
const issuer = await Issuer.discover(process.env.OPENID_ISSUER);
const client = new issuer.Client({
client_id: process.env.OPENID_CLIENT_ID,
Expand Down

0 comments on commit c521d91

Please sign in to comment.