UNPKG

@sourceloop/ctrl-plane-tenant-management-service

Version:

Tenant Management microservice for SaaS control plane

44 lines (43 loc) 3.04 kB
import { Provider } from '@loopback/context'; import { ConfigureIdpFunc, IdpDetails, IdpResp } from '../../types'; import { ManagementClient, PostOrganizationsRequest, UserCreate } from 'auth0'; import { TenantMgmtConfigRepository } from '../../repositories'; export declare class Auth0IdpProvider implements Provider<ConfigureIdpFunc<IdpResp>> { private readonly tenantConfigRepository; management: ManagementClient; constructor(tenantConfigRepository: TenantMgmtConfigRepository); value(): ConfigureIdpFunc<IdpResp>; configure(payload: IdpDetails): Promise<IdpResp>; /** * The function generates a strong password of a specified length using a set of valid characters. * @param {number} length - The `length` parameter in the `_generateStrongPassword` function is used * to specify the length of the generated strong password. It determines how many characters the * password will contain. * @returns A strong password of the specified length is being returned by the * `_generateStrongPassword` function. The password is generated using a set of valid characters * based on the ASCII printable characters and random bytes. */ private _generateStrongPassword; /** * The function `_getOrCreateOrganizationId` checks if an organization exists by name and creates it * if not, returning the organization ID. * @param {string} planTier - The `planTier` parameter is a string that represents the tier of the * plan, such as 'PREMIUM'. * @param {string} orgName - The `orgName` parameter is a string representing the name of the * organization that you want to get or create the ID for. This function `_getOrCreateOrganizationId` * checks if the organization with the given name exists, and if not, it creates a new organization * with the provided data. * @param {PostOrganizationsRequest} organizationData - The `_getOrCreateOrganizationId` function is * designed to retrieve or create an organization ID based on the provided parameters. It first * checks if the `planTier` is 'PREMIUM'. If it is, a new organization is created using the * `organizationData` and the ID of the created organization * @returns The function `_getOrCreateOrganizationId` returns a Promise that resolves to a string, * which is the ID of the organization. If the planTier is 'PREMIUM', it creates a new organization * and returns its ID. If the planTier is not 'PREMIUM', it tries to get the organization ID by name. * If the organization is found, it returns the ID. If the organization */ private _getOrCreateOrganizationId; createOrganization(data: PostOrganizationsRequest): Promise<import("auth0").ApiResponse<import("auth0").PostOrganizations201Response>>; createUser(userData: UserCreate): Promise<import("auth0").ApiResponse<import("auth0").GetUsers200ResponseOneOfInner>>; addMemberToOrganization(organizationId: string, userId: string): Promise<import("auth0").ApiResponse<void>>; }