Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Remove isBroker flag from initialize",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"comment": "Remove isBroker flag from initialize",
"comment": "Remove isBroker flag from initialize, #8075 ",

"packageName": "@azure/msal-browser",
"email": "[email protected]",
"dependentChangeType": "patch"
}
2 changes: 1 addition & 1 deletion lib/msal-browser/apiReview/msal-browser.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ export interface IController {
// (undocumented)
hydrateCache(result: AuthenticationResult, request: SilentRequest | SsoSilentRequest | RedirectRequest | PopupRequest): Promise<void>;
// (undocumented)
initialize(request?: InitializeApplicationRequest, isBroker?: boolean): Promise<void>;
initialize(request?: InitializeApplicationRequest): Promise<void>;
// (undocumented)
initializeWrapperLibrary(sku: WrapperSKU, version: string): void;
// @internal (undocumented)
Expand Down
2 changes: 1 addition & 1 deletion lib/msal-browser/src/app/PublicClientApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class PublicClientApplication implements IPublicClientApplication {
* @param request {?InitializeApplicationRequest}
*/
async initialize(request?: InitializeApplicationRequest): Promise<void> {
return this.controller.initialize(request, this.isBroker);
return this.controller.initialize(request);
}

/**
Expand Down
5 changes: 1 addition & 4 deletions lib/msal-browser/src/controllers/IController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ import { EventType } from "../event/EventType.js";

export interface IController {
// TODO: Make request mandatory in the next major version?
initialize(
request?: InitializeApplicationRequest,
isBroker?: boolean
): Promise<void>;
initialize(request?: InitializeApplicationRequest): Promise<void>;

acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,7 @@ export class NestedAppAuthController implements IController {
* Specific implementation of initialize function for NestedAppAuthController
* @returns
*/
async initialize(
request?: InitializeApplicationRequest,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
isBroker?: boolean
): Promise<void> {
async initialize(request?: InitializeApplicationRequest): Promise<void> {
const initCorrelationId = request?.correlationId || createNewGuid();
await this.browserStorage.initialize(initCorrelationId);
return Promise.resolve();
Expand Down
12 changes: 2 additions & 10 deletions lib/msal-browser/src/controllers/StandardController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,7 @@ export class StandardController implements IController {
* Initializer function to perform async startup tasks such as connecting to WAM extension
* @param request {?InitializeApplicationRequest} correlation id
*/
async initialize(
request?: InitializeApplicationRequest,
isBroker?: boolean
): Promise<void> {
async initialize(request?: InitializeApplicationRequest): Promise<void> {
const correlationId = this.getRequestCorrelationId(request);
this.logger.trace("initialize called", correlationId);
if (this.initialized) {
Expand Down Expand Up @@ -319,12 +316,7 @@ export class StandardController implements IController {
);
this.eventHandler.emitEvent(EventType.INITIALIZE_START);

// Broker applications are initialized twice, so we avoid double-counting it
if (!isBroker) {
try {
this.logMultipleInstances(initMeasurement, initCorrelationId);
} catch {}
}
this.logMultipleInstances(initMeasurement, initCorrelationId);

await invokeAsync(
this.browserStorage.initialize.bind(this.browserStorage),
Expand Down
20 changes: 0 additions & 20 deletions lib/msal-browser/test/app/PublicClientApplication.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -682,26 +682,6 @@ describe("PublicClientApplication.ts Class Unit Tests", () => {

expect(preGenerateSpy).toHaveBeenCalledTimes(1);
});

it("passes in isBroker in request", async () => {
pca = new PublicClientApplication({
auth: {
clientId: TEST_CONFIG.MSAL_CLIENT_ID,
},
system: {
allowPlatformBroker: false,
},
});
const initializeControllerSpy = jest.spyOn(
StandardController.prototype,
"initialize"
);
await pca.initialize();
expect(initializeControllerSpy).toHaveBeenCalledWith(
undefined,
false
);
});
});

describe("handleRedirectPromise", () => {
Expand Down