feat(oauth-server): allow updating token_endpoint_auth_method for OAuth clients#2391
feat(oauth-server): allow updating token_endpoint_auth_method for OAuth clients#2391cemalkilic wants to merge 2 commits intomasterfrom
token_endpoint_auth_method for OAuth clients#2391Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Cache: Disabled due to Reviews > Disable Cache setting Disabled knowledge base sources:
📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis pull request adds support for updating the Sequence Diagram(s)sequenceDiagram
participant Admin as Admin Client
participant API as Admin API Handler
participant Svc as OAuthServer Service
participant DB as Data Store
Admin->>API: PUT /admin/oauth/clients/{id} with token_endpoint_auth_method
API->>Svc: Build OAuthServerClientUpdateParams (includes token_endpoint_auth_method)
Svc->>Svc: Validate token_endpoint_auth_method in allowed methods
alt method valid for client_type
Svc->>DB: Update client record (apply new method and other fields)
DB-->>Svc: Updated client
Svc-->>API: Return updated client payload
API-->>Admin: 200 OK with updated client
else invalid for client_type
Svc-->>API: Return validation error
API-->>Admin: 4xx error with message
end
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/api/oauthserver/service.go`:
- Around line 432-437: The validation for p.TokenEndpointAuthMethod currently
returns a plain fmt.Errorf when the method is invalid; update the check in the
function containing p.TokenEndpointAuthMethod to return an
apierrors.NewBadRequestError (with validation_failed error_code) instead of
fmt.Errorf so the caller receives a 400/validation_failed response. Keep the
logic that compares *p.TokenEndpointAuthMethod against GetAllValidAuthMethods()
(using slices.Contains) but replace the error construction with an
apierrors.NewBadRequestError that includes a clear message listing validMethods,
mirroring other validations in this file.
ℹ️ Review info
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Cache: Disabled due to Reviews > Disable Cache setting
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
internal/api/oauthserver/handlers_test.gointernal/api/oauthserver/service.goopenapi.yaml
Summary
The OAuth client update endpoint (PUT) now accepts
token_endpoint_auth_method, allowing admins to change how a client authenticates at the token endpoint without deleting and re-creating it. Cross-type changes are rejected (e.g., setting a confidential client to 'none').