LibreChat/api
José Pedro Silva 6fa3db2969
👑 feat: Add OIDC Claim-Based Admin Role Assignment (#9170)
* feat: Add support for users to be admins when logging in using OpenID

* fix: Linting issues

* fix: whitespace

* chore: add unit tests for OIDC_ADMIN_ROLE

* refactor: Replace custom property retrieval function with lodash's get for improved readability and maintainability

* feat: Enhance OpenID role extraction and error handling in setupOpenId function

- Improved role validation to check for both array and string types.
- Added detailed error messages for missing or invalid role paths in tokens.
- Expanded unit tests to cover various scenarios for nested role extraction and error handling.

* fix: Improve error handling for role extraction in OpenID strategy

- Enhanced validation to check for invalid role types (array or string).
- Updated error messages for clarity when roles are missing or of incorrect type.
- Added unit tests to cover scenarios where roles return invalid types (object, number).

* feat: Implement user role demotion in OpenID strategy when admin role is absent from token

- Added logic to demote users from 'ADMIN' to 'USER' if the admin role is not present in the token.
- Enhanced logging to capture role changes for better traceability.
- Introduced unit tests to verify the demotion behavior and ensure correct handling when admin role environment variables are not configured.

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
2025-10-09 03:35:22 -04:00
..
app 📎 feat: Direct Provider Attachment Support for Multimodal Content (#9994) 2025-10-06 17:30:16 -04:00
cache 🔄 refactor: Migrate Cache Logic to TypeScript (#9771) 2025-10-02 09:33:58 -04:00
config 💫 feat: MCP OAuth Auto-Reconnect (#9646) 2025-09-17 16:49:36 -04:00
db 🔀 refactor: Only Cleanup Meili Sync if actually Synced 2025-10-05 22:41:40 -04:00
lib/utils 🏗️ refactor: Extract DB layers to data-schemas for shared use (#7650) 2025-05-30 22:18:13 -04:00
models 🤖 feat: Add Z.AI GLM Context Window & Pricing (#9979) 2025-10-05 09:08:29 -04:00
server 👨‍🔧 fix: Direct Provider Attachment Support for Agents (#10035) 2025-10-09 03:31:04 -04:00
strategies 👑 feat: Add OIDC Claim-Based Admin Role Assignment (#9170) 2025-10-09 03:35:22 -04:00
test 🔄 refactor: Optimize MCP Tool Initialization 2025-09-21 20:31:28 -04:00
utils 🤖 feat: Add Z.AI GLM Context Window & Pricing (#9979) 2025-10-05 09:08:29 -04:00
jest.config.js 🏪 feat: Agent Marketplace 2025-08-13 16:24:18 -04:00
jsconfig.json feat(api): initial Redis support; fix(SearchBar): proper debounce (#1039) 2023-10-11 17:05:47 -04:00
package.json 📎 feat: Direct Provider Attachment Support for Multimodal Content (#9994) 2025-10-06 17:30:16 -04:00
typedefs.js 🔍 feat: Add Serper as Scraper Provider and Firecrawl Version Support (#9984) 2025-10-05 20:34:05 -04:00