Skip to content

Commit c197661

Browse files
committed
riot-desktop open SSO in browser so user doesn't have to auth twice
1 parent e238fea commit c197661

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

‎src/i18n/strings/en_EN.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.": "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.",
88
"Invalid configuration: no default server specified.": "Invalid configuration: no default server specified.",
99
"Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s",
10+
"Single sign-on": "Single sign-on",
11+
"Go to the browser to complete login": "Go to the browser to complete login",
1012
"Unknown device": "Unknown device",
1113
"%(appName)s via %(browserName)s on %(osName)s": "%(appName)s via %(browserName)s on %(osName)s",
1214
"You need to be using HTTPS to place a screen-sharing call.": "You need to be using HTTPS to place a screen-sharing call.",

‎src/vector/platform/ElectronPlatform.js‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Copyright 2016 Aviral Dasgupta
55
Copyright 2016 OpenMarket Ltd
66
Copyright 2018 New Vector Ltd
77
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
8+
`Copyright 2020 The Matrix.org Foundation C.I.C.
89
910
Licensed under the Apache License, Version 2.0 (the "License");
1011
you may not use this file except in compliance with the License.
@@ -24,6 +25,11 @@ import BaseEventIndexManager from 'matrix-react-sdk/src/indexing/BaseEventIndexM
2425
import dis from 'matrix-react-sdk/src/dispatcher';
2526
import { _t } from 'matrix-react-sdk/src/languageHandler';
2627
import * as rageshake from 'matrix-react-sdk/src/rageshake/rageshake';
28+
import {MatrixClient} from "matrix-js-sdk";
29+
import Modal from "matrix-react-sdk/src/Modal";
30+
import InfoDialog from "matrix-react-sdk/src/components/views/dialogs/InfoDialog";
31+
import Spinner from "matrix-react-sdk/src/components/views/elements/Spinner";
32+
import React from "react";
2733

2834
const ipcRenderer = window.ipcRenderer;
2935

@@ -392,4 +398,21 @@ export default class ElectronPlatform extends VectorBasePlatform {
392398
console.error(error);
393399
});
394400
}
401+
402+
getSSOCallbackUrl(hsUrl: string, isUrl: string): URL {
403+
const url = super.getSSOCallbackUrl(hsUrl, isUrl);
404+
url.protocol = "riot";
405+
return url;
406+
}
407+
408+
startSingleSignOn(mxClient: MatrixClient, loginType: "sso" | "cas") {
409+
super.startSingleSignOn(mxClient, loginType); // this will get intercepted by electron-main will-navigate
410+
Modal.createTrackedDialog('Electron', 'SSO', InfoDialog, {
411+
title: _t("Single sign-on"),
412+
description: <div>
413+
{_t("Go to the browser to complete login")}
414+
<Spinner />
415+
</div>,
416+
});
417+
}
395418
}

0 commit comments

Comments
 (0)