Skip to content

Commit 5673b41

Browse files
feat: Add opt-in record_session flag to managed auth
1 parent c1a9ba4 commit 5673b41

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 112
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-38c6ce8b0ce54e6c62517b9635acaf65369c26cdb1b55eb66290c13a8ab2b33d.yml
3-
openapi_spec_hash: e6f6ed157b1e318d1a1db72fd1d27091
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-64dac369ae935b0318cd611e1735d45359a663eb55cf43fbb8b09e9dd814d7a2.yml
3+
openapi_spec_hash: cc0c6a4e716977df4b9eab5f4658d41b
44
config_hash: 08d55086449943a8fec212b870061a3f

authconnection.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ type ManagedAuth struct {
221221
Domain string `json:"domain" api:"required"`
222222
// Name of the profile associated with this auth connection
223223
ProfileName string `json:"profile_name" api:"required"`
224+
// Whether browser sessions for this connection are recorded by default for
225+
// debugging. Can be overridden per-login.
226+
RecordSession bool `json:"record_session" api:"required"`
224227
// Whether credentials are saved after every successful login. One-time codes
225228
// (TOTP, SMS, etc.) are not saved.
226229
SaveCredentials bool `json:"save_credentials" api:"required"`
@@ -337,6 +340,7 @@ type ManagedAuth struct {
337340
ID respjson.Field
338341
Domain respjson.Field
339342
ProfileName respjson.Field
343+
RecordSession respjson.Field
340344
SaveCredentials respjson.Field
341345
Status respjson.Field
342346
AllowedDomains respjson.Field
@@ -587,6 +591,9 @@ type ManagedAuthCreateRequestParam struct {
587591
HealthCheckInterval param.Opt[int64] `json:"health_check_interval,omitzero"`
588592
// Optional login page URL to skip discovery
589593
LoginURL param.Opt[string] `json:"login_url,omitzero" format:"uri"`
594+
// Whether to record browser sessions for this connection by default. Useful for
595+
// debugging. Can be overridden per-login. Defaults to false.
596+
RecordSession param.Opt[bool] `json:"record_session,omitzero"`
590597
// Whether to save credentials after every successful login. Defaults to true.
591598
// One-time codes (TOTP, SMS, etc.) are not saved.
592599
SaveCredentials param.Opt[bool] `json:"save_credentials,omitzero"`
@@ -677,6 +684,8 @@ type ManagedAuthUpdateRequestParam struct {
677684
HealthCheckInterval param.Opt[int64] `json:"health_check_interval,omitzero"`
678685
// Login page URL. Set to empty string to clear.
679686
LoginURL param.Opt[string] `json:"login_url,omitzero" format:"uri"`
687+
// Whether to record browser sessions for this connection by default
688+
RecordSession param.Opt[bool] `json:"record_session,omitzero"`
680689
// Whether to save credentials after every successful login
681690
SaveCredentials param.Opt[bool] `json:"save_credentials,omitzero"`
682691
// Additional domains valid for this auth flow (replaces existing list)
@@ -1159,6 +1168,9 @@ func (r AuthConnectionListParams) URLQuery() (v url.Values, err error) {
11591168
}
11601169

11611170
type AuthConnectionLoginParams struct {
1171+
// Override the connection's default for recording this login's browser session.
1172+
// When omitted, the connection's record_session default is used.
1173+
RecordSession param.Opt[bool] `json:"record_session,omitzero"`
11621174
// Proxy selection. Provide either id or name. The proxy must belong to the
11631175
// caller's org.
11641176
Proxy AuthConnectionLoginParamsProxy `json:"proxy,omitzero"`

authconnection_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func TestAuthConnectionNewWithOptionalParams(t *testing.T) {
4343
ID: kernel.String("id"),
4444
Name: kernel.String("name"),
4545
},
46+
RecordSession: kernel.Bool(false),
4647
SaveCredentials: kernel.Bool(true),
4748
},
4849
})
@@ -109,6 +110,7 @@ func TestAuthConnectionUpdateWithOptionalParams(t *testing.T) {
109110
ID: kernel.String("id"),
110111
Name: kernel.String("name"),
111112
},
113+
RecordSession: kernel.Bool(false),
112114
SaveCredentials: kernel.Bool(true),
113115
},
114116
},
@@ -194,6 +196,7 @@ func TestAuthConnectionLoginWithOptionalParams(t *testing.T) {
194196
ID: kernel.String("id"),
195197
Name: kernel.String("name"),
196198
},
199+
RecordSession: kernel.Bool(true),
197200
},
198201
)
199202
if err != nil {

0 commit comments

Comments
 (0)