Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Edge extends WebBrowser {
// System.getProperty() keys
static final String BROWSER_DIR_PROP = "org.eclipse.swt.browser.EdgeDir";
static final String BROWSER_ARGS_PROP = "org.eclipse.swt.browser.EdgeArgs";
static final String ALLOW_SINGLE_SIGN_ON_USING_OS_PRIMARY_ACCOUNT_PROP = "org.eclipse.swt.browser.Edge.allowSingleSignOnUsingOSPrimaryAccount";
static final String DATA_DIR_PROP = "org.eclipse.swt.browser.EdgeDataDir";
static final String LANGUAGE_PROP = "org.eclipse.swt.browser.EdgeLanguage";
static final String VERSIONT_PROP = "org.eclipse.swt.browser.EdgeVersion";
Expand Down Expand Up @@ -563,6 +564,9 @@ WebViewEnvironment createEnvironment() {
String browserDir = System.getProperty(BROWSER_DIR_PROP);
String browserArgs = System.getProperty(BROWSER_ARGS_PROP);
String language = System.getProperty(LANGUAGE_PROP);

boolean allowSSO = Boolean.getBoolean(ALLOW_SINGLE_SIGN_ON_USING_OS_PRIMARY_ACCOUNT_PROP);

String dataDir = getDataDir(display);

// Initialize options
Expand All @@ -580,6 +584,11 @@ WebViewEnvironment createEnvironment() {
options.put_Language(pLanguage);
}

if (allowSSO) {
int[] pAllowSSO = new int[]{1};
options.put_AllowSingleSignOnUsingOSPrimaryAccount(pAllowSSO);
}

// Create the environment
char[] pBrowserDir = stringToWstr(browserDir);
char[] pDataDir = stringToWstr(dataDir);
Expand Down
4 changes: 4 additions & 0 deletions bundles/org.eclipse.swt/Readme.WebView2.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ language+country code that defines the browser UI language and preferred
language for HTTP requests (`Accept-Languages` header).
Example values: `en`, `ja`, `en-GB`, `de-AT`.

The property `org.eclipse.swt.browser.Edge.allowSingleSignOnUsingOSPrimaryAccount` enables Single Sign-On with Azure Active Directory (AAD) resources using the logged-in Windows account. This also enables SSO with websites using Microsoft accounts associated with the Windows login. Setting this property to true enables this feature. The default value is false.

See also: https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2environmentoptions.allowsinglesignonusingosprimaryaccount

_Note_: All of the properties described above must be set before the first
instance of the `Browser` with `SWT.EDGE` style is created.

Expand Down
Loading