How mlflow-oidc/mlflow-oidc-auth works
Main Components
• Backend Authentication Service:
• Mlflow_oidc_auth module as the core backend service. Within this service, include sub-components such as:
▪ App and Routing (app.py and routes.py) managing incoming HTTP requests.
▪ Authentication logic (auth.py, client.py, views) that implements OIDC flows.
▪ Session management modules (session/) handling Flask sessions with a choice of filesystem or Redis storage.
▪ Cache components (cache/) with distinct implementations like FilesystemCache and RedisCache.
▪ Database & Migration layer (db/ and migrations) using SQLAlchemy, with migration scripts for managing models and group/user permissions.
▪ Plugins (plugins/) such as the Microsoft Entra ID group detection, indicating an extensible design.
▪ Helpers (validators, utils, responses) assisting in data validation and error handling.
• Frontend Web UI:
• External Dependencies:
• Third-party dependencies such as MLflow itself (since this is a plugin for MLflow) and any other integrations noted in the configuration.
Component Relationships and Interactions
• The Frontend (Angular Web UI) issues calls (HTTP REST API requests) to the Backend Authentication Service, typically for login flows, permission management, and user data operations.
• The Backend Service, upon receiving authentication requests, interacts with the external OIDC provider:
• It sends users to the OIDC authorization endpoint.
• It receives callbacks and tokens from the OIDC provider via its configured redirect (OIDC_REDIRECT_URI).
• After authentication, the backend uses its session management (via Flask sessions configured with either filesystem or Redis) to maintain user state.
• The caching layer (using either FilesystemCache or RedisCache) optimizes session data and possibly token caching.
• The database layer (using SQLAlchemy and managed by Alembic migrations) records user information and permission data. This storage also supports the permission management UIs available in the Web UI.
• Optional plugins (e.g., group_detection_microsoft_entra_id) extend backend functionality to pull additional group membership or permission details from external identity providers.
Architectural Patterns and Design Principles
• Modular design: The backend is split into clearly defined modules – authentication, database, caching, plugins, and views – allowing independent evolution and testing.
• Separation of concerns: The Angular Web UI is decoupled from the backend business logic, communicating over well-defined API endpoints.
• Extensibility: Use of plugins for group detection shows an extensible architecture to support different OIDC providers and custom group management solutions.
• Robust session management: Configurable session storage supports scalability and reliability.
• Standardization: Following the OAuth/OIDC flows and integrating with MLflow’s plugin patterns emphasizes standardized security and interoperability practices.