feat: added oAuth client creditinals#7198
Open
SahilJat wants to merge 1 commit intoFlagsmith:mainfrom
Open
Conversation
|
@SahilJat is attempting to deploy a commit to the Flagsmith Team on Vercel. A member of the Team first needs to authorize it. |
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%) LiveReview Pre-Commit Check: skipped
35c0ebe to
1641e45
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Closes #7153
Enable the OAuth 2.0 client-credentials grant type for M2M clients
(CI/CD pipelines, SCIM provisioners, internal tooling).
api/app/settings/common.py"scim": "SCIM provisioning access"toOAUTH2_PROVIDER["SCOPES"]"client_credentials"toOAUTH2_PROVIDER["ALLOWED_GRANT_TYPES"]api/oauth2_metadata/views.pygrant_types_supportedfromOAUTH2_PROVIDER["ALLOWED_GRANT_TYPES"]instead of a hardcoded list, so the metadata endpoint never drifts
from what django-oauth-toolkit actually allows
api/tests/unit/oauth2_metadata/test_views.pytest_metadata_endpoint__grant_types__derived_from_allowed_grant_types_settingtest_metadata_endpoint__grant_types__include_client_credentials_by_defaulttest_metadata_endpoint__scim_scope__present_in_scopes_supportedHow did you test this code?
Ran the existing and new unit tests:
cd api pytest tests/unit/oauth2_metadata/ -vAll existing tests pass. The three new tests in test_views.py
confirm:
grant_types_supportedin the metadata endpoint is derivedfrom
OAUTH2_PROVIDER["ALLOWED_GRANT_TYPES"]and not hardcoded.client_credentialsappears ingrant_types_supportedwiththe real settings (AC Remove unused imports #3).
scimappears inscopes_supportedwith the real settings.Manually verified the token endpoint with curl: