Flow
Authentication Flow Explanation
The authentication system supports multiple methods: direct credential login (username/password), OAuth, SAML, and potentially Single Sign-On (SSO) inferred from existing sessions.
Authentication Breakdown
- Main Entry Point: The process starts with the
login(credentials?)function insrc/authentification/core.ts. - Credential Login: If credentials are provided, it calls
getJWTokento authenticate against the/security.webtokenendpoint and stores the returnedcsrfTokenin the session storage and the user is considered authenticated. - Automatic Flow (No Credentials):
- It first tries to get a
csrfTokenviagetCsrfToken(calling/challenge). - Failure: If no token is found (no active session), it checks configuration for
autoOAuthProviderorautoSAMLProvider.- If configured, it calls
tryOAuthAuthenticationortrySAMLAuthentication, which get redirect URLs from/security.oauthor/security.samlrespectively, and redirect the user to the corresponding provider. - If not configured, it prepares for UI-driven login.
- If configured, it calls
- Success: If a token is found, the user is considered authenticated (existing session).
- It first tries to get a
- SSO Check: In scenarios where neither credentials nor auto-redirects occurred initially, the system might try to fetch the current user's principal information
fetchPrincipalto confirm an existing SSO session if other methods haven't already confirmed authentication. - Existing Token Check: It checks
sessionStorageandlocalStoragefor an existing token viagetToken(). - Logout:
logoutclears tokens from storage and callsdeleteWebTokenCookieif applicable. - State Notification: An
authenticatedcustom browser event is dispatched (emitAuthenticatedEvent) to signal login status changes.