@@ -112,11 +112,16 @@ export class AuthenticationHelper<T extends MainThreadClientConfig | WebWorkerCl
112112 if ( config ?. tokenEndpoint ) {
113113 useDefaultEndpoint = false ;
114114
115- for ( const baseUrl of [ ...( _config ?. allowedExternalUrls ?? [ ] ) , ( config as any ) . baseUrl ] ) {
116- if ( baseUrl && config . tokenEndpoint ?. startsWith ( baseUrl ) ) {
117- matches = true ;
118- break ;
115+ // Only validate URLs for WebWorker storage
116+ if ( _config . storage === BrowserStorage . WebWorker ) {
117+ for ( const baseUrl of [ ...( _config ?. allowedExternalUrls ?? [ ] ) , ( config as any ) . baseUrl ] ) {
118+ if ( baseUrl && config . tokenEndpoint ?. startsWith ( baseUrl ) ) {
119+ matches = true ;
120+ break ;
121+ }
119122 }
123+ } else {
124+ matches = true ;
120125 }
121126 }
122127
@@ -227,12 +232,17 @@ export class AuthenticationHelper<T extends MainThreadClientConfig | WebWorkerCl
227232 let matches = false ;
228233 const config : Config = ( await this . _storageManager . getConfigData ( ) ) as Config ;
229234
230- for ( const baseUrl of [ ...( config ?. allowedExternalUrls ?? [ ] ) , ( config as any ) . baseUrl ] ) {
231- if ( baseUrl && requestConfig ?. url ?. startsWith ( baseUrl ) ) {
232- matches = true ;
235+ // Only validate URLs for WebWorker storage
236+ if ( config . storage === BrowserStorage . WebWorker ) {
237+ for ( const baseUrl of [ ...( config ?. allowedExternalUrls ?? [ ] ) , ( config as any ) . baseUrl ] ) {
238+ if ( baseUrl && requestConfig ?. url ?. startsWith ( baseUrl ) ) {
239+ matches = true ;
233240
234- break ;
241+ break ;
242+ }
235243 }
244+ } else {
245+ matches = true ;
236246 }
237247
238248 if ( matches ) {
@@ -338,21 +348,24 @@ export class AuthenticationHelper<T extends MainThreadClientConfig | WebWorkerCl
338348 let matches = true ;
339349 const config : Config = ( await this . _storageManager . getConfigData ( ) ) as Config ;
340350
341- for ( const requestConfig of requestConfigs ) {
342- let urlMatches = false ;
351+ // Only validate URLs for WebWorker storage
352+ if ( config . storage === BrowserStorage . WebWorker ) {
353+ for ( const requestConfig of requestConfigs ) {
354+ let urlMatches = false ;
343355
344- for ( const baseUrl of [ ...( config ?. allowedExternalUrls ?? [ ] ) , ( config as any ) . baseUrl ] ) {
345- if ( baseUrl && requestConfig . url ?. startsWith ( baseUrl ) ) {
346- urlMatches = true ;
356+ for ( const baseUrl of [ ...( config ?. allowedExternalUrls ?? [ ] ) , ( config as any ) . baseUrl ] ) {
357+ if ( baseUrl && requestConfig . url ?. startsWith ( baseUrl ) ) {
358+ urlMatches = true ;
347359
348- break ;
360+ break ;
361+ }
349362 }
350- }
351363
352- if ( ! urlMatches ) {
353- matches = false ;
364+ if ( ! urlMatches ) {
365+ matches = false ;
354366
355- break ;
367+ break ;
368+ }
356369 }
357370 }
358371
0 commit comments