Front-End Authentication API
Last modified by Manuel Leduc on 2026/02/05 17:22
Reference
Authentication Manager
An authentication manager provides the implementation allowing interaction with the authentication of a user backend.
For instance, for the XWiki backend, the authentication works by interacting with the OIDC Provider Extension.
/**
* Interface to implement for a given backend to allow users to authenticate.
*
* @since 0.11
*/
interface AuthenticationManager {
/**
* Starts the authentication process.
* @since 0.15
*/
start(): Promise<void>;
/**
* Handle the callback.
*/
callback(): Promise<void>;
/**
* Returns the currently registered authorization header
*/
getAuthorizationHeader(): Promise<string | undefined>;
/**
* @returns true of the current user is authenticated
*/
isAuthenticated(): Promise<boolean>;
/**
* Returns the user details for the current user.
*/
getUserDetails(): Promise<UserDetails>;
/**
* Logs out the current user.
*/
logout(): Promise<void>;
/**
* Optional method returning the currently connected user id.
*
* @returns the id of the currently connected user, or undefined if not authenticated
* @since 0.20
*/
getUserId?(): string | undefined;
}
Authentication Manager Provider
The authentication manager provider is responsible for resolving an authentication manager according to the current context (e.g., the current backend).
/**
* Help to resolve the right Authentication Manager based on the backend
* type.
*
* @since 0.11
*/
interface AuthenticationManagerProvider {
/**
*
* @param type the identifier of the backend type
* @return the AuthenticationManager registered for the backend type, or undefined if none was fond
*/
get(type?: string): AuthenticationManager | undefined;
}User Details
/**
* Holds the user details, for now the profile link and the name of the user.
*
* @since 0.11
*/
export interface UserDetails {
profile: string;
name: string;
}