Skip to content

Commit 30500cf

Browse files
authored
Fix export and detail API inconsistencies for remote auth config (#2198)
* fix: resolve export and detail API inconsistencies - Add missing UsePKCE field to RemoteAuthConfig struct - Fix PascalCase field names in remote_auth_config JSON responses - Update conversion functions to include UsePKCE field - Ensure both export and detail endpoints return consistent auth config * generate docs
1 parent df489b6 commit 30500cf

File tree

7 files changed

+35
-24
lines changed

7 files changed

+35
-24
lines changed

docs/server/docs.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/server/swagger.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/server/swagger.yaml

Lines changed: 14 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/api/v1/workload_service.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ func (s *WorkloadService) BuildFullRunConfig(ctx context.Context, req *createReq
167167
Issuer: remoteServerMetadata.OAuthConfig.Issuer,
168168
AuthorizeURL: remoteServerMetadata.OAuthConfig.AuthorizeURL,
169169
TokenURL: remoteServerMetadata.OAuthConfig.TokenURL,
170+
UsePKCE: remoteServerMetadata.OAuthConfig.UsePKCE,
170171
OAuthParams: remoteServerMetadata.OAuthConfig.OAuthParams,
171172
Headers: remoteServerMetadata.Headers,
172173
EnvVars: remoteServerMetadata.EnvVars,
@@ -270,6 +271,7 @@ func createRequestToRemoteAuthConfig(
270271
Issuer: req.OAuthConfig.Issuer,
271272
AuthorizeURL: req.OAuthConfig.AuthorizeURL,
272273
TokenURL: req.OAuthConfig.TokenURL,
274+
UsePKCE: req.OAuthConfig.UsePKCE,
273275
OAuthParams: req.OAuthConfig.OAuthParams,
274276
CallbackPort: req.OAuthConfig.CallbackPort,
275277
SkipBrowser: req.OAuthConfig.SkipBrowser,

pkg/api/v1/workload_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ func runConfigToCreateRequest(runConfig *runner.RunConfig) *createRequest {
207207
TokenURL: runConfig.RemoteAuthConfig.TokenURL,
208208
ClientID: runConfig.RemoteAuthConfig.ClientID,
209209
Scopes: runConfig.RemoteAuthConfig.Scopes,
210+
UsePKCE: runConfig.RemoteAuthConfig.UsePKCE,
210211
OAuthParams: runConfig.RemoteAuthConfig.OAuthParams,
211212
CallbackPort: runConfig.RemoteAuthConfig.CallbackPort,
212213
SkipBrowser: runConfig.RemoteAuthConfig.SkipBrowser,

pkg/api/v1/workloads_types_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ func TestRunConfigToCreateRequest(t *testing.T) {
158158
TokenURL: "https://oauth.example.com/token",
159159
ClientID: "test-client",
160160
Scopes: []string{"read", "write"},
161+
UsePKCE: true,
161162
OAuthParams: map[string]string{"custom": "param"},
162163
CallbackPort: 8081,
163164
},
@@ -172,6 +173,7 @@ func TestRunConfigToCreateRequest(t *testing.T) {
172173
assert.Equal(t, "https://oauth.example.com/token", result.OAuthConfig.TokenURL)
173174
assert.Equal(t, "test-client", result.OAuthConfig.ClientID)
174175
assert.Equal(t, []string{"read", "write"}, result.OAuthConfig.Scopes)
176+
assert.True(t, result.OAuthConfig.UsePKCE)
175177
assert.Equal(t, map[string]string{"custom": "param"}, result.OAuthConfig.OAuthParams)
176178
assert.Equal(t, 8081, result.OAuthConfig.CallbackPort)
177179
})

pkg/runner/config.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -438,27 +438,28 @@ func LoadState(ctx context.Context, name string) (*RunConfig, error) {
438438

439439
// RemoteAuthConfig holds configuration for remote authentication
440440
type RemoteAuthConfig struct {
441-
ClientID string
442-
ClientSecret string
443-
ClientSecretFile string
444-
Scopes []string
445-
SkipBrowser bool
446-
Timeout time.Duration `swaggertype:"string" example:"5m"`
447-
CallbackPort int
441+
ClientID string `json:"client_id,omitempty" yaml:"client_id,omitempty"`
442+
ClientSecret string `json:"client_secret,omitempty" yaml:"client_secret,omitempty"`
443+
ClientSecretFile string `json:"client_secret_file,omitempty" yaml:"client_secret_file,omitempty"`
444+
Scopes []string `json:"scopes,omitempty" yaml:"scopes,omitempty"`
445+
SkipBrowser bool `json:"skip_browser,omitempty" yaml:"skip_browser,omitempty"`
446+
Timeout time.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty" swaggertype:"string" example:"5m"`
447+
CallbackPort int `json:"callback_port,omitempty" yaml:"callback_port,omitempty"`
448+
UsePKCE bool `json:"use_pkce" yaml:"use_pkce"`
448449

449450
// OAuth endpoint configuration (from registry)
450-
Issuer string
451-
AuthorizeURL string
452-
TokenURL string
451+
Issuer string `json:"issuer,omitempty" yaml:"issuer,omitempty"`
452+
AuthorizeURL string `json:"authorize_url,omitempty" yaml:"authorize_url,omitempty"`
453+
TokenURL string `json:"token_url,omitempty" yaml:"token_url,omitempty"`
453454

454455
// Headers for HTTP requests
455-
Headers []*registry.Header
456+
Headers []*registry.Header `json:"headers,omitempty" yaml:"headers,omitempty"`
456457

457458
// Environment variables for the client
458-
EnvVars []*registry.EnvVar
459+
EnvVars []*registry.EnvVar `json:"env_vars,omitempty" yaml:"env_vars,omitempty"`
459460

460461
// OAuth parameters for server-specific customization
461-
OAuthParams map[string]string
462+
OAuthParams map[string]string `json:"oauth_params,omitempty" yaml:"oauth_params,omitempty"`
462463
}
463464

464465
// ToolOverride represents a tool override.

0 commit comments

Comments
 (0)