Skip to content

Commit 914bc40

Browse files
committed
Merge branch 'release/16.1'
2 parents 9cb8dc7 + aa90253 commit 914bc40

File tree

4 files changed

+31
-39
lines changed

4 files changed

+31
-39
lines changed

src/Umbraco.Web.UI.Client/package-lock.json

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Umbraco.Web.UI.Client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
"@tiptap/extension-underline": "2.11.7",
216216
"@tiptap/pm": "2.11.7",
217217
"@tiptap/starter-kit": "2.11.7",
218-
"@umbraco-ui/uui": "1.14.1",
218+
"@umbraco-ui/uui": "1.14.2",
219219
"@umbraco-ui/uui-css": "1.14.1",
220220
"dompurify": "^3.2.5",
221221
"element-internals-polyfill": "^3.0.2",

src/Umbraco.Web.UI.Client/src/packages/core/auth/auth-flow.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ export class UmbAuthFlow {
9393
readonly #postLogoutRedirectUri: string;
9494
readonly #clientId: string;
9595
readonly #scope: string;
96-
readonly #timeoutSignal;
9796

9897
// tokens
9998
#tokenResponse?: TokenResponse;
@@ -113,13 +112,11 @@ export class UmbAuthFlow {
113112
openIdConnectUrl: string,
114113
redirectUri: string,
115114
postLogoutRedirectUri: string,
116-
timeoutSignal: Subject<void>,
117115
clientId = 'umbraco-back-office',
118116
scope = 'offline_access',
119117
) {
120118
this.#redirectUri = redirectUri;
121119
this.#postLogoutRedirectUri = postLogoutRedirectUri;
122-
this.#timeoutSignal = timeoutSignal;
123120
this.#clientId = clientId;
124121
this.#scope = scope;
125122

@@ -305,25 +302,25 @@ export class UmbAuthFlow {
305302
/**
306303
* This method will check if the token needs to be refreshed and if so, it will refresh it and return the new access token.
307304
* If the token does not need to be refreshed, it will return the current access token.
308-
* @returns The access token for the user.
305+
* @returns {Promise<string>} The access token for the user.
309306
*/
310307
async performWithFreshTokens(): Promise<string> {
311308
// if the access token is valid, return it
312309
if (this.#tokenResponse?.isValid()) {
313310
return Promise.resolve(this.#tokenResponse.accessToken);
314311
}
315312

313+
// if the access token is not valid, try to refresh it
316314
const success = await this.makeRefreshTokenRequest();
315+
const newToken = this.#tokenResponse?.accessToken ?? '';
317316

318317
if (!success) {
318+
// if the refresh token request failed, we need to clear the token state
319319
this.clearTokenStorage();
320-
this.#timeoutSignal.next();
321-
return Promise.reject('Missing tokenResponse.');
322320
}
323321

324-
return this.#tokenResponse
325-
? Promise.resolve(this.#tokenResponse.accessToken)
326-
: Promise.reject('Missing tokenResponse.');
322+
// if the refresh token request was successful, return the new access token
323+
return Promise.resolve(newToken);
327324
}
328325

329326
/**

src/Umbraco.Web.UI.Client/src/packages/core/auth/auth.context.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,7 @@ export class UmbAuthContext extends UmbContextBase {
7373
this.#serverUrl = serverUrl;
7474
this.#backofficePath = backofficePath;
7575

76-
this.#authFlow = new UmbAuthFlow(
77-
serverUrl,
78-
this.getRedirectUrl(),
79-
this.getPostLogoutRedirectUrl(),
80-
this.#isTimeout,
81-
);
76+
this.#authFlow = new UmbAuthFlow(serverUrl, this.getRedirectUrl(), this.getPostLogoutRedirectUrl());
8277

8378
// Observe the authorization signal and close the auth window
8479
this.observe(

0 commit comments

Comments
 (0)