Skip to content

Commit

Permalink
ENG-0000 - Misc Enhancements
Browse files Browse the repository at this point in the history
Removes logging; prevents use of keycloak-js when an explicit aims_token
query parameter is provided; nicens "mock mode."
  • Loading branch information
mcnielsen committed Dec 16, 2024
1 parent f343216 commit 3e98a95
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@al/core",
"version": "1.2.50",
"version": "1.2.51",
"description": "Node Enterprise Packages for Alert Logic (NEPAL) Core Library",
"main": "./dist/index.cjs.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 2 additions & 0 deletions src/client/al-api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export class AlApiClient implements AlValidationSchemaProvider
public verbose:boolean = false;
public collectRequestLog:boolean = false;
public mockMode:boolean = false; // If true, requests will be normalized but not actually dispatched.
public mockRequests:any[] = [];
public defaultAccountId:string = null; // If specified, uses *this* account ID to resolve endpoints if no other account ID is explicitly specified

private storage = AlCabinet.local( 'apiclient.cache' );
Expand Down Expand Up @@ -1011,6 +1012,7 @@ export class AlApiClient implements AlValidationSchemaProvider
}
if ( this.mockMode ) {
return new Promise( ( resolve, reject ) => {
this.mockRequests.push( { resolve, reject, request:config, method: config.method ?? "GET", url: config.url ?? "uncalculated" } );
} );
}
if ( this.beforeRequest ) {
Expand Down
1 change: 0 additions & 1 deletion src/session/utilities/al-conduit-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export class AlConduitClient
}
let locationId = AlRuntimeConfiguration.getOption<string>( ConfigOption.NavigationConduitLocation, AlLocation.AccountsUI );
AlConduitClient.conduitUri = AlLocatorService.resolveURL( locationId, '/conduit.html', { residency, environment } );
console.log("Setting conduit frame src to [%s]", AlConduitClient.conduitUri );
AlErrorHandler.log( `Notice: conduit client is using '${AlConduitClient.conduitUri}' as target` );
const fragment = AlConduitClient.document.createDocumentFragment();
const container = AlConduitClient.document.createElement( "div" );
Expand Down
6 changes: 5 additions & 1 deletion src/session/utilities/al-identity-providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export class AlIdentityProviders
return true;
}

public static usingTokenInjection( url:string ):boolean {
return /\?.*aims_token=[a-zA-Z0-9\-+]+/.test( url );
}

/**
* This method initializes IdP clients using a heuristic mechanism differentiating auth0 from keycloak.
* This allows those clients to initiate and/or respond to redirection based OIDC authentication before the application
Expand All @@ -69,7 +73,7 @@ export class AlIdentityProviders
AlErrorHandler.log(e, "IdP Warmup: auth0 initialization failed" );
}
return this.maybeRewriteBrokenURL( targetURL );
} else {
} else if ( ! AlIdentityProviders.usingTokenInjection( targetURL ) ) {
await this.getKeycloak();
}
}
Expand Down

0 comments on commit 3e98a95

Please sign in to comment.