moleculer-iam
Version:
Centralized IAM module for moleculer. Including a certified OIDC provider and an Identity provider for user profile, credentials, and custom claims management. Custom claims could be defined/updated by declarative schema which contains claims validation a
47 lines (46 loc) • 2 kB
TypeScript
import { FindOptions, WhereAttributeHash } from "../lib/rdbms";
import { Logger } from "../lib/logger";
import { Identity } from "./identity";
import { IDPAdapter, IDPAdapterConstructorOptions, Transaction } from "./adapter";
import { OIDCAccountClaims, OIDCAccountCredentials } from "../op";
import { IdentityClaimsManager, IdentityClaimsManagerOptions } from "./claims";
import { IdentityMetadata } from "./metadata";
import { ValidationError } from "../lib/validator";
export declare type IdentityProviderProps = {
logger?: Logger;
};
export declare type IdentityProviderOptions = {
adapter?: IDPAdapterConstructorOptions | IDPAdapter;
claims?: IdentityClaimsManagerOptions;
};
export declare class IdentityProvider {
protected readonly props: IdentityProviderProps;
private readonly logger;
readonly adapter: IDPAdapter;
readonly claims: IdentityClaimsManager;
constructor(props: IdentityProviderProps, opts?: Partial<IdentityProviderOptions>);
private working;
start(): Promise<void>;
stop(): Promise<void>;
readonly validateEmailOrPhoneNumber: (args: {
email?: string;
phone_number?: string;
}) => ValidationError[] | true;
find(args: WhereAttributeHash): Promise<Identity | undefined>;
findOrFail(args: WhereAttributeHash): Promise<Identity>;
count(args?: WhereAttributeHash): Promise<number>;
get(args?: FindOptions): Promise<Identity[]>;
create(args: {
metadata: Partial<IdentityMetadata>;
scope: string[] | string;
claims: Partial<OIDCAccountClaims>;
credentials: Partial<OIDCAccountCredentials>;
}, transaction?: Transaction, ignoreUndefinedClaims?: boolean): Promise<Identity>;
validate(args: {
id?: string;
scope: string[] | string;
claims: Partial<OIDCAccountClaims>;
credentials?: Partial<OIDCAccountCredentials>;
}): Promise<void>;
validateCredentials(credentials: Partial<OIDCAccountCredentials>): Promise<void>;
}