Skip to content

Commit 1994ddf

Browse files
committed
Enable setting Azure AD SSO property using Control.setData
1 parent 068011d commit 1994ddf

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class Edge extends WebBrowser {
5050
static final String BROWSER_DIR_PROP = "org.eclipse.swt.browser.EdgeDir";
5151
static final String BROWSER_ARGS_PROP = "org.eclipse.swt.browser.EdgeArgs";
5252
static final String ALLOW_SINGLE_SIGN_ON_USING_OS_PRIMARY_ACCOUNT_PROP = "org.eclipse.swt.browser.Edge.allowSingleSignOnUsingOSPrimaryAccount";
53-
static final String ALLOW_SINGLE_SIGN_ON_USING_OS_PRIMARY_ACCOUNT_PROP_2 = "org.eclipse.swt.browser.Edge.allowSSO";
5453
static final String DATA_DIR_PROP = "org.eclipse.swt.browser.EdgeDataDir";
5554
static final String LANGUAGE_PROP = "org.eclipse.swt.browser.EdgeLanguage";
5655
static final String VERSIONT_PROP = "org.eclipse.swt.browser.EdgeVersion";
@@ -566,7 +565,11 @@ WebViewEnvironment createEnvironment() {
566565
String browserDir = System.getProperty(BROWSER_DIR_PROP);
567566
String browserArgs = System.getProperty(BROWSER_ARGS_PROP);
568567
String language = System.getProperty(LANGUAGE_PROP);
569-
boolean allowSSO = Boolean.getBoolean(ALLOW_SINGLE_SIGN_ON_USING_OS_PRIMARY_ACCOUNT_PROP) || Boolean.getBoolean(ALLOW_SINGLE_SIGN_ON_USING_OS_PRIMARY_ACCOUNT_PROP_2);
568+
569+
Boolean instanceAllowSSO = (Boolean) browser.getData(ALLOW_SINGLE_SIGN_ON_USING_OS_PRIMARY_ACCOUNT_PROP);
570+
Boolean globalAllowSSO = Boolean.getBoolean(ALLOW_SINGLE_SIGN_ON_USING_OS_PRIMARY_ACCOUNT_PROP);
571+
boolean allowSSO = instanceAllowSSO != null ? instanceAllowSSO : globalAllowSSO;
572+
570573
String dataDir = getDataDir(display);
571574

572575
// Initialize options

bundles/org.eclipse.swt/Readme.WebView2.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,18 @@ language+country code that defines the browser UI language and preferred
6767
language for HTTP requests (`Accept-Languages` header).
6868
Example values: `en`, `ja`, `en-GB`, `de-AT`.
6969

70-
The properties `org.eclipse.swt.browser.Edge.allowSingleSignOnUsingOSPrimaryAccount` or its shorthand
71-
`org.eclipse.swt.browser.Edge.allowSSO` enable Single Sign-On with Azure Active Directory (AAD)
72-
resources using the logged-in Windows account. This also enables SSO with websites using
73-
Microsoft accounts associated with the Windows login. Setting either property to true enables
74-
this feature. The default value is false.
70+
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.
71+
72+
This property can be set at two levels:
73+
74+
1. Global level: Set as a system property before creating any Browser instances.
75+
76+
2. Instance level: Set using the `setData()` method on a specific Browser instance. This takes precedence over the global setting.
77+
Example:
78+
```java
79+
Browser browser = new Browser(parent, SWT.NONE);
80+
browser.setData("org.eclipse.swt.browser.Edge.allowSingleSignOnUsingOSPrimaryAccount", Boolean.TRUE);
81+
```
7582

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

0 commit comments

Comments
 (0)