Skip to content

Commit

Permalink
feat(tenant-management): change the request model
Browse files Browse the repository at this point in the history
  • Loading branch information
yeshamavani committed Oct 4, 2024
1 parent e512650 commit a2a09b6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,17 @@ export class IdpController {
})
payload: IdpDetailsDTO,
): Promise<IdpResp> {
let res:IdpResp={
authId:""
let res: IdpResp = {

Check failure on line 51 in services/tenant-management-service/src/controllers/idp.controller.ts

View workflow job for this annotation

GitHub Actions / npm_test

'res' is never reassigned. Use 'const' instead
authId: '',
};
switch (payload.identityProvider) {

switch (payload.tenant.identityProvider) {
case IdPKey.AUTH0:
let auth0Resp=await this.idpAuth0Provider(payload);
let auth0Resp = await this.idpAuth0Provider(payload);

Check failure on line 56 in services/tenant-management-service/src/controllers/idp.controller.ts

View workflow job for this annotation

GitHub Actions / npm_test

Unexpected lexical declaration in case block

Check failure on line 56 in services/tenant-management-service/src/controllers/idp.controller.ts

View workflow job for this annotation

GitHub Actions / npm_test

'auth0Resp' is never reassigned. Use 'const' instead
return auth0Resp;
case IdPKey.COGNITO:
break;
case IdPKey.KEYCLOAK:
let keycloakResp=await this.idpKeycloakProvider(payload);
let keycloakResp = await this.idpKeycloakProvider(payload);

Check failure on line 61 in services/tenant-management-service/src/controllers/idp.controller.ts

View workflow job for this annotation

GitHub Actions / npm_test

Unexpected lexical declaration in case block

Check failure on line 61 in services/tenant-management-service/src/controllers/idp.controller.ts

View workflow job for this annotation

GitHub Actions / npm_test

'keycloakResp' is never reassigned. Use 'const' instead
return keycloakResp;

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import {HttpErrors} from '@loopback/rest';

const STATUS_OK = 200;
const STATUS_NOT_FOUND = 404;
export class Auth0IdpProvider
implements Provider<ConfigureIdpFunc<IdpResp>>
{
export class Auth0IdpProvider implements Provider<ConfigureIdpFunc<IdpResp>> {
management: ManagementClient;

constructor(
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ export enum IdPKey {
export type ConfigureIdpFunc<T> = (payload: IdpDetails) => Promise<T>;

export interface IdpDetails {
identityProvider: IdPKey;
tenant: Tenant;
tenant: AnyObject;
plan: AnyObject;
}

export interface IdpResp{
authId:string;
}
export interface IdpResp {
authId: string;
}

0 comments on commit a2a09b6

Please sign in to comment.