@sourceloop/ctrl-plane-tenant-management-service
Version:
Tenant Management microservice for SaaS control plane
51 lines (50 loc) • 3.26 kB
TypeScript
import { Provider } from '@loopback/context';
import { ConfigureIdpFunc, IdpDetails, IdpResp } from '../../types';
import AWS from 'aws-sdk';
export declare class KeycloakIdpProvider implements Provider<ConfigureIdpFunc<IdpResp>> {
ssm: AWS.SSM;
constructor();
value(): ConfigureIdpFunc<IdpResp>;
configure(payload: IdpDetails): Promise<IdpResp>;
/**
* The _setupRealm function creates a new realm if the tier is PREMIUM, or checks if the realm exists
* and creates it if it doesn't for STANDARD or BASIC tiers.
* @param {string} tier - Tier specifies the level of service or plan for the realm, such as
* 'PREMIUM', 'STANDARD', or 'BASIC'.
* @param {string} realmName - The `realmName` parameter is a string that represents the name of the
* realm that needs to be set up.
* @param {string} token - The `token` parameter is used for authentication purposes. It is a
* security token that grants access to the necessary resources for creating or checking the
* existence of a realm. This token is typically provided by the user or system initiating the setup
* of the realm and is used to authenticate the requests made to the realm
*/
private _setupRealm;
/**
* The _createAdminUser function generates a strong password for an admin user and creates the user in
* a specified realm.
* @param {any} tenant - The `tenant` parameter is an object containing information about a tenant,
* including an array of contacts. The function retrieves the email, first name, last name, and other
* details of the first contact in the contacts array to create an admin user for that tenant.
* @param {string} realmName - The `realmName` parameter in the `_createAdminUser` function refers to
* the name of the realm in which the admin user will be created. It is a string value that specifies
* the realm within which the user account will be managed.
* @param {string} token - The `token` parameter in the `_createAdminUser` function is likely a
* security token or authentication token that is used to authorize the creation of the admin user. It
* is passed as a parameter to the function to ensure that the user creating the admin user has the
* necessary permissions or rights to do so
* @returns The `_createAdminUser` function is returning a Promise that resolves to an object with a
* property `id` of type string.
*/
private _createAdminUser;
realmExists(realmName: string, token: string): Promise<boolean>;
authenticateAdmin(): Promise<string>;
createRealm(realmName: string, token: string): Promise<void>;
setupEmailSettings(realmName: string, token: string): Promise<void>;
createClient(realmName: string, clientId: string, token: string, clientSecret: string, key: string): Promise<void>;
createUser(realmName: string, username: string, password: string, firstName: string, lastName: string, email: string, token: string): Promise<{
id: string;
}>;
sendPasswordResetEmail(realmName: string, userId: string, token: string): Promise<void>;
getParameterFromSSM(parameterName: string): Promise<string>;
generateStrongPassword(length: number): string;
}