feat: add DCB User Service API - Authentication system with KEYCLOAK - Modular architecture with services for each feature
This commit is contained in:
parent
fd43877036
commit
ab58c3f577
@ -123,7 +123,7 @@ export class KeycloakApiService {
|
|||||||
credentials?: any[];
|
credentials?: any[];
|
||||||
}): Promise<string> {
|
}): Promise<string> {
|
||||||
|
|
||||||
this.logger.debug(`🔍 CREATE USER - Input data:`, {
|
this.logger.debug(`CREATE USER - Input data:`, {
|
||||||
username: userData.username,
|
username: userData.username,
|
||||||
hasPassword: !!userData.password,
|
hasPassword: !!userData.password,
|
||||||
hasCredentials: !!userData.credentials,
|
hasCredentials: !!userData.credentials,
|
||||||
@ -153,7 +153,7 @@ export class KeycloakApiService {
|
|||||||
throw new BadRequestException('Password is required');
|
throw new BadRequestException('Password is required');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.debug(`🔍 CREATE USER - Final Keycloak payload:`, JSON.stringify(userPayload, null, 2));
|
this.logger.debug(`CREATE USER - Final Keycloak payload:`, JSON.stringify(userPayload, null, 2));
|
||||||
|
|
||||||
// Format correct des attributs
|
// Format correct des attributs
|
||||||
if (userData.attributes) {
|
if (userData.attributes) {
|
||||||
@ -168,7 +168,7 @@ export class KeycloakApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
userPayload.attributes = formattedAttributes;
|
userPayload.attributes = formattedAttributes;
|
||||||
this.logger.debug(`🔍 CREATE USER - Formatted attributes:`, formattedAttributes);
|
this.logger.debug(`CREATE USER - Formatted attributes:`, formattedAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -184,9 +184,9 @@ export class KeycloakApiService {
|
|||||||
this.logger.log(`User created successfully with ID: ${users[0].id}`);
|
this.logger.log(`User created successfully with ID: ${users[0].id}`);
|
||||||
return users[0].id!;
|
return users[0].id!;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
this.logger.error(`❌ FAILED to create user in Keycloak: ${error.message}`);
|
this.logger.error(`FAILED to create user in Keycloak: ${error.message}`);
|
||||||
if (error.response?.data) {
|
if (error.response?.data) {
|
||||||
this.logger.error(`❌ Keycloak error response: ${JSON.stringify(error.response.data)}`);
|
this.logger.error(`Keycloak error response: ${JSON.stringify(error.response.data)}`);
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user