Skip to content

Commit

Permalink
feat(tenant-management): remove sonar
Browse files Browse the repository at this point in the history
remove sonar

BREAKING CHANGE:
yes

47
  • Loading branch information
Tyagi-Sunny committed Oct 14, 2024
1 parent 9287208 commit 307e6a9
Showing 1 changed file with 4 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ export class KeycloakIdpProvider
// 3. Create a new admin user for the tenant
const adminUsername = tenant.contacts[0].email; // Customize this as needed
const adminPassword = tenant.key; // This can be dynamic or set in the environment
const firstName=tenant.contacts[0].firstName;
const lastName=tenant.contacts[0].lastName;
const email=tenant.contacts[0].email;
const { firstName, lastName, email } = tenant.contacts[0];

const user=await this.createUser(tenant.key, adminUsername, adminPassword,firstName,lastName,email, token);
// console.log('user',user);
return {
authId:user.id
}
Expand All @@ -52,9 +50,6 @@ export class KeycloakIdpProvider
`Failed to configure Keycloak for tenant: ${tenant.name}`,
);
}
return {
authId: '', // dummy authID
};
}

async authenticateAdmin(): Promise<string> {
Expand All @@ -79,7 +74,6 @@ export class KeycloakIdpProvider
}

async createRealm(realmName: string, token: string): Promise<void> {
// const token = await this.authenticateAdmin();

await axios.post(
`${process.env.KEYCLOAK_HOST}/admin/realms`,
Expand Down Expand Up @@ -137,7 +131,7 @@ export class KeycloakIdpProvider
lastName: string,
email: string,
token: string,
): Promise<{ id: string; userInfo: any }> {
): Promise<{ id: string }> {
// Create the user in Keycloak
const createUserResponse = await axios.post(
`${process.env.KEYCLOAK_HOST}/admin/realms/${realmName}/users`,
Expand Down Expand Up @@ -167,20 +161,9 @@ export class KeycloakIdpProvider
const locationHeader = createUserResponse.headers['location'];
const userId = locationHeader.split('/').pop();

// Now fetch the user info using the user ID
const userInfoResponse = await axios.get(
`${process.env.KEYCLOAK_HOST}/admin/realms/${realmName}/users/${userId}`,
{
headers: {
Authorization: `Bearer ${token}`,
},
},
);

// Return the user ID and the user information
return {
id: userId,
userInfo: userInfoResponse.data, // Contains all the user info from Keycloak
id: userId
};
}

Expand Down

0 comments on commit 307e6a9

Please sign in to comment.