Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(user-tenant-service):add idp controller to manage users in user tenant service #39

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Surbhi-sharma1
Copy link
Collaborator

Description

add idp controller to manage users in user tenant service

Fixes #38

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Intermediate change (work in progress)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist:

  • Performed a self-review of my own code
  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Any dependent changes have been merged and published in downstream modules

@Surbhi-sharma1 Surbhi-sharma1 changed the title add idp controller to manage users in user tenant service feat(user-tenant-service):add idp controller to manage users in user tenant service Dec 13, 2024
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we over populating same service class to communicate with different services
move to a separate service class file

@@ -133,3 +134,16 @@ export interface IValue {
name: string;
value: number | string | boolean;
}
export type ConfigureIdpFunc<T> = (payload: IdpDetails) => Promise<T>;

export interface IdpDetails {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why anyObject
and also a model is defined named IdpDetails so why an interface also
cant we use any one

import {UserCredentialsRepository} from '@sourceloop/user-tenant-service';
import {repository} from '@loopback/repository';

const basePath = '/idp/users';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not making sense

Comment on lines 56 to 72
};
switch (payload.tenant.identityProvider) {
case IdPKey.COGNITO:
break;
case IdPKey.KEYCLOAK:
res = await this.idpKeycloakProvider(payload);
await this.userCredentialsRepository.create({
authProvider: 'keycloak',
password:res.authSecret,
userId: res.authId,
});
break;
default:
break;
}
return res;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not returning directly from the switch case ??

const token = await this.authenticateAdmin();

// Fetch the clientId, clientSecret, and realmName from AWS SSM
const clientId = process.env.KEYCLOAK_CLIENT_ID as string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the new env variables to env.example file

@Surbhi-sharma1 Surbhi-sharma1 marked this pull request as ready for review December 20, 2024 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add feature to manage users
2 participants