LibreChat/api/strategies/openidStrategy.js

497 lines
17 KiB
JavaScript
Raw Normal View History

🔍 refactor: OpenID Fetch Handling and Logging (#7790) * feat: Enhance OpenID Strategy with Debug Logging and Header Management - Added detailed logging for OpenID requests and responses when debug mode is enabled. - Introduced helper functions for safely logging sensitive data and headers. - Updated OpenID strategy to handle non-standard WWW-Authenticate headers in responses. - Refactored proxy configuration handling for improved clarity and logging. * refactor: MemoryViewer Layout with Conditional Justification - Updated the MemoryViewer component to conditionally apply justification styles based on memory data and access permissions. - Introduced utility function `cn` for cleaner class name management in the component. * refactor: Update OpenID Strategy to use Global Fetch * refactor: Add undici for customFetch request handling in OpenID strategy * fix: Export 'files' module in utils index * chore: Add node-fetch dependency for openid image download * ci: Add comprehensive tests for multer configuration and file handling - Introduced a new test suite for multer configuration, covering storage destination and filename generation. - Implemented tests for file filtering, ensuring only valid JSON files are accepted. - Added error handling tests for edge cases and vulnerabilities, including handling empty field names and malformed filenames. - Integrated real configuration testing with actual fileConfig and custom endpoints. - Enhanced UUID generation tests to ensure uniqueness and cryptographic security. * chore: Improve proxy configuration logging in customFetch function * fix: Improve logging for non-standard WWW-Authenticate header in customFetch function
2025-06-09 11:27:23 -04:00
const undici = require('undici');
const fetch = require('node-fetch');
const passport = require('passport');
🏗️ refactor: Extract DB layers to `data-schemas` for shared use (#7650) * refactor: move model definitions and database-related methods to packages/data-schemas * ci: update tests due to new DB structure fix: disable mocking `librechat-data-provider` feat: Add schema exports to data-schemas package - Introduced a new schema module that exports various schemas including action, agent, and user schemas. - Updated index.ts to include the new schema exports for better modularity and organization. ci: fix appleStrategy tests fix: Agent.spec.js ci: refactor handleTools tests to use MongoMemoryServer for in-memory database fix: getLogStores imports ci: update banViolation tests to use MongoMemoryServer and improve session mocking test: refactor samlStrategy tests to improve mock configurations and user handling ci: fix crypto mock in handleText tests for improved accuracy ci: refactor spendTokens tests to improve model imports and setup ci: refactor Message model tests to use MongoMemoryServer and improve database interactions * refactor: streamline IMessage interface and move feedback properties to types/message.ts * refactor: use exported initializeRoles from `data-schemas`, remove api workspace version (this serves as an example of future migrations that still need to happen) * refactor: update model imports to use destructuring from `~/db/models` for consistency and clarity * refactor: remove unused mongoose imports from model files for cleaner code * refactor: remove unused mongoose imports from Share, Prompt, and Transaction model files for cleaner code * refactor: remove unused import in Transaction model for cleaner code * ci: update deploy workflow to reference new Docker Dev Branch Images Build and add new workflow for building Docker images on dev branch * chore: cleanup imports
2025-05-30 22:18:13 -04:00
const client = require('openid-client');
const jwtDecode = require('jsonwebtoken/decode');
const { HttpsProxyAgent } = require('https-proxy-agent');
🏗️ refactor: Extract DB layers to `data-schemas` for shared use (#7650) * refactor: move model definitions and database-related methods to packages/data-schemas * ci: update tests due to new DB structure fix: disable mocking `librechat-data-provider` feat: Add schema exports to data-schemas package - Introduced a new schema module that exports various schemas including action, agent, and user schemas. - Updated index.ts to include the new schema exports for better modularity and organization. ci: fix appleStrategy tests fix: Agent.spec.js ci: refactor handleTools tests to use MongoMemoryServer for in-memory database fix: getLogStores imports ci: update banViolation tests to use MongoMemoryServer and improve session mocking test: refactor samlStrategy tests to improve mock configurations and user handling ci: fix crypto mock in handleText tests for improved accuracy ci: refactor spendTokens tests to improve model imports and setup ci: refactor Message model tests to use MongoMemoryServer and improve database interactions * refactor: streamline IMessage interface and move feedback properties to types/message.ts * refactor: use exported initializeRoles from `data-schemas`, remove api workspace version (this serves as an example of future migrations that still need to happen) * refactor: update model imports to use destructuring from `~/db/models` for consistency and clarity * refactor: remove unused mongoose imports from model files for cleaner code * refactor: remove unused mongoose imports from Share, Prompt, and Transaction model files for cleaner code * refactor: remove unused import in Transaction model for cleaner code * ci: update deploy workflow to reference new Docker Dev Branch Images Build and add new workflow for building Docker images on dev branch * chore: cleanup imports
2025-05-30 22:18:13 -04:00
const { hashToken, logger } = require('@librechat/data-schemas');
const { CacheKeys, ErrorTypes } = require('librechat-data-provider');
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
const { Strategy: OpenIDStrategy } = require('openid-client/passport');
🛜 refactor: Streamline App Config Usage (#9234) * WIP: app.locals refactoring WIP: appConfig fix: update memory configuration retrieval to use getAppConfig based on user role fix: update comment for AppConfig interface to clarify purpose 🏷️ refactor: Update tests to use getAppConfig for endpoint configurations ci: Update AppService tests to initialize app config instead of app.locals ci: Integrate getAppConfig into remaining tests refactor: Update multer storage destination to use promise-based getAppConfig and improve error handling in tests refactor: Rename initializeAppConfig to setAppConfig and update related tests ci: Mock getAppConfig in various tests to provide default configurations refactor: Update convertMCPToolsToPlugins to use mcpManager for server configuration and adjust related tests chore: rename `Config/getAppConfig` -> `Config/app` fix: streamline OpenAI image tools configuration by removing direct appConfig dependency and using function parameters chore: correct parameter documentation for imageOutputType in ToolService.js refactor: remove `getCustomConfig` dependency in config route refactor: update domain validation to use appConfig for allowed domains refactor: use appConfig registration property chore: remove app parameter from AppService invocation refactor: update AppConfig interface to correct registration and turnstile configurations refactor: remove getCustomConfig dependency and use getAppConfig in PluginController, multer, and MCP services refactor: replace getCustomConfig with getAppConfig in STTService, TTSService, and related files refactor: replace getCustomConfig with getAppConfig in Conversation and Message models, update tempChatRetention functions to use AppConfig type refactor: update getAppConfig calls in Conversation and Message models to include user role for temporary chat expiration ci: update related tests refactor: update getAppConfig call in getCustomConfigSpeech to include user role fix: update appConfig usage to access allowedDomains from actions instead of registration refactor: enhance AppConfig to include fileStrategies and update related file strategy logic refactor: update imports to use normalizeEndpointName from @librechat/api and remove redundant definitions chore: remove deprecated unused RunManager refactor: get balance config primarily from appConfig refactor: remove customConfig dependency for appConfig and streamline loadConfigModels logic refactor: remove getCustomConfig usage and use app config in file citations refactor: consolidate endpoint loading logic into loadEndpoints function refactor: update appConfig access to use endpoints structure across various services refactor: implement custom endpoints configuration and streamline endpoint loading logic refactor: update getAppConfig call to include user role parameter refactor: streamline endpoint configuration and enhance appConfig usage across services refactor: replace getMCPAuthMap with getUserMCPAuthMap and remove unused getCustomConfig file refactor: add type annotation for loadedEndpoints in loadEndpoints function refactor: move /services/Files/images/parse to TS API chore: add missing FILE_CITATIONS permission to IRole interface refactor: restructure toolkits to TS API refactor: separate manifest logic into its own module refactor: consolidate tool loading logic into a new tools module for startup logic refactor: move interface config logic to TS API refactor: migrate checkEmailConfig to TypeScript and update imports refactor: add FunctionTool interface and availableTools to AppConfig refactor: decouple caching and DB operations from AppService, make part of consolidated `getAppConfig` WIP: fix tests * fix: rebase conflicts * refactor: remove app.locals references * refactor: replace getBalanceConfig with getAppConfig in various strategies and middleware * refactor: replace appConfig?.balance with getBalanceConfig in various controllers and clients * test: add balance configuration to titleConvo method in AgentClient tests * chore: remove unused `openai-chat-tokens` package * chore: remove unused imports in initializeMCPs.js * refactor: update balance configuration to use getAppConfig instead of getBalanceConfig * refactor: integrate configMiddleware for centralized configuration handling * refactor: optimize email domain validation by removing unnecessary async calls * refactor: simplify multer storage configuration by removing async calls * refactor: reorder imports for better readability in user.js * refactor: replace getAppConfig calls with req.config for improved performance * chore: replace getAppConfig calls with req.config in tests for centralized configuration handling * chore: remove unused override config * refactor: add configMiddleware to endpoint route and replace getAppConfig with req.config * chore: remove customConfig parameter from TTSService constructor * refactor: pass appConfig from request to processFileCitations for improved configuration handling * refactor: remove configMiddleware from endpoint route and retrieve appConfig directly in getEndpointsConfig if not in `req.config` * test: add mockAppConfig to processFileCitations tests for improved configuration handling * fix: pass req.config to hasCustomUserVars and call without await after synchronous refactor * fix: type safety in useExportConversation * refactor: retrieve appConfig using getAppConfig in PluginController and remove configMiddleware from plugins route, to avoid always retrieving when plugins are cached * chore: change `MongoUser` typedef to `IUser` * fix: Add `user` and `config` fields to ServerRequest and update JSDoc type annotations from Express.Request to ServerRequest * fix: remove unused setAppConfig mock from Server configuration tests
2025-08-26 12:10:18 -04:00
const { isEnabled, logHeaders, safeStringify, getBalanceConfig } = require('@librechat/api');
const { getStrategyFunctions } = require('~/server/services/Files/strategies');
🏗️ refactor: Extract DB layers to `data-schemas` for shared use (#7650) * refactor: move model definitions and database-related methods to packages/data-schemas * ci: update tests due to new DB structure fix: disable mocking `librechat-data-provider` feat: Add schema exports to data-schemas package - Introduced a new schema module that exports various schemas including action, agent, and user schemas. - Updated index.ts to include the new schema exports for better modularity and organization. ci: fix appleStrategy tests fix: Agent.spec.js ci: refactor handleTools tests to use MongoMemoryServer for in-memory database fix: getLogStores imports ci: update banViolation tests to use MongoMemoryServer and improve session mocking test: refactor samlStrategy tests to improve mock configurations and user handling ci: fix crypto mock in handleText tests for improved accuracy ci: refactor spendTokens tests to improve model imports and setup ci: refactor Message model tests to use MongoMemoryServer and improve database interactions * refactor: streamline IMessage interface and move feedback properties to types/message.ts * refactor: use exported initializeRoles from `data-schemas`, remove api workspace version (this serves as an example of future migrations that still need to happen) * refactor: update model imports to use destructuring from `~/db/models` for consistency and clarity * refactor: remove unused mongoose imports from model files for cleaner code * refactor: remove unused mongoose imports from Share, Prompt, and Transaction model files for cleaner code * refactor: remove unused import in Transaction model for cleaner code * ci: update deploy workflow to reference new Docker Dev Branch Images Build and add new workflow for building Docker images on dev branch * chore: cleanup imports
2025-05-30 22:18:13 -04:00
const { findUser, createUser, updateUser } = require('~/models');
🛜 refactor: Streamline App Config Usage (#9234) * WIP: app.locals refactoring WIP: appConfig fix: update memory configuration retrieval to use getAppConfig based on user role fix: update comment for AppConfig interface to clarify purpose 🏷️ refactor: Update tests to use getAppConfig for endpoint configurations ci: Update AppService tests to initialize app config instead of app.locals ci: Integrate getAppConfig into remaining tests refactor: Update multer storage destination to use promise-based getAppConfig and improve error handling in tests refactor: Rename initializeAppConfig to setAppConfig and update related tests ci: Mock getAppConfig in various tests to provide default configurations refactor: Update convertMCPToolsToPlugins to use mcpManager for server configuration and adjust related tests chore: rename `Config/getAppConfig` -> `Config/app` fix: streamline OpenAI image tools configuration by removing direct appConfig dependency and using function parameters chore: correct parameter documentation for imageOutputType in ToolService.js refactor: remove `getCustomConfig` dependency in config route refactor: update domain validation to use appConfig for allowed domains refactor: use appConfig registration property chore: remove app parameter from AppService invocation refactor: update AppConfig interface to correct registration and turnstile configurations refactor: remove getCustomConfig dependency and use getAppConfig in PluginController, multer, and MCP services refactor: replace getCustomConfig with getAppConfig in STTService, TTSService, and related files refactor: replace getCustomConfig with getAppConfig in Conversation and Message models, update tempChatRetention functions to use AppConfig type refactor: update getAppConfig calls in Conversation and Message models to include user role for temporary chat expiration ci: update related tests refactor: update getAppConfig call in getCustomConfigSpeech to include user role fix: update appConfig usage to access allowedDomains from actions instead of registration refactor: enhance AppConfig to include fileStrategies and update related file strategy logic refactor: update imports to use normalizeEndpointName from @librechat/api and remove redundant definitions chore: remove deprecated unused RunManager refactor: get balance config primarily from appConfig refactor: remove customConfig dependency for appConfig and streamline loadConfigModels logic refactor: remove getCustomConfig usage and use app config in file citations refactor: consolidate endpoint loading logic into loadEndpoints function refactor: update appConfig access to use endpoints structure across various services refactor: implement custom endpoints configuration and streamline endpoint loading logic refactor: update getAppConfig call to include user role parameter refactor: streamline endpoint configuration and enhance appConfig usage across services refactor: replace getMCPAuthMap with getUserMCPAuthMap and remove unused getCustomConfig file refactor: add type annotation for loadedEndpoints in loadEndpoints function refactor: move /services/Files/images/parse to TS API chore: add missing FILE_CITATIONS permission to IRole interface refactor: restructure toolkits to TS API refactor: separate manifest logic into its own module refactor: consolidate tool loading logic into a new tools module for startup logic refactor: move interface config logic to TS API refactor: migrate checkEmailConfig to TypeScript and update imports refactor: add FunctionTool interface and availableTools to AppConfig refactor: decouple caching and DB operations from AppService, make part of consolidated `getAppConfig` WIP: fix tests * fix: rebase conflicts * refactor: remove app.locals references * refactor: replace getBalanceConfig with getAppConfig in various strategies and middleware * refactor: replace appConfig?.balance with getBalanceConfig in various controllers and clients * test: add balance configuration to titleConvo method in AgentClient tests * chore: remove unused `openai-chat-tokens` package * chore: remove unused imports in initializeMCPs.js * refactor: update balance configuration to use getAppConfig instead of getBalanceConfig * refactor: integrate configMiddleware for centralized configuration handling * refactor: optimize email domain validation by removing unnecessary async calls * refactor: simplify multer storage configuration by removing async calls * refactor: reorder imports for better readability in user.js * refactor: replace getAppConfig calls with req.config for improved performance * chore: replace getAppConfig calls with req.config in tests for centralized configuration handling * chore: remove unused override config * refactor: add configMiddleware to endpoint route and replace getAppConfig with req.config * chore: remove customConfig parameter from TTSService constructor * refactor: pass appConfig from request to processFileCitations for improved configuration handling * refactor: remove configMiddleware from endpoint route and retrieve appConfig directly in getEndpointsConfig if not in `req.config` * test: add mockAppConfig to processFileCitations tests for improved configuration handling * fix: pass req.config to hasCustomUserVars and call without await after synchronous refactor * fix: type safety in useExportConversation * refactor: retrieve appConfig using getAppConfig in PluginController and remove configMiddleware from plugins route, to avoid always retrieving when plugins are cached * chore: change `MongoUser` typedef to `IUser` * fix: Add `user` and `config` fields to ServerRequest and update JSDoc type annotations from Express.Request to ServerRequest * fix: remove unused setAppConfig mock from Server configuration tests
2025-08-26 12:10:18 -04:00
const { getAppConfig } = require('~/server/services/Config');
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
const getLogStores = require('~/cache/getLogStores');
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
/**
* @typedef {import('openid-client').ClientMetadata} ClientMetadata
* @typedef {import('openid-client').Configuration} Configuration
**/
🔍 refactor: OpenID Fetch Handling and Logging (#7790) * feat: Enhance OpenID Strategy with Debug Logging and Header Management - Added detailed logging for OpenID requests and responses when debug mode is enabled. - Introduced helper functions for safely logging sensitive data and headers. - Updated OpenID strategy to handle non-standard WWW-Authenticate headers in responses. - Refactored proxy configuration handling for improved clarity and logging. * refactor: MemoryViewer Layout with Conditional Justification - Updated the MemoryViewer component to conditionally apply justification styles based on memory data and access permissions. - Introduced utility function `cn` for cleaner class name management in the component. * refactor: Update OpenID Strategy to use Global Fetch * refactor: Add undici for customFetch request handling in OpenID strategy * fix: Export 'files' module in utils index * chore: Add node-fetch dependency for openid image download * ci: Add comprehensive tests for multer configuration and file handling - Introduced a new test suite for multer configuration, covering storage destination and filename generation. - Implemented tests for file filtering, ensuring only valid JSON files are accepted. - Added error handling tests for edge cases and vulnerabilities, including handling empty field names and malformed filenames. - Integrated real configuration testing with actual fileConfig and custom endpoints. - Enhanced UUID generation tests to ensure uniqueness and cryptographic security. * chore: Improve proxy configuration logging in customFetch function * fix: Improve logging for non-standard WWW-Authenticate header in customFetch function
2025-06-09 11:27:23 -04:00
/**
* @param {string} url
* @param {client.CustomFetchOptions} options
*/
async function customFetch(url, options) {
const urlStr = url.toString();
logger.debug(`[openidStrategy] Request to: ${urlStr}`);
const debugOpenId = isEnabled(process.env.DEBUG_OPENID_REQUESTS);
if (debugOpenId) {
logger.debug(`[openidStrategy] Request method: ${options.method || 'GET'}`);
logger.debug(`[openidStrategy] Request headers: ${logHeaders(options.headers)}`);
if (options.body) {
let bodyForLogging = '';
if (options.body instanceof URLSearchParams) {
bodyForLogging = options.body.toString();
} else if (typeof options.body === 'string') {
bodyForLogging = options.body;
} else {
bodyForLogging = safeStringify(options.body);
}
logger.debug(`[openidStrategy] Request body: ${bodyForLogging}`);
}
}
try {
/** @type {undici.RequestInit} */
let fetchOptions = options;
if (process.env.PROXY) {
logger.info(`[openidStrategy] proxy agent configured: ${process.env.PROXY}`);
fetchOptions = {
...options,
dispatcher: new undici.ProxyAgent(process.env.PROXY),
🔍 refactor: OpenID Fetch Handling and Logging (#7790) * feat: Enhance OpenID Strategy with Debug Logging and Header Management - Added detailed logging for OpenID requests and responses when debug mode is enabled. - Introduced helper functions for safely logging sensitive data and headers. - Updated OpenID strategy to handle non-standard WWW-Authenticate headers in responses. - Refactored proxy configuration handling for improved clarity and logging. * refactor: MemoryViewer Layout with Conditional Justification - Updated the MemoryViewer component to conditionally apply justification styles based on memory data and access permissions. - Introduced utility function `cn` for cleaner class name management in the component. * refactor: Update OpenID Strategy to use Global Fetch * refactor: Add undici for customFetch request handling in OpenID strategy * fix: Export 'files' module in utils index * chore: Add node-fetch dependency for openid image download * ci: Add comprehensive tests for multer configuration and file handling - Introduced a new test suite for multer configuration, covering storage destination and filename generation. - Implemented tests for file filtering, ensuring only valid JSON files are accepted. - Added error handling tests for edge cases and vulnerabilities, including handling empty field names and malformed filenames. - Integrated real configuration testing with actual fileConfig and custom endpoints. - Enhanced UUID generation tests to ensure uniqueness and cryptographic security. * chore: Improve proxy configuration logging in customFetch function * fix: Improve logging for non-standard WWW-Authenticate header in customFetch function
2025-06-09 11:27:23 -04:00
};
}
const response = await undici.fetch(url, fetchOptions);
if (debugOpenId) {
logger.debug(`[openidStrategy] Response status: ${response.status} ${response.statusText}`);
logger.debug(`[openidStrategy] Response headers: ${logHeaders(response.headers)}`);
}
if (response.status === 200 && response.headers.has('www-authenticate')) {
const wwwAuth = response.headers.get('www-authenticate');
logger.warn(`[openidStrategy] Non-standard WWW-Authenticate header found in successful response (200 OK): ${wwwAuth}.
This violates RFC 7235 and may cause issues with strict OAuth clients. Removing header for compatibility.`);
/** Cloned response without the WWW-Authenticate header */
const responseBody = await response.arrayBuffer();
const newHeaders = new Headers();
for (const [key, value] of response.headers.entries()) {
if (key.toLowerCase() !== 'www-authenticate') {
newHeaders.append(key, value);
}
}
return new Response(responseBody, {
status: response.status,
statusText: response.statusText,
headers: newHeaders,
});
}
return response;
} catch (error) {
logger.error(`[openidStrategy] Fetch error: ${error.message}`);
throw error;
}
}
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
/** @typedef {Configuration | null} */
let openidConfig = null;
//overload currenturl function because of express version 4 buggy req.host doesn't include port
//More info https://github.com/panva/openid-client/pull/713
class CustomOpenIDStrategy extends OpenIDStrategy {
currentUrl(req) {
const hostAndProtocol = process.env.DOMAIN_SERVER;
return new URL(`${hostAndProtocol}${req.originalUrl ?? req.url}`);
}
authorizationRequestParams(req, options) {
const params = super.authorizationRequestParams(req, options);
if (options?.state && !params.has('state')) {
params.set('state', options.state);
}
if (process.env.OPENID_AUDIENCE) {
params.set('audience', process.env.OPENID_AUDIENCE);
logger.debug(
`[openidStrategy] Adding audience to authorization request: ${process.env.OPENID_AUDIENCE}`,
);
}
/** Generate nonce for federated providers that require it */
const shouldGenerateNonce = isEnabled(process.env.OPENID_GENERATE_NONCE);
if (shouldGenerateNonce && !params.has('nonce') && this._sessionKey) {
const crypto = require('crypto');
const nonce = crypto.randomBytes(16).toString('hex');
params.set('nonce', nonce);
logger.debug('[openidStrategy] Generated nonce for federated provider:', nonce);
}
return params;
}
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
}
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
/**
* Exchange the access token for a new access token using the on-behalf-of flow if required.
* @param {Configuration} config
* @param {string} accessToken access token to be exchanged if necessary
* @param {string} sub - The subject identifier of the user. usually found as "sub" in the claims of the token
* @param {boolean} fromCache - Indicates whether to use cached tokens.
* @returns {Promise<string>} The new access token if exchanged, otherwise the original access token.
*/
const exchangeAccessTokenIfNeeded = async (config, accessToken, sub, fromCache = false) => {
const tokensCache = getLogStores(CacheKeys.OPENID_EXCHANGED_TOKENS);
const onBehalfFlowRequired = isEnabled(process.env.OPENID_ON_BEHALF_FLOW_FOR_USERINFO_REQUIRED);
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
if (onBehalfFlowRequired) {
if (fromCache) {
const cachedToken = await tokensCache.get(sub);
if (cachedToken) {
return cachedToken.access_token;
}
}
const grantResponse = await client.genericGrantRequest(
config,
'urn:ietf:params:oauth:grant-type:jwt-bearer',
{
scope: process.env.OPENID_ON_BEHALF_FLOW_USERINFO_SCOPE || 'user.read',
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
assertion: accessToken,
requested_token_use: 'on_behalf_of',
},
);
await tokensCache.set(
sub,
{
access_token: grantResponse.access_token,
},
grantResponse.expires_in * 1000,
);
return grantResponse.access_token;
}
return accessToken;
};
/**
* get user info from openid provider
* @param {Configuration} config
* @param {string} accessToken access token
* @param {string} sub - The subject identifier of the user. usually found as "sub" in the claims of the token
* @returns {Promise<Object|null>}
*/
const getUserInfo = async (config, accessToken, sub) => {
try {
const exchangedAccessToken = await exchangeAccessTokenIfNeeded(config, accessToken, sub);
return await client.fetchUserInfo(config, exchangedAccessToken, sub);
} catch (error) {
logger.warn(`[openidStrategy] getUserInfo: Error fetching user info: ${error}`);
return null;
}
};
/**
* Downloads an image from a URL using an access token.
* @param {string} url
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
* @param {Configuration} config
* @param {string} accessToken access token
* @param {string} sub - The subject identifier of the user. usually found as "sub" in the claims of the token
* @returns {Promise<Buffer | string>} The image buffer or an empty string if the download fails.
*/
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
const downloadImage = async (url, config, accessToken, sub) => {
const exchangedAccessToken = await exchangeAccessTokenIfNeeded(config, accessToken, sub, true);
if (!url) {
return '';
}
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
try {
const options = {
method: 'GET',
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
headers: {
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
Authorization: `Bearer ${exchangedAccessToken}`,
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
},
};
if (process.env.PROXY) {
options.agent = new HttpsProxyAgent(process.env.PROXY);
}
const response = await fetch(url, options);
if (response.ok) {
const buffer = await response.buffer();
return buffer;
} else {
throw new Error(`${response.statusText} (HTTP ${response.status})`);
}
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
} catch (error) {
logger.error(
`[openidStrategy] downloadImage: Error downloading image at URL "${url}": ${error}`,
);
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
return '';
}
};
/**
* Determines the full name of a user based on OpenID userinfo and environment configuration.
*
* @param {Object} userinfo - The user information object from OpenID Connect
* @param {string} [userinfo.given_name] - The user's first name
* @param {string} [userinfo.family_name] - The user's last name
* @param {string} [userinfo.username] - The user's username
* @param {string} [userinfo.email] - The user's email address
* @returns {string} The determined full name of the user
*/
function getFullName(userinfo) {
if (process.env.OPENID_NAME_CLAIM) {
return userinfo[process.env.OPENID_NAME_CLAIM];
}
if (userinfo.given_name && userinfo.family_name) {
return `${userinfo.given_name} ${userinfo.family_name}`;
}
if (userinfo.given_name) {
return userinfo.given_name;
}
if (userinfo.family_name) {
return userinfo.family_name;
}
return userinfo.username || userinfo.email;
}
/**
* Converts an input into a string suitable for a username.
* If the input is a string, it will be returned as is.
* If the input is an array, elements will be joined with underscores.
* In case of undefined or other falsy values, a default value will be returned.
*
* @param {string | string[] | undefined} input - The input value to be converted into a username.
* @param {string} [defaultValue=''] - The default value to return if the input is falsy.
* @returns {string} The processed input as a string suitable for a username.
*/
function convertToUsername(input, defaultValue = '') {
if (typeof input === 'string') {
return input;
} else if (Array.isArray(input)) {
return input.join('_');
}
return defaultValue;
}
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
/**
* Sets up the OpenID strategy for authentication.
* This function configures the OpenID client, handles proxy settings,
* and defines the OpenID strategy for Passport.js.
*
* @async
* @function setupOpenId
* @returns {Promise<Configuration | null>} A promise that resolves when the OpenID strategy is set up and returns the openid client config object.
* @throws {Error} If an error occurs during the setup process.
*/
async function setupOpenId() {
try {
const shouldGenerateNonce = isEnabled(process.env.OPENID_GENERATE_NONCE);
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
/** @type {ClientMetadata} */
const clientMetadata = {
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
client_id: process.env.OPENID_CLIENT_ID,
client_secret: process.env.OPENID_CLIENT_SECRET,
};
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
if (shouldGenerateNonce) {
clientMetadata.response_types = ['code'];
clientMetadata.grant_types = ['authorization_code'];
clientMetadata.token_endpoint_auth_method = 'client_secret_post';
}
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
/** @type {Configuration} */
openidConfig = await client.discovery(
new URL(process.env.OPENID_ISSUER),
process.env.OPENID_CLIENT_ID,
clientMetadata,
🔍 refactor: OpenID Fetch Handling and Logging (#7790) * feat: Enhance OpenID Strategy with Debug Logging and Header Management - Added detailed logging for OpenID requests and responses when debug mode is enabled. - Introduced helper functions for safely logging sensitive data and headers. - Updated OpenID strategy to handle non-standard WWW-Authenticate headers in responses. - Refactored proxy configuration handling for improved clarity and logging. * refactor: MemoryViewer Layout with Conditional Justification - Updated the MemoryViewer component to conditionally apply justification styles based on memory data and access permissions. - Introduced utility function `cn` for cleaner class name management in the component. * refactor: Update OpenID Strategy to use Global Fetch * refactor: Add undici for customFetch request handling in OpenID strategy * fix: Export 'files' module in utils index * chore: Add node-fetch dependency for openid image download * ci: Add comprehensive tests for multer configuration and file handling - Introduced a new test suite for multer configuration, covering storage destination and filename generation. - Implemented tests for file filtering, ensuring only valid JSON files are accepted. - Added error handling tests for edge cases and vulnerabilities, including handling empty field names and malformed filenames. - Integrated real configuration testing with actual fileConfig and custom endpoints. - Enhanced UUID generation tests to ensure uniqueness and cryptographic security. * chore: Improve proxy configuration logging in customFetch function * fix: Improve logging for non-standard WWW-Authenticate header in customFetch function
2025-06-09 11:27:23 -04:00
undefined,
{
[client.customFetch]: customFetch,
},
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
);
🔍 refactor: OpenID Fetch Handling and Logging (#7790) * feat: Enhance OpenID Strategy with Debug Logging and Header Management - Added detailed logging for OpenID requests and responses when debug mode is enabled. - Introduced helper functions for safely logging sensitive data and headers. - Updated OpenID strategy to handle non-standard WWW-Authenticate headers in responses. - Refactored proxy configuration handling for improved clarity and logging. * refactor: MemoryViewer Layout with Conditional Justification - Updated the MemoryViewer component to conditionally apply justification styles based on memory data and access permissions. - Introduced utility function `cn` for cleaner class name management in the component. * refactor: Update OpenID Strategy to use Global Fetch * refactor: Add undici for customFetch request handling in OpenID strategy * fix: Export 'files' module in utils index * chore: Add node-fetch dependency for openid image download * ci: Add comprehensive tests for multer configuration and file handling - Introduced a new test suite for multer configuration, covering storage destination and filename generation. - Implemented tests for file filtering, ensuring only valid JSON files are accepted. - Added error handling tests for edge cases and vulnerabilities, including handling empty field names and malformed filenames. - Integrated real configuration testing with actual fileConfig and custom endpoints. - Enhanced UUID generation tests to ensure uniqueness and cryptographic security. * chore: Improve proxy configuration logging in customFetch function * fix: Improve logging for non-standard WWW-Authenticate header in customFetch function
2025-06-09 11:27:23 -04:00
const requiredRole = process.env.OPENID_REQUIRED_ROLE;
const requiredRoleParameterPath = process.env.OPENID_REQUIRED_ROLE_PARAMETER_PATH;
const requiredRoleTokenKind = process.env.OPENID_REQUIRED_ROLE_TOKEN_KIND;
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
const usePKCE = isEnabled(process.env.OPENID_USE_PKCE);
logger.info(`[openidStrategy] OpenID authentication configuration`, {
generateNonce: shouldGenerateNonce,
reason: shouldGenerateNonce
? 'OPENID_GENERATE_NONCE=true - Will generate nonce and use explicit metadata for federated providers'
: 'OPENID_GENERATE_NONCE=false - Standard flow without explicit nonce or metadata',
});
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
const openidLogin = new CustomOpenIDStrategy(
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
{
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
config: openidConfig,
scope: process.env.OPENID_SCOPE,
callbackURL: process.env.DOMAIN_SERVER + process.env.OPENID_CALLBACK_URL,
clockTolerance: process.env.OPENID_CLOCK_TOLERANCE || 300,
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
usePKCE,
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
},
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
async (tokenset, done) => {
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
try {
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
const claims = tokenset.claims();
let user = await findUser({ openidId: claims.sub });
logger.info(
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
`[openidStrategy] user ${user ? 'found' : 'not found'} with openidId: ${claims.sub}`,
);
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
if (!user) {
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
user = await findUser({ email: claims.email });
logger.info(
`[openidStrategy] user ${user ? 'found' : 'not found'} with email: ${
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
claims.email
} for openidId: ${claims.sub}`,
);
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
}
if (user != null && user.provider !== 'openid') {
logger.info(
`[openidStrategy] Attempted OpenID login by user ${user.email}, was registered with "${user.provider}" provider`,
);
return done(null, false, {
message: ErrorTypes.AUTH_FAILED,
});
}
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
const userinfo = {
...claims,
...(await getUserInfo(openidConfig, tokenset.access_token, claims.sub)),
};
const fullName = getFullName(userinfo);
if (requiredRole) {
let decodedToken = '';
if (requiredRoleTokenKind === 'access') {
decodedToken = jwtDecode(tokenset.access_token);
} else if (requiredRoleTokenKind === 'id') {
decodedToken = jwtDecode(tokenset.id_token);
}
const pathParts = requiredRoleParameterPath.split('.');
let found = true;
let roles = pathParts.reduce((o, key) => {
if (o === null || o === undefined || !(key in o)) {
found = false;
return [];
}
return o[key];
}, decodedToken);
if (!found) {
logger.error(
`[openidStrategy] Key '${requiredRoleParameterPath}' not found in ${requiredRoleTokenKind} token!`,
);
}
if (!roles.includes(requiredRole)) {
return done(null, false, {
message: `You must have the "${requiredRole}" role to log in.`,
});
}
}
let username = '';
if (process.env.OPENID_USERNAME_CLAIM) {
username = userinfo[process.env.OPENID_USERNAME_CLAIM];
} else {
username = convertToUsername(
userinfo.preferred_username || userinfo.username || userinfo.email,
);
}
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
if (!user) {
📧 feat: email verification (#2344) * feat: verification email * chore: email verification invalid; localize: update * fix: redirect to login when signup: fix: save emailVerified correctly * docs: update ALLOW_UNVERIFIED_EMAIL_LOGIN; fix: don't accept login only when ALLOW_UNVERIFIED_EMAIL_LOGIN = true * fix: user needs to be authenticated * style: update * fix: registration success message and redirect logic * refactor: use `isEnabled` in ALLOW_UNVERIFIED_EMAIL_LOGIN * refactor: move checkEmailConfig to server/utils * refactor: use req as param for verifyEmail function * chore: jsdoc * chore: remove console log * refactor: rename `createNewUser` to `createSocialUser` * refactor: update typing and add expiresAt field to userSchema * refactor: begin use of user methods over direct model access for User * refactor: initial email verification rewrite * chore: typing * refactor: registration flow rewrite * chore: remove help center text * refactor: update getUser to getUserById and add findUser methods. general fixes from recent changes * refactor: Update updateUser method to remove expiresAt field and use $set and $unset operations, createUser now returns Id only * refactor: Update openidStrategy to use optional chaining for avatar check, move saveBuffer init to buffer condition * refactor: logout on deleteUser mutatation * refactor: Update openidStrategy login success message format * refactor: Add emailVerified field to Discord and Facebook profile details * refactor: move limiters to separate middleware dir * refactor: Add limiters for email verification and password reset * refactor: Remove getUserController and update routes and controllers accordingly * refactor: Update getUserById method to exclude password and version fields * refactor: move verification to user route, add resend verification option * refactor: Improve email verification process and resend option * refactor: remove more direct model access of User and remove unused code * refactor: replace user authentication methods and token generation * fix: add user.id to jwt user * refactor: Update AuthContext to include setError function, add resend link to Login Form, make registration redirect shorter * fix(updateUserPluginsService): ensure userPlugins variable is defined * refactor: Delete all shared links for a specific user * fix: remove use of direct User.save() in handleExistingUser * fix(importLibreChatConvo): handle missing createdAt field in messages --------- Co-authored-by: Danny Avila <danny@librechat.ai>
2024-06-07 21:06:47 +02:00
user = {
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
provider: 'openid',
openidId: userinfo.sub,
username,
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
email: userinfo.email || '',
emailVerified: userinfo.email_verified || false,
name: fullName,
idOnTheSource: userinfo.oid,
📧 feat: email verification (#2344) * feat: verification email * chore: email verification invalid; localize: update * fix: redirect to login when signup: fix: save emailVerified correctly * docs: update ALLOW_UNVERIFIED_EMAIL_LOGIN; fix: don't accept login only when ALLOW_UNVERIFIED_EMAIL_LOGIN = true * fix: user needs to be authenticated * style: update * fix: registration success message and redirect logic * refactor: use `isEnabled` in ALLOW_UNVERIFIED_EMAIL_LOGIN * refactor: move checkEmailConfig to server/utils * refactor: use req as param for verifyEmail function * chore: jsdoc * chore: remove console log * refactor: rename `createNewUser` to `createSocialUser` * refactor: update typing and add expiresAt field to userSchema * refactor: begin use of user methods over direct model access for User * refactor: initial email verification rewrite * chore: typing * refactor: registration flow rewrite * chore: remove help center text * refactor: update getUser to getUserById and add findUser methods. general fixes from recent changes * refactor: Update updateUser method to remove expiresAt field and use $set and $unset operations, createUser now returns Id only * refactor: Update openidStrategy to use optional chaining for avatar check, move saveBuffer init to buffer condition * refactor: logout on deleteUser mutatation * refactor: Update openidStrategy login success message format * refactor: Add emailVerified field to Discord and Facebook profile details * refactor: move limiters to separate middleware dir * refactor: Add limiters for email verification and password reset * refactor: Remove getUserController and update routes and controllers accordingly * refactor: Update getUserById method to exclude password and version fields * refactor: move verification to user route, add resend verification option * refactor: Improve email verification process and resend option * refactor: remove more direct model access of User and remove unused code * refactor: replace user authentication methods and token generation * fix: add user.id to jwt user * refactor: Update AuthContext to include setError function, add resend link to Login Form, make registration redirect shorter * fix(updateUserPluginsService): ensure userPlugins variable is defined * refactor: Delete all shared links for a specific user * fix: remove use of direct User.save() in handleExistingUser * fix(importLibreChatConvo): handle missing createdAt field in messages --------- Co-authored-by: Danny Avila <danny@librechat.ai>
2024-06-07 21:06:47 +02:00
};
🏗️ refactor: Extract DB layers to `data-schemas` for shared use (#7650) * refactor: move model definitions and database-related methods to packages/data-schemas * ci: update tests due to new DB structure fix: disable mocking `librechat-data-provider` feat: Add schema exports to data-schemas package - Introduced a new schema module that exports various schemas including action, agent, and user schemas. - Updated index.ts to include the new schema exports for better modularity and organization. ci: fix appleStrategy tests fix: Agent.spec.js ci: refactor handleTools tests to use MongoMemoryServer for in-memory database fix: getLogStores imports ci: update banViolation tests to use MongoMemoryServer and improve session mocking test: refactor samlStrategy tests to improve mock configurations and user handling ci: fix crypto mock in handleText tests for improved accuracy ci: refactor spendTokens tests to improve model imports and setup ci: refactor Message model tests to use MongoMemoryServer and improve database interactions * refactor: streamline IMessage interface and move feedback properties to types/message.ts * refactor: use exported initializeRoles from `data-schemas`, remove api workspace version (this serves as an example of future migrations that still need to happen) * refactor: update model imports to use destructuring from `~/db/models` for consistency and clarity * refactor: remove unused mongoose imports from model files for cleaner code * refactor: remove unused mongoose imports from Share, Prompt, and Transaction model files for cleaner code * refactor: remove unused import in Transaction model for cleaner code * ci: update deploy workflow to reference new Docker Dev Branch Images Build and add new workflow for building Docker images on dev branch * chore: cleanup imports
2025-05-30 22:18:13 -04:00
🛜 refactor: Streamline App Config Usage (#9234) * WIP: app.locals refactoring WIP: appConfig fix: update memory configuration retrieval to use getAppConfig based on user role fix: update comment for AppConfig interface to clarify purpose 🏷️ refactor: Update tests to use getAppConfig for endpoint configurations ci: Update AppService tests to initialize app config instead of app.locals ci: Integrate getAppConfig into remaining tests refactor: Update multer storage destination to use promise-based getAppConfig and improve error handling in tests refactor: Rename initializeAppConfig to setAppConfig and update related tests ci: Mock getAppConfig in various tests to provide default configurations refactor: Update convertMCPToolsToPlugins to use mcpManager for server configuration and adjust related tests chore: rename `Config/getAppConfig` -> `Config/app` fix: streamline OpenAI image tools configuration by removing direct appConfig dependency and using function parameters chore: correct parameter documentation for imageOutputType in ToolService.js refactor: remove `getCustomConfig` dependency in config route refactor: update domain validation to use appConfig for allowed domains refactor: use appConfig registration property chore: remove app parameter from AppService invocation refactor: update AppConfig interface to correct registration and turnstile configurations refactor: remove getCustomConfig dependency and use getAppConfig in PluginController, multer, and MCP services refactor: replace getCustomConfig with getAppConfig in STTService, TTSService, and related files refactor: replace getCustomConfig with getAppConfig in Conversation and Message models, update tempChatRetention functions to use AppConfig type refactor: update getAppConfig calls in Conversation and Message models to include user role for temporary chat expiration ci: update related tests refactor: update getAppConfig call in getCustomConfigSpeech to include user role fix: update appConfig usage to access allowedDomains from actions instead of registration refactor: enhance AppConfig to include fileStrategies and update related file strategy logic refactor: update imports to use normalizeEndpointName from @librechat/api and remove redundant definitions chore: remove deprecated unused RunManager refactor: get balance config primarily from appConfig refactor: remove customConfig dependency for appConfig and streamline loadConfigModels logic refactor: remove getCustomConfig usage and use app config in file citations refactor: consolidate endpoint loading logic into loadEndpoints function refactor: update appConfig access to use endpoints structure across various services refactor: implement custom endpoints configuration and streamline endpoint loading logic refactor: update getAppConfig call to include user role parameter refactor: streamline endpoint configuration and enhance appConfig usage across services refactor: replace getMCPAuthMap with getUserMCPAuthMap and remove unused getCustomConfig file refactor: add type annotation for loadedEndpoints in loadEndpoints function refactor: move /services/Files/images/parse to TS API chore: add missing FILE_CITATIONS permission to IRole interface refactor: restructure toolkits to TS API refactor: separate manifest logic into its own module refactor: consolidate tool loading logic into a new tools module for startup logic refactor: move interface config logic to TS API refactor: migrate checkEmailConfig to TypeScript and update imports refactor: add FunctionTool interface and availableTools to AppConfig refactor: decouple caching and DB operations from AppService, make part of consolidated `getAppConfig` WIP: fix tests * fix: rebase conflicts * refactor: remove app.locals references * refactor: replace getBalanceConfig with getAppConfig in various strategies and middleware * refactor: replace appConfig?.balance with getBalanceConfig in various controllers and clients * test: add balance configuration to titleConvo method in AgentClient tests * chore: remove unused `openai-chat-tokens` package * chore: remove unused imports in initializeMCPs.js * refactor: update balance configuration to use getAppConfig instead of getBalanceConfig * refactor: integrate configMiddleware for centralized configuration handling * refactor: optimize email domain validation by removing unnecessary async calls * refactor: simplify multer storage configuration by removing async calls * refactor: reorder imports for better readability in user.js * refactor: replace getAppConfig calls with req.config for improved performance * chore: replace getAppConfig calls with req.config in tests for centralized configuration handling * chore: remove unused override config * refactor: add configMiddleware to endpoint route and replace getAppConfig with req.config * chore: remove customConfig parameter from TTSService constructor * refactor: pass appConfig from request to processFileCitations for improved configuration handling * refactor: remove configMiddleware from endpoint route and retrieve appConfig directly in getEndpointsConfig if not in `req.config` * test: add mockAppConfig to processFileCitations tests for improved configuration handling * fix: pass req.config to hasCustomUserVars and call without await after synchronous refactor * fix: type safety in useExportConversation * refactor: retrieve appConfig using getAppConfig in PluginController and remove configMiddleware from plugins route, to avoid always retrieving when plugins are cached * chore: change `MongoUser` typedef to `IUser` * fix: Add `user` and `config` fields to ServerRequest and update JSDoc type annotations from Express.Request to ServerRequest * fix: remove unused setAppConfig mock from Server configuration tests
2025-08-26 12:10:18 -04:00
const appConfig = await getAppConfig();
const balanceConfig = getBalanceConfig(appConfig);
🏗️ refactor: Extract DB layers to `data-schemas` for shared use (#7650) * refactor: move model definitions and database-related methods to packages/data-schemas * ci: update tests due to new DB structure fix: disable mocking `librechat-data-provider` feat: Add schema exports to data-schemas package - Introduced a new schema module that exports various schemas including action, agent, and user schemas. - Updated index.ts to include the new schema exports for better modularity and organization. ci: fix appleStrategy tests fix: Agent.spec.js ci: refactor handleTools tests to use MongoMemoryServer for in-memory database fix: getLogStores imports ci: update banViolation tests to use MongoMemoryServer and improve session mocking test: refactor samlStrategy tests to improve mock configurations and user handling ci: fix crypto mock in handleText tests for improved accuracy ci: refactor spendTokens tests to improve model imports and setup ci: refactor Message model tests to use MongoMemoryServer and improve database interactions * refactor: streamline IMessage interface and move feedback properties to types/message.ts * refactor: use exported initializeRoles from `data-schemas`, remove api workspace version (this serves as an example of future migrations that still need to happen) * refactor: update model imports to use destructuring from `~/db/models` for consistency and clarity * refactor: remove unused mongoose imports from model files for cleaner code * refactor: remove unused mongoose imports from Share, Prompt, and Transaction model files for cleaner code * refactor: remove unused import in Transaction model for cleaner code * ci: update deploy workflow to reference new Docker Dev Branch Images Build and add new workflow for building Docker images on dev branch * chore: cleanup imports
2025-05-30 22:18:13 -04:00
user = await createUser(user, balanceConfig, true, true);
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
} else {
user.provider = 'openid';
user.openidId = userinfo.sub;
user.username = username;
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
user.name = fullName;
user.idOnTheSource = userinfo.oid;
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
}
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
if (!!userinfo && userinfo.picture && !user.avatar?.includes('manual=true')) {
/** @type {string | undefined} */
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
const imageUrl = userinfo.picture;
let fileName;
if (crypto) {
fileName = (await hashToken(userinfo.sub)) + '.png';
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
} else {
fileName = userinfo.sub + '.png';
}
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
const imageBuffer = await downloadImage(
imageUrl,
openidConfig,
tokenset.access_token,
userinfo.sub,
);
if (imageBuffer) {
📧 feat: email verification (#2344) * feat: verification email * chore: email verification invalid; localize: update * fix: redirect to login when signup: fix: save emailVerified correctly * docs: update ALLOW_UNVERIFIED_EMAIL_LOGIN; fix: don't accept login only when ALLOW_UNVERIFIED_EMAIL_LOGIN = true * fix: user needs to be authenticated * style: update * fix: registration success message and redirect logic * refactor: use `isEnabled` in ALLOW_UNVERIFIED_EMAIL_LOGIN * refactor: move checkEmailConfig to server/utils * refactor: use req as param for verifyEmail function * chore: jsdoc * chore: remove console log * refactor: rename `createNewUser` to `createSocialUser` * refactor: update typing and add expiresAt field to userSchema * refactor: begin use of user methods over direct model access for User * refactor: initial email verification rewrite * chore: typing * refactor: registration flow rewrite * chore: remove help center text * refactor: update getUser to getUserById and add findUser methods. general fixes from recent changes * refactor: Update updateUser method to remove expiresAt field and use $set and $unset operations, createUser now returns Id only * refactor: Update openidStrategy to use optional chaining for avatar check, move saveBuffer init to buffer condition * refactor: logout on deleteUser mutatation * refactor: Update openidStrategy login success message format * refactor: Add emailVerified field to Discord and Facebook profile details * refactor: move limiters to separate middleware dir * refactor: Add limiters for email verification and password reset * refactor: Remove getUserController and update routes and controllers accordingly * refactor: Update getUserById method to exclude password and version fields * refactor: move verification to user route, add resend verification option * refactor: Improve email verification process and resend option * refactor: remove more direct model access of User and remove unused code * refactor: replace user authentication methods and token generation * fix: add user.id to jwt user * refactor: Update AuthContext to include setError function, add resend link to Login Form, make registration redirect shorter * fix(updateUserPluginsService): ensure userPlugins variable is defined * refactor: Delete all shared links for a specific user * fix: remove use of direct User.save() in handleExistingUser * fix(importLibreChatConvo): handle missing createdAt field in messages --------- Co-authored-by: Danny Avila <danny@librechat.ai>
2024-06-07 21:06:47 +02:00
const { saveBuffer } = getStrategyFunctions(process.env.CDN_PROVIDER);
const imagePath = await saveBuffer({
fileName,
userId: user._id.toString(),
buffer: imageBuffer,
});
user.avatar = imagePath ?? '';
}
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
}
📧 feat: email verification (#2344) * feat: verification email * chore: email verification invalid; localize: update * fix: redirect to login when signup: fix: save emailVerified correctly * docs: update ALLOW_UNVERIFIED_EMAIL_LOGIN; fix: don't accept login only when ALLOW_UNVERIFIED_EMAIL_LOGIN = true * fix: user needs to be authenticated * style: update * fix: registration success message and redirect logic * refactor: use `isEnabled` in ALLOW_UNVERIFIED_EMAIL_LOGIN * refactor: move checkEmailConfig to server/utils * refactor: use req as param for verifyEmail function * chore: jsdoc * chore: remove console log * refactor: rename `createNewUser` to `createSocialUser` * refactor: update typing and add expiresAt field to userSchema * refactor: begin use of user methods over direct model access for User * refactor: initial email verification rewrite * chore: typing * refactor: registration flow rewrite * chore: remove help center text * refactor: update getUser to getUserById and add findUser methods. general fixes from recent changes * refactor: Update updateUser method to remove expiresAt field and use $set and $unset operations, createUser now returns Id only * refactor: Update openidStrategy to use optional chaining for avatar check, move saveBuffer init to buffer condition * refactor: logout on deleteUser mutatation * refactor: Update openidStrategy login success message format * refactor: Add emailVerified field to Discord and Facebook profile details * refactor: move limiters to separate middleware dir * refactor: Add limiters for email verification and password reset * refactor: Remove getUserController and update routes and controllers accordingly * refactor: Update getUserById method to exclude password and version fields * refactor: move verification to user route, add resend verification option * refactor: Improve email verification process and resend option * refactor: remove more direct model access of User and remove unused code * refactor: replace user authentication methods and token generation * fix: add user.id to jwt user * refactor: Update AuthContext to include setError function, add resend link to Login Form, make registration redirect shorter * fix(updateUserPluginsService): ensure userPlugins variable is defined * refactor: Delete all shared links for a specific user * fix: remove use of direct User.save() in handleExistingUser * fix(importLibreChatConvo): handle missing createdAt field in messages --------- Co-authored-by: Danny Avila <danny@librechat.ai>
2024-06-07 21:06:47 +02:00
user = await updateUser(user._id, user);
logger.info(
📧 feat: email verification (#2344) * feat: verification email * chore: email verification invalid; localize: update * fix: redirect to login when signup: fix: save emailVerified correctly * docs: update ALLOW_UNVERIFIED_EMAIL_LOGIN; fix: don't accept login only when ALLOW_UNVERIFIED_EMAIL_LOGIN = true * fix: user needs to be authenticated * style: update * fix: registration success message and redirect logic * refactor: use `isEnabled` in ALLOW_UNVERIFIED_EMAIL_LOGIN * refactor: move checkEmailConfig to server/utils * refactor: use req as param for verifyEmail function * chore: jsdoc * chore: remove console log * refactor: rename `createNewUser` to `createSocialUser` * refactor: update typing and add expiresAt field to userSchema * refactor: begin use of user methods over direct model access for User * refactor: initial email verification rewrite * chore: typing * refactor: registration flow rewrite * chore: remove help center text * refactor: update getUser to getUserById and add findUser methods. general fixes from recent changes * refactor: Update updateUser method to remove expiresAt field and use $set and $unset operations, createUser now returns Id only * refactor: Update openidStrategy to use optional chaining for avatar check, move saveBuffer init to buffer condition * refactor: logout on deleteUser mutatation * refactor: Update openidStrategy login success message format * refactor: Add emailVerified field to Discord and Facebook profile details * refactor: move limiters to separate middleware dir * refactor: Add limiters for email verification and password reset * refactor: Remove getUserController and update routes and controllers accordingly * refactor: Update getUserById method to exclude password and version fields * refactor: move verification to user route, add resend verification option * refactor: Improve email verification process and resend option * refactor: remove more direct model access of User and remove unused code * refactor: replace user authentication methods and token generation * fix: add user.id to jwt user * refactor: Update AuthContext to include setError function, add resend link to Login Form, make registration redirect shorter * fix(updateUserPluginsService): ensure userPlugins variable is defined * refactor: Delete all shared links for a specific user * fix: remove use of direct User.save() in handleExistingUser * fix(importLibreChatConvo): handle missing createdAt field in messages --------- Co-authored-by: Danny Avila <danny@librechat.ai>
2024-06-07 21:06:47 +02:00
`[openidStrategy] login success openidId: ${user.openidId} | email: ${user.email} | username: ${user.username} `,
{
user: {
openidId: user.openidId,
username: user.username,
email: user.email,
name: user.name,
},
},
);
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
done(null, { ...user, tokenset });
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
} catch (err) {
logger.error('[openidStrategy] login failed', err);
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
done(err);
}
},
OpenID Authentication (#495) * Squashed commit of the following: commit 26ab03fb36fcc7fcee63fdf3ae8c2dfb29027eff Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:23 2023 -0500 Update Registration.spec.tsx commit e908dd82fe9ef1b43c75ee64c183d2f654bdac1c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:23:01 2023 -0500 Update Login.spec.tsx commit 223734820fb77d7fb5af4802af642d1c1fd7c1f5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:22:39 2023 -0500 Update Registration.tsx commit 7036d3dd0538979ee397d958ebc113bb0ea32411 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:55 2023 -0500 Update Login.tsx commit 76bb78221db3195fd930fe9cfd6a5da7194fa759 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:21:03 2023 -0500 Update envConstants.js commit ee2f69f33d75fbb57022afbcd9564bca38a46bee Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:20:08 2023 -0500 Update docker-compose.yml commit 5ac72d789b3446884c6e2f4f595cbf67d731d43c Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:18:41 2023 -0500 Update Dockerfile commit d24341db2bd5b17eb89ab01e171a5f51f3beab0a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:16:38 2023 -0500 Update .env.example commit 22154f4a09c5fcdfee95d43609fb01a5a883b7a9 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:48 2023 -0500 Update Registration.spec.tsx commit 5163f7d372a6a03c94f4357b358211a03369456e Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:30 2023 -0500 Update Login.spec.tsx commit 61da49e330a9376e130b24dc944854f97ab58d80 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:07:00 2023 -0500 Update Registration.tsx commit 0e45d3f0dbde34388ff2f0b2dc51b983b472eb05 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:06:18 2023 -0500 Update Login.tsx commit dca1e5367e5f3b468c7964218cc5914ca53095af Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:05:07 2023 -0500 Update envConstants.js commit f48c058465d82b03716ba85224e9f97007e014d2 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Tue Jun 13 00:04:05 2023 -0500 Update .env.example commit 818226c9cb079acae4fcbfe5997e4aa9e3c6d2cc Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:59:08 2023 -0500 Update .env.example commit 9a805439189b352a38ac7654d7a31bb28f0f58dd Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:58:31 2023 -0500 Update env.d.ts commit 3f37ce54758b017c9281b7fad9b040a47630ec66 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:57:04 2023 -0500 Update .env.example commit 1026036f4dd529e9531c53084450ce768cfca4c1 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:36 2023 -0500 Update docker-compose.yml commit a61cf7b8c51d4a9bd73a20bd67abc29891c11463 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:50:00 2023 -0500 Update Dockerfile commit 79610d6648755cd5ec45215b9fdbe04ba8242fcf Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:35:34 2023 -0500 Update package-lock.json commit e40853fd2b77f2db5be1c3dfd8b170d650e23271 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:30:17 2023 -0500 Update envConstants.js commit 5529bc61b43f279fb4418c3851be2f9011b6454d Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:25:58 2023 -0500 Update docker-compose.yml commit 07848cc464a64f7cad484e24a1310dc61aa03b18 Merge: ec628a3 72e9828 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:24:03 2023 -0500 Merge branch 'danny-avila:main' into openid-client commit ec628a3044ba963b4e733c72229400074e7c2bc4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:23:16 2023 -0500 Update envConstants.js commit 21272221db0f58c244f08335482d45b177d338ab Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:59 2023 -0500 Update Registration.spec.tsx commit d3f2949c0484d5760e7b689501852f86209992a3 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:21:12 2023 -0500 Update Login.spec.tsx commit f2cf23ddd6708a3bb8d032dde5f1ce300dbe8cad Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:20:15 2023 -0500 Update Registration.tsx commit 482c346b2a7baf958665c9474223d2557504dee5 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:17:53 2023 -0500 Update Login.tsx commit 2f017aa5bf4ef91b73fe027fb346132e1a5d8b87 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:14:17 2023 -0500 Update env.d.ts commit addfd95cf93ef19cae05bab652d634af64313e6a Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:13:16 2023 -0500 Create openidStrategy.js commit 84c3b5c2f078494d8380f3a02e3ba2d935d8d79f Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:09:02 2023 -0500 Update oauth.js commit 63225cdf33b7f42005b4a446797acbd91b7ee4a7 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:07:35 2023 -0500 Update index.js commit 6efe4dafd4359ed1c3139468bf9d43f70bbaf6aa Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:04:55 2023 -0500 Update package.json commit 201badbbb5a5c8d48f5c4cba3a1349d4cfc7a070 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:03:37 2023 -0500 Update User.js commit 7d13d5c303465be9b1268e5f6d9bdf7bb8dfb2e4 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:02:29 2023 -0500 Update Dockerfile commit 2ef7f84ea77f281c3dce61211d9fd841a6424e65 Author: bsu3338 <bsu3338@users.noreply.github.com> Date: Mon Jun 12 23:00:42 2023 -0500 Update .env.example * Update openidStrategy.js * Update .env.example * Update .env.example * Update docker-compose.yml * Update env.d.ts * Update .env.example * Update .env.example * Update config.js * Update Login.tsx * Update config.js * Update Login.tsx * Update Registration.tsx * Update docker-compose.yml * Update openidStrategy.js * Update docker-compose.yml * Update config.spec.js * Update Login.spec.tsx * Update Registration.spec.tsx * Update types.ts * Update .env.example * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js * Update config.js * Update config.js * Update Login.tsx * Update Registration.tsx * Update oauth.js * Update openidStrategy.js * Update openidStrategy.js * Update Registration.tsx * Update Login.tsx * Update Login.tsx * Update Registration.tsx * Update Registration.tsx * Update index.js * Update index.js * Update .env.example * Update user_auth_system.md updated instruction that includes OpenID set up * Update package.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update package-lock.json * Update openidStrategy.js * Update openidStrategy.js Lookup user based on openID instead of email. This is because not all AzureAD users may have an email tied to their account * Update openidStrategy.js First try to match an email, then try openIdID * Update openidStrategy.js * Update openidStrategy.js Consider a family name or given name is not provided --------- Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-24 21:45:52 -05:00
);
passport.use('openid', openidLogin);
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
return openidConfig;
} catch (err) {
logger.error('[openidStrategy]', err);
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
return null;
}
}
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
/**
* @function getOpenIdConfig
* @description Returns the OpenID client instance.
* @throws {Error} If the OpenID client is not initialized.
* @returns {Configuration}
*/
function getOpenIdConfig() {
if (!openidConfig) {
throw new Error('OpenID client is not initialized. Please call setupOpenId first.');
}
return openidConfig;
}
*️⃣ feat: Reuse OpenID Auth Tokens (#7397) * feat: integrate OpenID Connect support with token reuse - Added `jwks-rsa` and `new-openid-client` dependencies for OpenID Connect functionality. - Implemented OpenID token refresh logic in `AuthController`. - Enhanced `LogoutController` to handle OpenID logout and session termination. - Updated JWT authentication middleware to support OpenID token provider. - Modified OAuth routes to accommodate OpenID authentication and token management. - Created `setOpenIDAuthTokens` function to manage OpenID tokens in cookies. - Upgraded OpenID strategy with user info fetching and token exchange protocol. - Introduced `openIdJwtLogin` strategy for handling OpenID JWT tokens. - Added caching mechanism for exchanged OpenID tokens. - Updated configuration to include OpenID exchanged tokens cache key. - updated .env.example to include the new env variables needed for the feature. * fix: update return type in downloadImage documentation for clarity and fixed openIdJwtLogin env variables * fix: update Jest configuration and tests for OpenID strategy integration * fix: update OpenID strategy to include callback URL in setup * fix: fix optionalJwtAuth middleware to support OpenID token reuse and improve currentUrl method in CustomOpenIDStrategy to override the dynamic host issue related to proxy (e.g. cloudfront) * fix: fixed code formatting * Fix: Add mocks for openid-client and passport strategy in Jest configuration to fix unit tests * fix eslint errors: Format mock file openid-client. * ✨ feat: Add PKCE support for OpenID and default handling in strategy setup --------- Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com> Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com>
2025-05-22 14:19:24 +02:00
module.exports = {
setupOpenId,
getOpenIdConfig,
};