Skip to content

Commit

Permalink
SDA-3900 Third-party browser login (#1701)
Browse files Browse the repository at this point in the history
* SDA-3901 (Add new implementation for welcome screen) (#1519)

* SDA-3901 - Add new welcome screen

* SDA-3901 - Change to global config

* SDA-3901 - Add locale

* SDA-3901 - Reposition protocol handling

* SDA-3901 - Fix protocol handler

* SDA-3901 - Fix protocol handler

* SDA-3901 - Fix welcome screen load

* SDA-3901 - Fix seamless login url

* SDA-3901 - Validate if pod is configured for SSO

* SDA-3900 Several bug fix

* SDA-3900 Ability to enable third-party browser login via command line install

* SDA-3900 Typo fix

---------

Co-authored-by: Kiran Niranjan <kiran.niranjan@symphony.com>
  • Loading branch information
sbenmoussati and KiranNiranjan committed Feb 8, 2023
1 parent 2fd56a0 commit 33664a8
Show file tree
Hide file tree
Showing 24 changed files with 814 additions and 163 deletions.
1 change: 1 addition & 0 deletions config/Symphony.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"autoUpdateChannel": "latest",
"isAutoUpdateEnabled": true,
"autoUpdateCheckInterval": "30",
"enableSeamlessLogin": false,
"overrideUserAgent": false,
"minimizeOnClose" : "ENABLED",
"launchOnStartup" : "ENABLED",
Expand Down
5 changes: 3 additions & 2 deletions installer/win/WixSharpInstaller/Symphony.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ static public void Main(string[] args)
new PublicProperty("POINTER_LOCK", "true"),
new PublicProperty("USER_DATA_PATH", ""),
new PublicProperty("OVERRIDE_USER_AGENT", "false"),
new PublicProperty("ENABLE_SEAMLESS_LOGIN", "false"),
new PublicProperty("CHROME_FLAGS", ""),
new Property("MSIINSTALLPERUSER", "1"),
new Property("PROGRAMSFOLDER", System.Environment.ExpandEnvironmentVariables(@"%PROGRAMFILES%"))
Expand Down Expand Up @@ -185,7 +186,7 @@ static public void Main(string[] args)
new ElevatedManagedAction(CustomActions.UpdateConfig, Return.check, When.After, Step.InstallFiles, Condition.NOT_BeingRemoved )
{
// The UpdateConfig action needs the built-in property INSTALLDIR as well as most of the custom properties
UsesProperties = "INSTALLDIR,POD_URL,CONTEXT_ORIGIN_URL,MINIMIZE_ON_CLOSE,ALWAYS_ON_TOP,AUTO_START,BRING_TO_FRONT,MEDIA,LOCATION,NOTIFICATIONS,MIDI_SYSEX,POINTER_LOCK,FULL_SCREEN,OPEN_EXTERNAL,CUSTOM_TITLE_BAR,DEV_TOOLS_ENABLED,AUTO_LAUNCH_PATH,USER_DATA_PATH,OVERRIDE_USER_AGENT,CHROME_FLAGS"
UsesProperties = "INSTALLDIR,POD_URL,CONTEXT_ORIGIN_URL,MINIMIZE_ON_CLOSE,ALWAYS_ON_TOP,AUTO_START,BRING_TO_FRONT,MEDIA,LOCATION,NOTIFICATIONS,MIDI_SYSEX,POINTER_LOCK,FULL_SCREEN,OPEN_EXTERNAL,CUSTOM_TITLE_BAR,DEV_TOOLS_ENABLED,AUTO_LAUNCH_PATH,USER_DATA_PATH,OVERRIDE_USER_AGENT,CHROME_FLAGS,ENABLE_SEAMLESS_LOGIN"
},

// CleanRegistry
Expand Down Expand Up @@ -359,7 +360,7 @@ public static ActionResult UpdateConfig(Session session)
data = ReplaceBooleanProperty(data, "fullscreen", session.Property("FULL_SCREEN"));
data = ReplaceBooleanProperty(data, "devToolsEnabled", session.Property("DEV_TOOLS_ENABLED"));
data = ReplaceBooleanProperty(data, "overrideUserAgent", session.Property("OVERRIDE_USER_AGENT"));

data = ReplaceBooleanProperty(data, "enableSeamlessLogin", session.Property("ENABLE_SEAMLESS_LOGIN"));
// Write the contents back to the file
System.IO.File.WriteAllText(filename, data);
}
Expand Down
25 changes: 25 additions & 0 deletions installer/win/install_instructions_win.md
Original file line number Diff line number Diff line change
Expand Up @@ -529,3 +529,28 @@ Expected values:
msiexec /i Symphony.msi CHROME_FLAGS="--debug --debug2 --debug3"


-------------------------------------------------------------------
### ENABLE_SEAMLESS_LOGIN

Expected values:

* "true"
SDA will authenticate the user by relying on third-party browser
* "false"
SDA will authenticate the user in SDA

#### Example, install with user-agent override

msiexec /i Symphony.msi ENABLE_SEAMLESS_LOGIN="true"

#### Example, install without user-agent override

msiexec /i Symphony.msi ENABLE_SEAMLESS_LOGIN="false"

or

msiexec /i Symphony.msi



-------------------------------------------------------------------
28 changes: 17 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,4 @@
"pre-commit": "pretty-quick --staged && npm run lint"
}
}
}
}
1 change: 1 addition & 0 deletions spec/__mocks__/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ export const BrowserWindow = {
export const session = {
defaultSession: {
clearCache: jest.fn(),
cookies: jest.fn(),
},
};

Expand Down
156 changes: 130 additions & 26 deletions spec/__snapshots__/welcome.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,151 @@ exports[`welcome should render correctly 1`] = `
<div
className="Welcome"
lang="en-US"
style={
Object {
"height": "494px",
}
}
>
<div
className="Welcome-image-container"
className="Welcome-content"
>
<img
alt="Symphony Logo"
src="../renderer/assets/symphony-logo-plain.png"
/>
</div>
<div
className="Welcome-main-container"
>
<h3
className="Welcome-name"
<div
className="Welcome-image-container"
>
Pod URL
</h3>
<svg
fill="none"
height="70"
viewBox="0 0 296 70"
width="296"
xmlns="http://www.w3.org/2000/svg"
>
<path
clip-rule="evenodd"
d="M44.0497 27.1163V18.546C44.0497 16.7907 43.1018 15.1409 41.5765 14.2407C39.2929 12.8926 34.3464 10.6321 26.8796 10.6321C19.4127 10.6321 14.4663 12.8926 12.1826 14.2407C10.6573 15.1409 9.70941 16.7907 9.70941 18.546V31.4166L36.8955 39.3004V45.034C36.8955 45.8102 36.409 46.3542 35.582 46.7584L26.8796 51.126L18.1321 46.7362C17.3501 46.3542 16.8636 45.8102 16.8636 45.034V40.7338L9.70941 38.5836V45.034C9.70941 48.5753 11.7369 51.5883 14.9563 53.1579L26.8796 59.3681L38.7585 53.1801C42.0222 51.5883 44.0497 48.5753 44.0497 45.034V34.2834L16.8636 26.3996V19.8554C18.806 18.9165 22.1177 17.7991 26.8796 17.7991C31.6414 17.7991 34.9531 18.9165 36.8955 19.8554V24.9662L44.0497 27.1163Z"
fill="#008EFF"
fill-rule="evenodd"
/>
<path
clip-rule="evenodd"
d="M79.6153 47.1841C75.3165 47.1841 71.6321 45.7833 68.3233 43.6982L70.3703 40.5877C73.6791 42.7072 76.7152 43.7326 80.1269 43.7326C84.1189 43.7326 85.9951 42.1941 85.9951 40.3832C85.9951 35.1886 69.1076 38.2981 69.1076 30.0275C69.1076 25.9949 73.1336 22.8167 79.6153 22.8167C83.9821 22.8167 87.7685 24.4574 89.9863 26.6782L87.4617 29.2764C85.5515 27.6013 82.6174 26.2682 79.5474 26.2682C75.7601 26.2682 73.2016 27.6357 73.2016 29.5832C73.2016 34.4022 90.1231 31.8393 90.1231 39.9733C90.1231 44.2792 85.7903 47.1841 79.6153 47.1841Z"
fill="#F8F8F8"
fill-rule="evenodd"
/>
<path
clip-rule="evenodd"
d="M106.67 37.2388V46.3637H102.576V37.2044L92.3418 23.6025H97.1172L104.794 34.1283L112.061 23.6025H116.768L106.67 37.2388Z"
fill="#F8F8F8"
fill-rule="evenodd"
/>
<path
clip-rule="evenodd"
d="M145.324 46.3637V28.5238L144.198 30.9501L136.146 46.3637H133.69L125.742 30.9501L124.616 28.5238V46.3637H120.692V23.6025H126.389L134.031 38.913L135.089 41.237L136.146 38.913L143.686 23.6025H149.315V46.3637H145.324Z"
fill="#F8F8F8"
fill-rule="evenodd"
/>
<path
clip-rule="evenodd"
d="M171.582 30.3695C171.582 28.4899 170.32 27.089 167.216 27.089H159.676V34.4365H167.386C170.49 34.4365 171.582 32.9324 171.582 31.0871V30.3695ZM166.772 37.7859H159.676V46.3642H155.582V23.603H166.772C172.981 23.603 175.71 26.4048 175.71 30.3695V30.9849C175.71 34.9487 172.981 37.7859 166.772 37.7859Z"
fill="#F8F8F8"
fill-rule="evenodd"
/>
<path
clip-rule="evenodd"
d="M198.016 46.3637V36.5555H184.335V46.3637H180.242V23.6025H184.335V33.2406H198.016V23.6025H202.11V46.3637H198.016Z"
fill="#F8F8F8"
fill-rule="evenodd"
/>
<path
clip-rule="evenodd"
d="M226.83 33.5818C226.83 29.6858 224.135 26.3365 219.155 26.3365C214.173 26.3365 211.512 29.6858 211.512 33.5818V36.3501C211.512 40.246 214.173 43.6642 219.155 43.6642C224.135 43.6642 226.83 40.246 226.83 36.3501V33.5818ZM219.154 47.1837C211.853 47.1837 207.383 41.9891 207.383 36.419V33.5818C207.383 27.9085 211.853 22.8162 219.154 22.8162C226.488 22.8162 230.957 27.9085 230.957 33.5818V36.419C230.957 41.9891 226.488 47.1837 219.154 47.1837Z"
fill="#F8F8F8"
fill-rule="evenodd"
/>
<path
clip-rule="evenodd"
d="M254.595 46.3637L241.87 31.9754L240.232 29.8569V46.3637H236.172V23.6025H239.959L252.275 38.0252L253.946 40.1438V23.6025H257.972V46.3637H254.595Z"
fill="#F8F8F8"
fill-rule="evenodd"
/>
<path
clip-rule="evenodd"
d="M276.192 37.2388V46.3637H272.098V37.2044L261.864 23.6025H266.64L274.316 34.1283L281.583 23.6025H286.29L276.192 37.2388Z"
fill="#F8F8F8"
fill-rule="evenodd"
/>
</svg>
</div>
<div
className="Welcome-main-container-input-div"
className="Welcome-about-symphony-text"
style={
Object {
"marginTop": "8px",
}
}
>
<span>
Welcome to the largest global community in financial services with over
</span>
<span
className="Welcome-text-bold"
>
half a million users
</span>
<span>
and more than
</span>
<span
className="Welcome-text-bold"
>
1,000 institutions.
</span>
</div>
<div>
<div
className="Welcome-main-container-input-selection"
className="Welcome-login-text"
>
<input
className="Welcome-main-container-podurl-box"
onChange={[Function]}
type="url"
value="https://[POD].symphony.com"
/>
<span>
Log in with your pod URL
</span>
</div>
<div
className="Welcome-input-container"
>
<span>
Pod URL
</span>
<div>
<input
className="Welcome-main-container-podurl-box"
data-testid="Welcome-main-container-podurl-box"
onChange={[Function]}
type="url"
value="https://[POD].symphony.com"
/>
<label
className="Welcome-input-message"
>
Find your pod URL in your invitation email.
</label>
</div>
</div>
</div>
<label
className="Welcome-message-label"
/>
<button
className="Welcome-continue-button-disabled"
className="Welcome-continue-button"
disabled={true}
onClick={[Function]}
style={Object {}}
>
Continue
log in
</button>
<div
className="Welcome-redirect-info-text-container"
>
<span>
You’ll momentarily be redirected to your web browser.
</span>
</div>
</div>
</div>
`;
16 changes: 16 additions & 0 deletions spec/protocolHandler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ jest.mock('../src/common/utils', () => {
};
});

jest.mock('../src/app/window-handler', () => {
return {
windowHandler: {
url: '',
},
};
});

jest.mock('../src/common/env', () => {
return {
isWindowsOS: false,
Expand All @@ -34,6 +42,14 @@ jest.mock('../src/common/logger', () => {
};
});

jest.mock('../src/app/config-handler', () => {
return {
config: {
getUserConfigFields: jest.fn(() => ''),
},
};
});

describe('protocol handler', () => {
let protocolHandlerInstance;

Expand Down
18 changes: 17 additions & 1 deletion spec/welcome.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ describe('welcome', () => {
url: 'https://my.symphony.com',
message: '',
urlValid: true,
isPodConfigured: false,
isSeamlessLoginEnabled: true,
};
const onLabelEvent = 'on';
const removeListenerLabelEvent = 'removeListener';
Expand Down Expand Up @@ -94,7 +96,7 @@ describe('welcome', () => {

it('should set pod url', () => {
const spy = jest.spyOn(Welcome.prototype, 'setState');
const setPodUrlSpy = jest.spyOn(Welcome.prototype, 'setPodUrl');
const setPodUrlSpy = jest.spyOn(Welcome.prototype, 'login');

const wrapper = shallow(React.createElement(Welcome));
ipcRenderer.send('welcome', welcomeMock);
Expand All @@ -104,4 +106,18 @@ describe('welcome', () => {
expect(setPodUrlSpy).toBeCalled();
expect(spy).toBeCalledWith(welcomeMock);
});

it('should not show pod url input field', () => {
const welcomeMock = {
url: 'https://my.symphony.com',
message: '',
urlValid: true,
isPodConfigured: true,
isSeamlessLoginEnabled: true,
};
const wrapper = shallow(React.createElement(Welcome));
ipcRenderer.send('welcome', welcomeMock);
const podUrlBox = `input.Welcome-main-container-podurl-box`;
expect(wrapper.find(podUrlBox).getElements()).toEqual([]);
});
});
Loading

0 comments on commit 33664a8

Please sign in to comment.