Skip to content

Commit

Permalink
feat: http proxy support for oidc
Browse files Browse the repository at this point in the history
Resolves: #911
Signed-off-by: manuelraa <[email protected]>
  • Loading branch information
Manuelraa committed Jul 18, 2024
1 parent 0592b68 commit 8b6cb97
Show file tree
Hide file tree
Showing 3 changed files with 205 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@hapi/cryptiles": "5.0.0",
"@hapi/wreck": "^17.1.0",
"html-entities": "1.3.1",
"proxy-agent": "^6.4.0",
"zxcvbn": "^4.4.2"
},
"resolutions": {
Expand Down
19 changes: 13 additions & 6 deletions server/auth/types/openid/openid_auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ import {
IOpenSearchDashboardsResponse,
AuthResult,
} from 'opensearch-dashboards/server';
import HTTP from 'http';
import HTTPS from 'https';
import { PeerCertificate } from 'tls';
import { Server, ServerStateCookieOptions } from '@hapi/hapi';
import { ProxyAgent } from 'proxy-agent';
import { SecurityPluginConfigType } from '../../..';
import {
SecuritySessionCookie,
Expand Down Expand Up @@ -178,15 +177,23 @@ export class OpenIdAuthentication extends AuthenticationType {
if (Object.keys(this.wreckHttpsOption).length > 0) {
return wreck.defaults({
agents: {
http: new HTTP.Agent(),
https: new HTTPS.Agent(this.wreckHttpsOption),
httpsAllowUnauthorized: new HTTPS.Agent({
http: new ProxyAgent(),
https: new ProxyAgent(this.wreckHttpsOption),
httpsAllowUnauthorized: new ProxyAgent({
rejectUnauthorized: false,
}),
},
});
} else {
return wreck;
return wreck.defaults({
agents: {
http: new ProxyAgent(),
https: new ProxyAgent(),
httpsAllowUnauthorized: new ProxyAgent({
rejectUnauthorized: false,
}),
},
});
}
}

Expand Down
Loading

0 comments on commit 8b6cb97

Please sign in to comment.