fix: Oauth2: Reuse TLS Certifcate valiadation and custom CA settings from preferences when accessing Auth and Token URLs (#2071)

#1684
#1003
This commit is contained in:
Mateusz Pietryga 2024-04-15 19:16:46 +02:00 committed by GitHub
parent 4e95fd548d
commit 12263a71b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,5 @@
const { BrowserWindow } = require('electron');
const { preferencesUtil } = require('../../store/preferences');
const authorizeUserInWindow = ({ authorizeUrl, callbackUrl, session }) => {
return new Promise(async (resolve, reject) => {
@ -22,6 +23,12 @@ const authorizeUserInWindow = ({ authorizeUrl, callbackUrl, session }) => {
});
window.on('ready-to-show', window.show.bind(window));
// We want browser window to comply with "SSL/TLS Certificate Verification" toggle in Preferences
window.webContents.on('certificate-error', (event, url, error, certificate, callback) => {
event.preventDefault();
callback(!preferencesUtil.shouldVerifyTls());
});
function onWindowRedirect(url) {
// check if the url contains an authorization code
if (new URL(url).searchParams.has('code')) {