mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-19 01:51:27 +01:00
PM-8111 - (1) Cleanup DefaultLoginComponentService (2) Sso Connector now checks client id property instead of reading it from state
This commit is contained in:
parent
04fa618ea8
commit
8469e3541a
@ -6,10 +6,11 @@ window.addEventListener("load", () => {
|
||||
const code = getQsParam("code");
|
||||
const state = getQsParam("state");
|
||||
const lastpass = getQsParam("lp");
|
||||
const clientId = getQsParam("clientId");
|
||||
|
||||
if (lastpass === "1") {
|
||||
initiateBrowserSso(code, state, true);
|
||||
} else if (state != null && state.includes(":clientId=browser")) {
|
||||
} else if (state != null && clientId == "browser") {
|
||||
initiateBrowserSso(code, state, false);
|
||||
} else {
|
||||
window.location.href = window.location.origin + "/#/sso?code=" + code + "&state=" + state;
|
||||
|
@ -48,11 +48,7 @@ export class DefaultLoginComponentService implements LoginComponentService {
|
||||
special: false,
|
||||
};
|
||||
|
||||
let state = await this.passwordGenerationService.generatePassword(passwordOptions);
|
||||
// TODO-rr-bw: verify this is correct. Pulling this from original browser login component launchSsoBrowser method
|
||||
if (clientId === "browser") {
|
||||
state += ":clientId=browser";
|
||||
}
|
||||
const state = await this.passwordGenerationService.generatePassword(passwordOptions);
|
||||
|
||||
const codeVerifier = await this.passwordGenerationService.generatePassword(passwordOptions);
|
||||
const codeVerifierHash = await this.cryptoFunctionService.hash(codeVerifier, "sha256");
|
||||
@ -64,20 +60,16 @@ export class DefaultLoginComponentService implements LoginComponentService {
|
||||
|
||||
// Build URL
|
||||
const env = await firstValueFrom(this.environmentService.environment$);
|
||||
let url = env.getWebVaultUrl();
|
||||
// TODO-rr-bw: verify this is correct. Pulling this from original browser login component launchSsoBrowser method
|
||||
if (url == null) {
|
||||
url = "https://vault.bitwarden.com";
|
||||
}
|
||||
const webVaultUrl = env.getWebVaultUrl();
|
||||
|
||||
const redirectUri =
|
||||
clientId === "browser"
|
||||
? url + "/sso-connector.html" // Browser
|
||||
? webVaultUrl + "/sso-connector.html" // Browser
|
||||
: "bitwarden://sso-callback"; // Desktop
|
||||
|
||||
// Launch browser window with URL
|
||||
this.platformUtilsService.launchUri(
|
||||
url +
|
||||
webVaultUrl +
|
||||
"/#/sso?clientId=" +
|
||||
clientId +
|
||||
"&redirectUri=" +
|
||||
|
Loading…
Reference in New Issue
Block a user