SBB*_*SBB 5 windows-authentication node.js electron
我有一个非常早期的电子应用程序,我们正在使用它来进行概念验证。我mainWindow.loadURL('https://example.com');在我的文件中使用它来打开我们内部应用程序的窗口。
我面临的问题是该网站使用 SSO 进行身份验证。
在 Chrome / IE 浏览器中,SSO 会在使用 Windows 身份验证时自动发生。
是否可以告诉正在创建的电子浏览器窗口也使用此身份验证?
mainWindow = new BrowserWindow({
width: winState.width,
height: winState.height,
minWidth: 992,
minHeight: 500,
x: winState.x,
y: winState.y
});
// Set our menu
setMenu();
// Load main window that uses SSO
// When using Chrome or IE, windows authentication passes this without needing to prompt for the credentials.
mainWindow.loadURL('https://example.com');
Run Code Online (Sandbox Code Playgroud)
您可以使用session.allowNTLMCredentialsForDomains('example.com')
这将允许 BrowserWindow 发送给定域的 NTLM 凭据。它还支持使用 * 的通配符,请在此处阅读更多信息:https ://electronjs.org/docs/api/session#sesallowntlmcredentialsfordomainsdomains
// add this on top
const { session } = require('electron');
session.defaultSession.allowNTLMCredentialsForDomains('example.com')
// your code here
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6039 次 |
| 最近记录: |