diff --git a/services/tenant-management-service/src/controllers/idp.controller.ts b/services/tenant-management-service/src/controllers/idp.controller.ts index 91ba9aa..93187b1 100644 --- a/services/tenant-management-service/src/controllers/idp.controller.ts +++ b/services/tenant-management-service/src/controllers/idp.controller.ts @@ -48,18 +48,17 @@ export class IdpController { }) payload: IdpDetailsDTO, ): Promise { - let res:IdpResp={ - authId:"" + let res: IdpResp = { + authId: '', }; - switch (payload.identityProvider) { - + switch (payload.tenant.identityProvider) { case IdPKey.AUTH0: - let auth0Resp=await this.idpAuth0Provider(payload); + let auth0Resp = await this.idpAuth0Provider(payload); return auth0Resp; case IdPKey.COGNITO: break; case IdPKey.KEYCLOAK: - let keycloakResp=await this.idpKeycloakProvider(payload); + let keycloakResp = await this.idpKeycloakProvider(payload); return keycloakResp; default: diff --git a/services/tenant-management-service/src/models/dtos/idp-details-dto.model.ts b/services/tenant-management-service/src/models/dtos/idp-details-dto.model.ts index 9247c1f..7dec337 100644 --- a/services/tenant-management-service/src/models/dtos/idp-details-dto.model.ts +++ b/services/tenant-management-service/src/models/dtos/idp-details-dto.model.ts @@ -6,24 +6,13 @@ import {TenantDto} from './tenant-dto.model'; @model({ description: 'model describing payload for IDP controller', }) -export class IdpDetailsDTO extends Model implements IdpDetails { - @property({ - type: 'string', - description: 'identity provider - auth0 , keycloak , cognito', - required: true, - default: IdPKey.AUTH0, - jsonSchema: { - enum: Object.values(IdPKey), - }, - }) - identityProvider: IdPKey; - +export class IdpDetailsDTO extends Model { @property({ type: 'object', - description: 'address object to be created for the lead', - jsonSchema: getJsonSchema(TenantDto), + description: 'Tenat object', + jsonSchema: getJsonSchema(Object), }) - tenant: TenantDto; + tenant: AnyObject; @property({ type: 'object', description: 'plan object', diff --git a/services/tenant-management-service/src/providers/idp/idp-auth0.provider.ts b/services/tenant-management-service/src/providers/idp/idp-auth0.provider.ts index f5565ab..5ff4954 100644 --- a/services/tenant-management-service/src/providers/idp/idp-auth0.provider.ts +++ b/services/tenant-management-service/src/providers/idp/idp-auth0.provider.ts @@ -12,9 +12,7 @@ import {HttpErrors} from '@loopback/rest'; const STATUS_OK = 200; const STATUS_NOT_FOUND = 404; -export class Auth0IdpProvider - implements Provider> -{ +export class Auth0IdpProvider implements Provider> { management: ManagementClient; constructor( @@ -64,7 +62,12 @@ export class Auth0IdpProvider email: tenant.contacts[0].email, connection: configValue.connection, - password: configValue.password, + /* saving a constant password for now + ** this will a random generated string that will be temporary password + ** the user will be forced to change it on first login + ** need to check actions in auth0 to see how we can achieve this + **/ + password: 'test123!@#', // eslint-disable-next-line verify_email: configValue.verify_email, // eslint-disable-next-line diff --git a/services/tenant-management-service/src/types/i-idp.interface.ts b/services/tenant-management-service/src/types/i-idp.interface.ts index d0e28c2..3b5995a 100644 --- a/services/tenant-management-service/src/types/i-idp.interface.ts +++ b/services/tenant-management-service/src/types/i-idp.interface.ts @@ -10,11 +10,10 @@ export enum IdPKey { export type ConfigureIdpFunc = (payload: IdpDetails) => Promise; export interface IdpDetails { - identityProvider: IdPKey; - tenant: Tenant; + tenant: AnyObject; plan: AnyObject; } -export interface IdpResp{ - authId:string; -} \ No newline at end of file +export interface IdpResp { + authId: string; +}