stytch 5.0.2 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # !!!
4
+ # WARNING: This file is autogenerated
5
+ # Only modify code within MANUAL() sections
6
+ # or your changes may be overwritten later!
7
+ # !!!
8
+
3
9
  require_relative 'request_helper'
4
10
 
5
11
  module StytchB2B
@@ -10,6 +16,27 @@ module StytchB2B
10
16
  @connection = connection
11
17
  end
12
18
 
19
+ # Retrieves all active Sessions for a Member.
20
+ #
21
+ # == Parameters:
22
+ # organization_id::
23
+ # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
24
+ # The type of this field is +String+.
25
+ # member_id::
26
+ # Globally unique UUID that identifies a specific Member. The `member_id` is critical to perform operations on a Member, so be sure to preserve this value.
27
+ # The type of this field is +String+.
28
+ #
29
+ # == Returns:
30
+ # An object with the following fields:
31
+ # request_id::
32
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
33
+ # The type of this field is +String+.
34
+ # member_sessions::
35
+ # An array of [Session objects](https://stytch.com/docs/b2b/api/session-object).
36
+ # The type of this field is list of +MemberSession+ (+object+).
37
+ # status_code::
38
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
39
+ # The type of this field is +Integer+.
13
40
  def get(
14
41
  organization_id:,
15
42
  member_id:
@@ -22,13 +49,67 @@ module StytchB2B
22
49
  get_request(request)
23
50
  end
24
51
 
52
+ # Authenticates a Session and updates its lifetime by the specified `session_duration_minutes`. If the `session_duration_minutes` is not specified, a Session will not be extended. This endpoint requires either a `session_jwt` or `session_token` be included in the request. It will return an error if both are present.
53
+ #
54
+ # You may provide a JWT that needs to be refreshed and is expired according to its `exp` claim. A new JWT will be returned if both the signature and the underlying Session are still valid.
55
+ #
56
+ # == Parameters:
57
+ # session_token::
58
+ # A secret token for a given Stytch Session.
59
+ # The type of this field is nilable +String+.
60
+ # session_duration_minutes::
61
+ # Set the session lifetime to be this many minutes from now. This will start a new session if one doesn't already exist,
62
+ # returning both an opaque `session_token` and `session_jwt` for this session. Remember that the `session_jwt` will have a fixed lifetime of
63
+ # five minutes regardless of the underlying session duration, and will need to be refreshed over time.
64
+ #
65
+ # This value must be a minimum of 5 and a maximum of 527040 minutes (366 days).
66
+ #
67
+ # If a `session_token` or `session_jwt` is provided then a successful authentication will continue to extend the session this many minutes.
68
+ #
69
+ # If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration. If you don't want
70
+ # to use the Stytch session product, you can ignore the session fields in the response.
71
+ # The type of this field is nilable +Integer+.
72
+ # session_jwt::
73
+ # The JSON Web Token (JWT) for a given Stytch Session.
74
+ # The type of this field is nilable +String+.
75
+ # session_custom_claims::
76
+ # Add a custom claims map to the Session being authenticated. Claims are only created if a Session is initialized by providing a value in
77
+ # `session_duration_minutes`. Claims will be included on the Session object and in the JWT. To update a key in an existing Session, supply a new value. To
78
+ # delete a key, supply a null value. Custom claims made with reserved claims (`iss`, `sub`, `aud`, `exp`, `nbf`, `iat`, `jti`) will be ignored.
79
+ # Total custom claims size cannot exceed four kilobytes.
80
+ # The type of this field is nilable +object+.
81
+ #
82
+ # == Returns:
83
+ # An object with the following fields:
84
+ # request_id::
85
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
86
+ # The type of this field is +String+.
87
+ # member_session::
88
+ # The [Session object](https://stytch.com/docs/b2b/api/session-object).
89
+ # The type of this field is +MemberSession+ (+object+).
90
+ # session_token::
91
+ # A secret token for a given Stytch Session.
92
+ # The type of this field is +String+.
93
+ # session_jwt::
94
+ # The JSON Web Token (JWT) for a given Stytch Session.
95
+ # The type of this field is +String+.
96
+ # member::
97
+ # The [Member object](https://stytch.com/docs/b2b/api/member-object).
98
+ # The type of this field is +Member+ (+object+).
99
+ # organization::
100
+ # The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
101
+ # The type of this field is +Organization+ (+object+).
102
+ # status_code::
103
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
104
+ # The type of this field is +Integer+.
25
105
  def authenticate(
26
106
  session_token: nil,
27
107
  session_duration_minutes: nil,
28
108
  session_jwt: nil,
29
109
  session_custom_claims: nil
30
110
  )
31
- request = {}
111
+ request = {
112
+ }
32
113
  request[:session_token] = session_token unless session_token.nil?
33
114
  request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
34
115
  request[:session_jwt] = session_jwt unless session_jwt.nil?
@@ -37,13 +118,38 @@ module StytchB2B
37
118
  post_request('/v1/b2b/sessions/authenticate', request)
38
119
  end
39
120
 
121
+ # Revoke a Session and immediately invalidate all its tokens. To revoke a specific Session, pass either the `member_session_id`, `session_token`, or `session_jwt`. To revoke all Sessions for a Member, pass the `member_id`.
122
+ #
123
+ # == Parameters:
124
+ # member_session_id::
125
+ # Globally unique UUID that identifies a specific Session in the Stytch API. The `member_session_id` is critical to perform operations on an Session, so be sure to preserve this value.
126
+ # The type of this field is nilable +String+.
127
+ # session_token::
128
+ # A secret token for a given Stytch Session.
129
+ # The type of this field is nilable +String+.
130
+ # session_jwt::
131
+ # The JSON Web Token (JWT) for a given Stytch Session.
132
+ # The type of this field is nilable +String+.
133
+ # member_id::
134
+ # Globally unique UUID that identifies a specific Member. The `member_id` is critical to perform operations on a Member, so be sure to preserve this value.
135
+ # The type of this field is nilable +String+.
136
+ #
137
+ # == Returns:
138
+ # An object with the following fields:
139
+ # request_id::
140
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
141
+ # The type of this field is +String+.
142
+ # status_code::
143
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
144
+ # The type of this field is +Integer+.
40
145
  def revoke(
41
146
  member_session_id: nil,
42
147
  session_token: nil,
43
148
  session_jwt: nil,
44
149
  member_id: nil
45
150
  )
46
- request = {}
151
+ request = {
152
+ }
47
153
  request[:member_session_id] = member_session_id unless member_session_id.nil?
48
154
  request[:session_token] = session_token unless session_token.nil?
49
155
  request[:session_jwt] = session_jwt unless session_jwt.nil?
@@ -52,12 +158,75 @@ module StytchB2B
52
158
  post_request('/v1/b2b/sessions/revoke', request)
53
159
  end
54
160
 
161
+ # Use this endpoint to exchange a Member's existing session for another session in a different Organization. This can be used to accept an invite, but not to create a new member via domain matching.
162
+ #
163
+ # To create a new member via domain matching, use the [Exchange Intermediate Session](https://stytch.com/docs/b2b/api/exchange-intermediate-session) flow instead.
164
+ #
165
+ # == Parameters:
166
+ # organization_id::
167
+ # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
168
+ # The type of this field is +String+.
169
+ # session_token::
170
+ # The `session_token` belonging to the member that you wish to associate the email with.
171
+ # The type of this field is nilable +String+.
172
+ # session_jwt::
173
+ # The `session_jwt` belonging to the member that you wish to associate the email with.
174
+ # The type of this field is nilable +String+.
175
+ # session_duration_minutes::
176
+ # Set the session lifetime to be this many minutes from now. This will start a new session if one doesn't already exist,
177
+ # returning both an opaque `session_token` and `session_jwt` for this session. Remember that the `session_jwt` will have a fixed lifetime of
178
+ # five minutes regardless of the underlying session duration, and will need to be refreshed over time.
179
+ #
180
+ # This value must be a minimum of 5 and a maximum of 527040 minutes (366 days).
181
+ #
182
+ # If a `session_token` or `session_jwt` is provided then a successful authentication will continue to extend the session this many minutes.
183
+ #
184
+ # If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration. If you don't want
185
+ # to use the Stytch session product, you can ignore the session fields in the response.
186
+ # The type of this field is nilable +Integer+.
187
+ # session_custom_claims::
188
+ # Add a custom claims map to the Session being authenticated. Claims are only created if a Session is initialized by providing a value in
189
+ # `session_duration_minutes`. Claims will be included on the Session object and in the JWT. To update a key in an existing Session, supply a new value. To
190
+ # delete a key, supply a null value. Custom claims made with reserved claims (`iss`, `sub`, `aud`, `exp`, `nbf`, `iat`, `jti`) will be ignored.
191
+ # Total custom claims size cannot exceed four kilobytes.
192
+ # The type of this field is nilable +object+.
193
+ # locale::
194
+ # (no documentation yet)
195
+ # The type of this field is nilable +ExchangeRequestLocale+ (string enum).
196
+ #
197
+ # == Returns:
198
+ # An object with the following fields:
199
+ # request_id::
200
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
201
+ # The type of this field is +String+.
202
+ # member_id::
203
+ # Globally unique UUID that identifies a specific Member.
204
+ # The type of this field is +String+.
205
+ # member_session::
206
+ # The [Session object](https://stytch.com/docs/b2b/api/session-object).
207
+ # The type of this field is +MemberSession+ (+object+).
208
+ # session_token::
209
+ # A secret token for a given Stytch Session.
210
+ # The type of this field is +String+.
211
+ # session_jwt::
212
+ # The JSON Web Token (JWT) for a given Stytch Session.
213
+ # The type of this field is +String+.
214
+ # member::
215
+ # The [Member object](https://stytch.com/docs/b2b/api/member-object).
216
+ # The type of this field is +Member+ (+object+).
217
+ # organization::
218
+ # The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
219
+ # The type of this field is +Organization+ (+object+).
220
+ # status_code::
221
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
222
+ # The type of this field is +Integer+.
55
223
  def exchange(
56
224
  organization_id:,
57
225
  session_token: nil,
58
226
  session_jwt: nil,
59
227
  session_duration_minutes: nil,
60
- session_custom_claims: nil
228
+ session_custom_claims: nil,
229
+ locale: nil
61
230
  )
62
231
  request = {
63
232
  organization_id: organization_id
@@ -66,15 +235,33 @@ module StytchB2B
66
235
  request[:session_jwt] = session_jwt unless session_jwt.nil?
67
236
  request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
68
237
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
238
+ request[:locale] = locale unless locale.nil?
69
239
 
70
240
  post_request('/v1/b2b/sessions/exchange', request)
71
241
  end
72
242
 
73
- def jwks(
243
+ # Get the JSON Web Key Set (JWKS) for a project.
244
+ #
245
+ # == Parameters:
246
+ # project_id::
247
+ # The `project_id` to get the JWKS for.
248
+ # The type of this field is +String+.
249
+ #
250
+ # == Returns:
251
+ # An object with the following fields:
252
+ # keys::
253
+ # The JWK
254
+ # The type of this field is list of +JWK+ (+object+).
255
+ # request_id::
256
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
257
+ # The type of this field is +String+.
258
+ # status_code::
259
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
260
+ # The type of this field is +Integer+.
261
+ def get_jwks(
74
262
  project_id:
75
263
  )
76
264
  query_params = {
77
- project_id: project_id
78
265
  }
79
266
  request = request_with_query_params("/v1/b2b/sessions/jwks/#{project_id}", query_params)
80
267
  get_request(request)
@@ -1,5 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # !!!
4
+ # WARNING: This file is autogenerated
5
+ # Only modify code within MANUAL() sections
6
+ # or your changes may be overwritten later!
7
+ # !!!
8
+
3
9
  require_relative 'request_helper'
4
10
 
5
11
  module StytchB2B
@@ -14,14 +20,57 @@ module StytchB2B
14
20
  @saml = StytchB2B::SSO::SAML.new(@connection)
15
21
  end
16
22
 
23
+ # Get all SSO Connections owned by the organization.
24
+ #
25
+ # == Parameters:
26
+ # organization_id::
27
+ # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
28
+ # The type of this field is +String+.
29
+ #
30
+ # == Returns:
31
+ # An object with the following fields:
32
+ # request_id::
33
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
34
+ # The type of this field is +String+.
35
+ # saml_connections::
36
+ # The list of [SAML Connections](https://stytch.com/docs/b2b/api/saml-connection-object) owned by this organization.
37
+ # The type of this field is list of +SAMLConnection+ (+object+).
38
+ # oidc_connections::
39
+ # The list of [OIDC Connections](https://stytch.com/docs/b2b/api/oidc-connection-object) owned by this organization.
40
+ # The type of this field is list of +OIDCConnection+ (+object+).
41
+ # status_code::
42
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
43
+ # The type of this field is +Integer+.
17
44
  def get_connections(
18
45
  organization_id:
19
46
  )
20
- query_params = {}
47
+ query_params = {
48
+ }
21
49
  request = request_with_query_params("/v1/b2b/sso/#{organization_id}", query_params)
22
50
  get_request(request)
23
51
  end
24
52
 
53
+ # Delete an existing SSO connection.
54
+ #
55
+ # == Parameters:
56
+ # organization_id::
57
+ # The organization ID that the SSO connection belongs to.
58
+ # The type of this field is +String+.
59
+ # connection_id::
60
+ # The ID of the SSO connection. Both SAML and OIDC connection IDs can be provided.
61
+ # The type of this field is +String+.
62
+ #
63
+ # == Returns:
64
+ # An object with the following fields:
65
+ # request_id::
66
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
67
+ # The type of this field is +String+.
68
+ # connection_id::
69
+ # The `connection_id` that was deleted as part of the delete request.
70
+ # The type of this field is +String+.
71
+ # status_code::
72
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
73
+ # The type of this field is +Integer+.
25
74
  def delete_connection(
26
75
  organization_id:,
27
76
  connection_id:
@@ -29,13 +78,88 @@ module StytchB2B
29
78
  delete_request("/v1/b2b/sso/#{organization_id}/connections/#{connection_id}")
30
79
  end
31
80
 
81
+ # Authenticate a user given a token.
82
+ # This endpoint verifies that the user completed the SSO Authentication flow by verifying that the token is valid and hasn't expired.
83
+ # Provide the `session_duration_minutes` parameter to set the lifetime of the session.
84
+ # If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration.
85
+ # To link this authentication event to an existing Stytch session, include either the `session_token` or `session_jwt` param.
86
+ #
87
+ # == Parameters:
88
+ # sso_token::
89
+ # The token to authenticate.
90
+ # The type of this field is +String+.
91
+ # pkce_code_verifier::
92
+ # A base64url encoded one time secret used to validate that the request starts and ends on the same device.
93
+ # The type of this field is nilable +String+.
94
+ # session_token::
95
+ # The `session_token` belonging to the member that you wish to associate the email with.
96
+ # The type of this field is nilable +String+.
97
+ # session_jwt::
98
+ # The `session_jwt` belonging to the member that you wish to associate the email with.
99
+ # The type of this field is nilable +String+.
100
+ # session_duration_minutes::
101
+ # Set the session lifetime to be this many minutes from now. This will start a new session if one doesn't already exist,
102
+ # returning both an opaque `session_token` and `session_jwt` for this session. Remember that the `session_jwt` will have a fixed lifetime of
103
+ # five minutes regardless of the underlying session duration, and will need to be refreshed over time.
104
+ #
105
+ # This value must be a minimum of 5 and a maximum of 527040 minutes (366 days).
106
+ #
107
+ # If a `session_token` or `session_jwt` is provided then a successful authentication will continue to extend the session this many minutes.
108
+ #
109
+ # If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration. If you don't want
110
+ # to use the Stytch session product, you can ignore the session fields in the response.
111
+ # The type of this field is nilable +Integer+.
112
+ # session_custom_claims::
113
+ # Add a custom claims map to the Session being authenticated. Claims are only created if a Session is initialized by providing a value in
114
+ # `session_duration_minutes`. Claims will be included on the Session object and in the JWT. To update a key in an existing Session, supply a new value. To
115
+ # delete a key, supply a null value. Custom claims made with reserved claims (`iss`, `sub`, `aud`, `exp`, `nbf`, `iat`, `jti`) will be ignored.
116
+ # Total custom claims size cannot exceed four kilobytes.
117
+ # The type of this field is nilable +object+.
118
+ # locale::
119
+ # (no documentation yet)
120
+ # The type of this field is nilable +AuthenticateRequestLocale+ (string enum).
121
+ #
122
+ # == Returns:
123
+ # An object with the following fields:
124
+ # request_id::
125
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
126
+ # The type of this field is +String+.
127
+ # member_id::
128
+ # Globally unique UUID that identifies a specific Member.
129
+ # The type of this field is +String+.
130
+ # organization_id::
131
+ # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
132
+ # The type of this field is +String+.
133
+ # member::
134
+ # The [Member object](https://stytch.com/docs/b2b/api/member-object).
135
+ # The type of this field is +Member+ (+object+).
136
+ # session_token::
137
+ # A secret token for a given Stytch Session.
138
+ # The type of this field is +String+.
139
+ # session_jwt::
140
+ # The JSON Web Token (JWT) for a given Stytch Session.
141
+ # The type of this field is +String+.
142
+ # reset_session::
143
+ # Indicates if all Sessions linked to the Member need to be reset. You should check this field if you aren't using
144
+ # Stytch's Session product. If you are using Stytch's Session product, we revoke the Member’s other Sessions for you.
145
+ # The type of this field is +Boolean+.
146
+ # organization::
147
+ # The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
148
+ # The type of this field is +Organization+ (+object+).
149
+ # status_code::
150
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
151
+ # The type of this field is +Integer+.
152
+ # member_session::
153
+ # The [Session object](https://stytch.com/docs/b2b/api/session-object).
154
+ # The type of this field is nilable +MemberSession+ (+object+).
32
155
  def authenticate(
33
156
  sso_token:,
34
157
  pkce_code_verifier: nil,
35
158
  session_token: nil,
36
159
  session_jwt: nil,
37
160
  session_duration_minutes: nil,
38
- session_custom_claims: nil
161
+ session_custom_claims: nil,
162
+ locale: nil
39
163
  )
40
164
  request = {
41
165
  sso_token: sso_token
@@ -45,6 +169,7 @@ module StytchB2B
45
169
  request[:session_jwt] = session_jwt unless session_jwt.nil?
46
170
  request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
47
171
  request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
172
+ request[:locale] = locale unless locale.nil?
48
173
 
49
174
  post_request('/v1/b2b/sso/authenticate', request)
50
175
  end
@@ -56,18 +181,103 @@ module StytchB2B
56
181
  @connection = connection
57
182
  end
58
183
 
184
+ # Create a new OIDC Connection.
185
+ #
186
+ # == Parameters:
187
+ # organization_id::
188
+ # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
189
+ # The type of this field is +String+.
190
+ # display_name::
191
+ # A human-readable display name for the connection.
192
+ # The type of this field is nilable +String+.
193
+ #
194
+ # == Returns:
195
+ # An object with the following fields:
196
+ # request_id::
197
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
198
+ # The type of this field is +String+.
199
+ # status_code::
200
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
201
+ # The type of this field is +Integer+.
202
+ # connection::
203
+ # The `OIDC Connection` object affected by this API call. See the [OIDC Connection Object](https://stytch.com/docs/b2b/api/oidc-connection-object) for complete response field details.
204
+ # The type of this field is nilable +OIDCConnection+ (+object+).
59
205
  def create_connection(
60
206
  organization_id:,
61
207
  display_name: nil
62
208
  )
63
209
  request = {
64
- organization_id: organization_id
65
210
  }
66
211
  request[:display_name] = display_name unless display_name.nil?
67
212
 
68
213
  post_request("/v1/b2b/sso/oidc/#{organization_id}", request)
69
214
  end
70
215
 
216
+ # Updates an existing OIDC connection.
217
+ #
218
+ # When the value of `issuer` changes, Stytch will attempt to retrieve the [OpenID Provider Metadata](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata) document found at `$/.well-known/openid-configuration`.
219
+ # If the metadata document can be retrieved successfully, Stytch will use it to infer the values of `authorization_url`, `token_url`, `jwks_url`, and `userinfo_url`.
220
+ # The `client_id` and `client_secret` values cannot be inferred from the metadata document, and *must* be passed in explicitly.
221
+ #
222
+ # If the metadata document cannot be retrieved, Stytch will still update the connection using values from the request body.
223
+ #
224
+ # If the metadata document can be retrieved, and values are passed in the request body, the explicit values passed in from the request body will take precedence over the values inferred from the metadata document.
225
+ #
226
+ # Note that a newly created connection will not become active until all of the following fields are provided:
227
+ # * `issuer`
228
+ # * `client_id`
229
+ # * `client_secret`
230
+ # * `authorization_url`
231
+ # * `token_url`
232
+ # * `userinfo_url`
233
+ # * `jwks_url`
234
+ #
235
+ # == Parameters:
236
+ # organization_id::
237
+ # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
238
+ # The type of this field is +String+.
239
+ # connection_id::
240
+ # Globally unique UUID that identifies a specific SSO `connection_id` for a Member.
241
+ # The type of this field is +String+.
242
+ # display_name::
243
+ # A human-readable display name for the connection.
244
+ # The type of this field is nilable +String+.
245
+ # client_id::
246
+ # The OAuth2.0 client ID used to authenticate login attempts. This will be provided by the IdP.
247
+ # The type of this field is nilable +String+.
248
+ # client_secret::
249
+ # The secret belonging to the OAuth2.0 client used to authenticate login attempts. This will be provided by the IdP.
250
+ # The type of this field is nilable +String+.
251
+ # issuer::
252
+ # A case-sensitive `https://` URL that uniquely identifies the IdP. This will be provided by the IdP.
253
+ # The type of this field is nilable +String+.
254
+ # authorization_url::
255
+ # The location of the URL that starts an OAuth login at the IdP. This will be provided by the IdP.
256
+ # The type of this field is nilable +String+.
257
+ # token_url::
258
+ # The location of the URL that issues OAuth2.0 access tokens and OIDC ID tokens. This will be provided by the IdP.
259
+ # The type of this field is nilable +String+.
260
+ # userinfo_url::
261
+ # The location of the IDP's [UserInfo Endpoint](https://openid.net/specs/openid-connect-core-1_0.html#UserInfo). This will be provided by the IdP.
262
+ # The type of this field is nilable +String+.
263
+ # jwks_url::
264
+ # The location of the IdP's JSON Web Key Set, used to verify credentials issued by the IdP. This will be provided by the IdP.
265
+ # The type of this field is nilable +String+.
266
+ #
267
+ # == Returns:
268
+ # An object with the following fields:
269
+ # request_id::
270
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
271
+ # The type of this field is +String+.
272
+ # status_code::
273
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
274
+ # The type of this field is +Integer+.
275
+ # connection::
276
+ # The `OIDC Connection` object affected by this API call. See the [OIDC Connection Object](https://stytch.com/docs/b2b/api/oidc-connection-object) for complete response field details.
277
+ # The type of this field is nilable +OIDCConnection+ (+object+).
278
+ # warning::
279
+ # If it is not possible to resolve the well-known metadata document from the OIDC issuer, this field will explain what went wrong if the request is successful otherwise. In other words, even if the overall request succeeds, there could be relevant warnings related to the connection update.
280
+ # The type of this field is nilable +String+.
71
281
  def update_connection(
72
282
  organization_id:,
73
283
  connection_id:,
@@ -81,8 +291,6 @@ module StytchB2B
81
291
  jwks_url: nil
82
292
  )
83
293
  request = {
84
- organization_id: organization_id,
85
- connection_id: connection_id
86
294
  }
87
295
  request[:display_name] = display_name unless display_name.nil?
88
296
  request[:client_id] = client_id unless client_id.nil?
@@ -104,18 +312,80 @@ module StytchB2B
104
312
  @connection = connection
105
313
  end
106
314
 
315
+ # Create a new SAML Connection.
316
+ #
317
+ # == Parameters:
318
+ # organization_id::
319
+ # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
320
+ # The type of this field is +String+.
321
+ # display_name::
322
+ # A human-readable display name for the connection.
323
+ # The type of this field is nilable +String+.
324
+ #
325
+ # == Returns:
326
+ # An object with the following fields:
327
+ # request_id::
328
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
329
+ # The type of this field is +String+.
330
+ # status_code::
331
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
332
+ # The type of this field is +Integer+.
333
+ # connection::
334
+ # The `SAML Connection` object affected by this API call. See the [SAML Connection Object](https://stytch.com/docs/b2b/api/saml-connection-object) for complete response field details.
335
+ # The type of this field is nilable +SAMLConnection+ (+object+).
107
336
  def create_connection(
108
337
  organization_id:,
109
338
  display_name: nil
110
339
  )
111
340
  request = {
112
- organization_id: organization_id
113
341
  }
114
342
  request[:display_name] = display_name unless display_name.nil?
115
343
 
116
344
  post_request("/v1/b2b/sso/saml/#{organization_id}", request)
117
345
  end
118
346
 
347
+ # Updates an existing SAML connection.
348
+ #
349
+ # Note that a newly created connection will not become active until all of the following are provided:
350
+ # * `idp_sso_url`
351
+ # * `attribute_mapping`
352
+ # * `idp_entity_id`
353
+ # * `x509_certificate`
354
+ #
355
+ # == Parameters:
356
+ # organization_id::
357
+ # Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value.
358
+ # The type of this field is +String+.
359
+ # connection_id::
360
+ # Globally unique UUID that identifies a specific SSO `connection_id` for a Member.
361
+ # The type of this field is +String+.
362
+ # idp_entity_id::
363
+ # A globally unique name for the IdP. This will be provided by the IdP.
364
+ # The type of this field is nilable +String+.
365
+ # display_name::
366
+ # A human-readable display name for the connection.
367
+ # The type of this field is nilable +String+.
368
+ # attribute_mapping::
369
+ # An object that represents the attributes used to identify a Member. This object will map the IdP-defined User attributes to Stytch-specific values. Required attributes: `email` and one of `full_name` or `first_name` and `last_name`.
370
+ # The type of this field is nilable +object+.
371
+ # x509_certificate::
372
+ # A certificate that Stytch will use to verify the sign-in assertion sent by the IdP, in [PEM](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) format. See our [X509 guide](https://stytch.com/docs/b2b/api/saml-certificates) for more info.
373
+ # The type of this field is nilable +String+.
374
+ # idp_sso_url::
375
+ # The URL for which assertions for login requests will be sent. This will be provided by the IdP.
376
+ # The type of this field is nilable +String+.
377
+ #
378
+ # == Returns:
379
+ # An object with the following fields:
380
+ # request_id::
381
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
382
+ # The type of this field is +String+.
383
+ # status_code::
384
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
385
+ # The type of this field is +Integer+.
386
+ # connection::
387
+ # The `SAML Connection` object affected by this API call. See the [SAML Connection Object](https://stytch.com/docs/b2b/api/saml-connection-object) for complete response field details.
388
+ # The type of this field is nilable +SAMLConnection+ (+object+).
119
389
  def update_connection(
120
390
  organization_id:,
121
391
  connection_id:,
@@ -126,8 +396,6 @@ module StytchB2B
126
396
  idp_sso_url: nil
127
397
  )
128
398
  request = {
129
- organization_id: organization_id,
130
- connection_id: connection_id
131
399
  }
132
400
  request[:idp_entity_id] = idp_entity_id unless idp_entity_id.nil?
133
401
  request[:display_name] = display_name unless display_name.nil?
@@ -138,6 +406,32 @@ module StytchB2B
138
406
  put_request("/v1/b2b/sso/saml/#{organization_id}/connections/#{connection_id}", request)
139
407
  end
140
408
 
409
+ # Delete a SAML verification certificate.
410
+ #
411
+ # You may need to do this when rotating certificates from your IdP, since Stytch allows a maximum of 5 certificates per connection. There must always be at least one certificate per active connection.
412
+ #
413
+ # == Parameters:
414
+ # organization_id::
415
+ # The organization ID that the SAML connection belongs to.
416
+ # The type of this field is +String+.
417
+ # connection_id::
418
+ # The ID of the SAML connection.
419
+ # The type of this field is +String+.
420
+ # certificate_id::
421
+ # The ID of the certificate to be deleted.
422
+ # The type of this field is +String+.
423
+ #
424
+ # == Returns:
425
+ # An object with the following fields:
426
+ # request_id::
427
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
428
+ # The type of this field is +String+.
429
+ # certificate_id::
430
+ # The ID of the certificate that was deleted.
431
+ # The type of this field is +String+.
432
+ # status_code::
433
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
434
+ # The type of this field is +Integer+.
141
435
  def delete_verification_certificate(
142
436
  organization_id:,
143
437
  connection_id:,