Merge pull request #27017 from element-hq/t3chguy/oidc-desktop

Fix Native OIDC for Element Desktop
This commit is contained in:
Michael Telatynski 2024-02-19 15:30:19 +00:00 committed by GitHub
commit 35fe447aae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,6 +57,8 @@ interface SquirrelUpdate {
updateURL: string; updateURL: string;
} }
const SSO_ID_KEY = "element-desktop-ssoid";
const isMac = navigator.platform.toUpperCase().includes("MAC"); const isMac = navigator.platform.toUpperCase().includes("MAC");
function platformFriendlyName(): string { function platformFriendlyName(): string {
@ -378,7 +380,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
public getSSOCallbackUrl(fragmentAfterLogin: string): URL { public getSSOCallbackUrl(fragmentAfterLogin: string): URL {
const url = super.getSSOCallbackUrl(fragmentAfterLogin); const url = super.getSSOCallbackUrl(fragmentAfterLogin);
url.protocol = "element"; url.protocol = "element";
url.searchParams.set("element-desktop-ssoid", this.ssoID); url.searchParams.set(SSO_ID_KEY, this.ssoID);
return url; return url;
} }
@ -451,4 +453,8 @@ export default class ElectronPlatform extends VectorBasePlatform {
clientUri: "https://element.io", clientUri: "https://element.io",
}; };
} }
public getOidcClientState(): string {
return `:${SSO_ID_KEY}:${this.ssoID}`;
}
} }