new initialization process, keycloak update 24.0.4
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { Router } from '@angular/router';
|
||||
import { ConsoleFormattedStream, INFO, createLogger as _createLogger, stdSerializers } from 'browser-bunyan';
|
||||
import { jwtDecode } from 'jwt-decode';
|
||||
import { BusinessListing, CommercialPropertyListing } from '../../../../bizmatch-server/src/models/db.model';
|
||||
import { ListingCriteria } from '../../../../bizmatch-server/src/models/main.model';
|
||||
import { JwtToken, KeycloakUser, ListingCriteria } from '../../../../bizmatch-server/src/models/main.model';
|
||||
|
||||
export function createDefaultCommercialPropertyListing(): CommercialPropertyListing {
|
||||
return {
|
||||
@@ -116,3 +117,16 @@ export function resetCriteria(criteria: ListingCriteria) {
|
||||
criteria.title = null;
|
||||
criteria.name = null;
|
||||
}
|
||||
export function map2User(jwt: string): KeycloakUser {
|
||||
if (jwt) {
|
||||
const token = jwtDecode<JwtToken>(jwt);
|
||||
return {
|
||||
id: token.user_id,
|
||||
firstName: token.given_name,
|
||||
lastName: token.family_name,
|
||||
email: token.email,
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user