@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
43 lines (42 loc) • 1.55 kB
TypeScript
type Functionalities = {
authorized_plugins?: string[];
};
export declare const Auth_UnknownUserName = "Unknown User";
export declare const Auth_UnknownUserInitials = "??";
/**
* This class represents user information extracted from the authentication process' userInfo endpoint.
* It supports mapping of GMF custom properties and OIDC standard properties.
*/
export default class AuthUserInfo {
identifier: string | undefined;
displayName: string;
fullName: string | undefined;
initials: string;
email: string | undefined;
roles: unknown[] | undefined;
two_factor_enabled: boolean;
functionalities: Functionalities;
constructor(userInfo: Record<string, unknown>);
/**
* This is the unique identifier at the provider.
* Check for the OIDC standard field `sub`, then try GMF-specific field `username`.
*/
private extractIdentifier;
/**
* This corresponds to an account or user name.
* Check first for OIDC standard field `preferred_username`, then try GMF-specific fields `display_name` and `username`.
* If none of these fields are found, try `email` or fall back to `Unknown User`.
*/
private extractDisplayName;
/**
* Gets the OIDC `name` field, falling back to `given_name` and `family_name`.
*/
private extractFullName;
/**
* Extracts the first letters of the full name or the this.displayName. Examples:
* super_admin -> SA
* Gustave-André de la Girouette -> GG
*/
private extractInitials;
}
export {};