add logger
This commit is contained in:
parent
4ee4842f74
commit
f631395f61
@ -8,6 +8,7 @@ import { KeycloakService } from 'keycloak-angular';
|
||||
import { BASE_HREF } from '../../utils';
|
||||
import { getKeycloakOptions } from '../keycloak-initializer';
|
||||
import { KeycloakStatusService } from '../services/keycloak-status.service';
|
||||
import { NGXLogger } from 'ngx-logger';
|
||||
|
||||
@Component({
|
||||
templateUrl: './tenant-select.component.html',
|
||||
@ -16,6 +17,7 @@ import { KeycloakStatusService } from '../services/keycloak-status.service';
|
||||
})
|
||||
export class TenantSelectComponent {
|
||||
protected readonly baseHref = inject(BASE_HREF);
|
||||
protected readonly logger = inject(NGXLogger);
|
||||
protected readonly storedTenants = inject(TenantsService)
|
||||
.getStoredTenants()
|
||||
.sort((a, b) => a.tenantId.localeCompare(b.tenantId));
|
||||
@ -44,8 +46,10 @@ export class TenantSelectComponent {
|
||||
|
||||
async select(tenantId: string, email?: string) {
|
||||
try {
|
||||
this.logger.info('[KEYCLOAK] Initializing keycloak for tenant', tenantId);
|
||||
await this.keycloakService.init(getKeycloakOptions(this.baseHref, this.config, tenantId));
|
||||
} catch (e) {
|
||||
this.logger.info('[KEYCLOAK] Init failed. Logout');
|
||||
return this.keycloakService.logout();
|
||||
}
|
||||
const url = this.keycloakService.getKeycloakInstance().createLoginUrl({
|
||||
@ -53,7 +57,8 @@ export class TenantSelectComponent {
|
||||
idpHint: this.config.OAUTH_IDP_HINT,
|
||||
loginHint: email ?? undefined,
|
||||
});
|
||||
console.log('LOGIN URL', url);
|
||||
|
||||
this.logger.info('[KEYCLOAK] Init succeeded. Logout and redirect to', url);
|
||||
return this.keycloakService.logout(url);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user