Skip to content

🔐 feat: Enhance OpenID User Info Handling #4561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 27, 2024
Merged

Conversation

danny-avila
Copy link
Owner

Summary

Originally #4248

  • Extracted the full name retrieval logic into a separate function getFullName for better code organization and reusability
  • Added environment variables OPENID_USERNAME_CLAIM and OPENID_NAME_CLAIM to customize which user info properties to use for username and name
  • Added detailed documentation for the getFullName function with JSDoc comments
  • Implemented extensive test coverage using MongoDB Memory Server for OpenID authentication scenarios
  • Added test cases for username handling, name retrieval, and role-based access control
  • Improved error handling for required role validation
  • Added test cases for existing user updates and role enforcement
  • Updated environment example file with new configuration options

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective
  • Local unit tests pass with my changes

@danny-avila danny-avila merged commit a1647d7 into main Oct 27, 2024
2 checks passed
@danny-avila danny-avila deleted the feat/openid-name-claims branch October 27, 2024 15:41
BertKiv pushed a commit to BertKiv/LibreChat that referenced this pull request Dec 10, 2024
* oidc-changes Initial attempt at testing openidStrategy and adding OPENID_USERNAME_CLAIM setting

* oidc-changes Add OPENID_NAME_CLAIM

* oidc-changes cleanup oidc test code

* oidc-changes using mongo memory server for test

* oidc-changes Change tests to expect username all lowercase

* oidc-changes Add more tests

* chore: linting

* refactor: Simplify OpenID full name retrieval logic

* refactor: Simplify OpenID user info retrieval logic

* refactor: move helper to openidStrategy.js

---------

Co-authored-by: alihacks <[email protected]>
MichielMAnalytics pushed a commit to MichielMAnalytics/ProAI that referenced this pull request Jun 6, 2025
* oidc-changes Initial attempt at testing openidStrategy and adding OPENID_USERNAME_CLAIM setting

* oidc-changes Add OPENID_NAME_CLAIM

* oidc-changes cleanup oidc test code

* oidc-changes using mongo memory server for test

* oidc-changes Change tests to expect username all lowercase

* oidc-changes Add more tests

* chore: linting

* refactor: Simplify OpenID full name retrieval logic

* refactor: Simplify OpenID user info retrieval logic

* refactor: move helper to openidStrategy.js

---------

Co-authored-by: alihacks <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants