Skip to content

Commit 23f7623

Browse files
committed
- Added MFA_AS_SERVICE as Application SignOn mode for the list_applications() operation.
- Added generic solution to the model_generic.mustache and generated SDK for the issue of deserialization of application.
1 parent 1979f9d commit 23f7623

33 files changed

Lines changed: 473 additions & 3 deletions

docs/ApplicationSignOnMode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ApplicationSignOnMode
22

3-
Authentication mode for the app | signOnMode | Description | | ---------- | ----------- | | AUTO_LOGIN | Secure Web Authentication (SWA) | | BASIC_AUTH | HTTP Basic Authentication with Okta Browser Plugin | | BOOKMARK | Just a bookmark (no-authentication) | | BROWSER_PLUGIN | Secure Web Authentication (SWA) with Okta Browser Plugin | | OPENID_CONNECT | Federated Authentication with OpenID Connect (OIDC) | | SAML_1_1 | Federated Authentication with SAML 1.1 WebSSO (not supported for custom apps) | | SAML_2_0 | Federated Authentication with SAML 2.0 WebSSO | | SECURE_PASSWORD_STORE | Secure Web Authentication (SWA) with POST (plugin not required) | | WS_FEDERATION | Federated Authentication with WS-Federation Passive Requestor Profile | Select the `signOnMode` for your custom app:
3+
Authentication mode for the app | signOnMode | Description | | ---------- | ----------- | | AUTO_LOGIN | Secure Web Authentication (SWA) | | BASIC_AUTH | HTTP Basic Authentication with Okta Browser Plugin | | BOOKMARK | Just a bookmark (no-authentication) | | BROWSER_PLUGIN | Secure Web Authentication (SWA) with Okta Browser Plugin | | OPENID_CONNECT | Federated Authentication with OpenID Connect (OIDC) | | SAML_1_1 | Federated Authentication with SAML 1.1 WebSSO (not supported for custom apps) | | SAML_2_0 | Federated Authentication with SAML 2.0 WebSSO | | SECURE_PASSWORD_STORE | Secure Web Authentication (SWA) with POST (plugin not required) | | WS_FEDERATION | Federated Authentication with WS-Federation Passive Requestor Profile | | MFA_AS_SERVICE | Application to use Okta's MFA as a service for RDP | Select the `signOnMode` for your custom app:
44

55
## Properties
66

okta/models/action_provider.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[Union[WorkflowActionProvider
115115
# Import from okta.models to ensure class identity consistency with lazy imports
116116
models = import_module("okta.models")
117117
if object_type == "WorkflowActionProvider":
118+
# Check if the discriminator maps to the same class to avoid infinite recursion
119+
if object_type == cls.__name__:
120+
return cls.model_validate(obj)
118121
return models.WorkflowActionProvider.from_dict(obj)
119122

120123
raise ValueError(

okta/models/app_config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ def from_dict(
110110
# Import from okta.models to ensure class identity consistency with lazy imports
111111
models = import_module("okta.models")
112112
if object_type == "AppConfigActiveDirectory":
113+
# Check if the discriminator maps to the same class to avoid infinite recursion
114+
if object_type == cls.__name__:
115+
return cls.model_validate(obj)
113116
return models.AppConfigActiveDirectory.from_dict(obj)
114117

115118
raise ValueError(

okta/models/application.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
from okta.models.basic_auth_application import BasicAuthApplication
5151
from okta.models.bookmark_application import BookmarkApplication
5252
from okta.models.browser_plugin_application import BrowserPluginApplication
53+
from okta.models.application import Application
5354
from okta.models.open_id_connect_application import OpenIdConnectApplication
5455
from okta.models.saml11_application import Saml11Application
5556
from okta.models.saml_application import SamlApplication
@@ -59,7 +60,7 @@
5960
from okta.models.ws_federation_application import WsFederationApplication
6061

6162

62-
class Application(BaseModel):
63+
class Application(BaseModel): # noqa: F811
6364
"""
6465
Application
6566
""" # noqa: E501
@@ -209,6 +210,7 @@ def features_validate_enum(cls, value):
209210
"BASIC_AUTH": "BasicAuthApplication",
210211
"BOOKMARK": "BookmarkApplication",
211212
"BROWSER_PLUGIN": "BrowserPluginApplication",
213+
"MFA_AS_SERVICE": "Application",
212214
"OPENID_CONNECT": "OpenIdConnectApplication",
213215
"SAML_1_1": "Saml11Application",
214216
"SAML_2_0": "SamlApplication",
@@ -241,6 +243,7 @@ def from_json(cls, json_str: str) -> Optional[
241243
BasicAuthApplication,
242244
BookmarkApplication,
243245
BrowserPluginApplication,
246+
Application,
244247
OpenIdConnectApplication,
245248
Saml11Application,
246249
SamlApplication,
@@ -339,6 +342,7 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[
339342
BasicAuthApplication,
340343
BookmarkApplication,
341344
BrowserPluginApplication,
345+
Application,
342346
OpenIdConnectApplication,
343347
Saml11Application,
344348
SamlApplication,
@@ -352,22 +356,54 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[
352356
# Import from okta.models to ensure class identity consistency with lazy imports
353357
models = import_module("okta.models")
354358
if object_type == "AutoLoginApplication":
359+
# Check if the discriminator maps to the same class to avoid infinite recursion
360+
if object_type == cls.__name__:
361+
return cls.model_validate(obj)
355362
return models.AutoLoginApplication.from_dict(obj)
356363
if object_type == "BasicAuthApplication":
364+
# Check if the discriminator maps to the same class to avoid infinite recursion
365+
if object_type == cls.__name__:
366+
return cls.model_validate(obj)
357367
return models.BasicAuthApplication.from_dict(obj)
358368
if object_type == "BookmarkApplication":
369+
# Check if the discriminator maps to the same class to avoid infinite recursion
370+
if object_type == cls.__name__:
371+
return cls.model_validate(obj)
359372
return models.BookmarkApplication.from_dict(obj)
360373
if object_type == "BrowserPluginApplication":
374+
# Check if the discriminator maps to the same class to avoid infinite recursion
375+
if object_type == cls.__name__:
376+
return cls.model_validate(obj)
361377
return models.BrowserPluginApplication.from_dict(obj)
378+
if object_type == "Application":
379+
# Check if the discriminator maps to the same class to avoid infinite recursion
380+
if object_type == cls.__name__:
381+
return cls.model_validate(obj)
382+
return models.Application.from_dict(obj)
362383
if object_type == "OpenIdConnectApplication":
384+
# Check if the discriminator maps to the same class to avoid infinite recursion
385+
if object_type == cls.__name__:
386+
return cls.model_validate(obj)
363387
return models.OpenIdConnectApplication.from_dict(obj)
364388
if object_type == "Saml11Application":
389+
# Check if the discriminator maps to the same class to avoid infinite recursion
390+
if object_type == cls.__name__:
391+
return cls.model_validate(obj)
365392
return models.Saml11Application.from_dict(obj)
366393
if object_type == "SamlApplication":
394+
# Check if the discriminator maps to the same class to avoid infinite recursion
395+
if object_type == cls.__name__:
396+
return cls.model_validate(obj)
367397
return models.SamlApplication.from_dict(obj)
368398
if object_type == "SecurePasswordStoreApplication":
399+
# Check if the discriminator maps to the same class to avoid infinite recursion
400+
if object_type == cls.__name__:
401+
return cls.model_validate(obj)
369402
return models.SecurePasswordStoreApplication.from_dict(obj)
370403
if object_type == "WsFederationApplication":
404+
# Check if the discriminator maps to the same class to avoid infinite recursion
405+
if object_type == cls.__name__:
406+
return cls.model_validate(obj)
371407
return models.WsFederationApplication.from_dict(obj)
372408

373409
raise ValueError(

okta/models/application_feature.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,14 @@ def from_dict(
143143
# Import from okta.models to ensure class identity consistency with lazy imports
144144
models = import_module("okta.models")
145145
if object_type == "InboundProvisioningApplicationFeature":
146+
# Check if the discriminator maps to the same class to avoid infinite recursion
147+
if object_type == cls.__name__:
148+
return cls.model_validate(obj)
146149
return models.InboundProvisioningApplicationFeature.from_dict(obj)
147150
if object_type == "UserProvisioningApplicationFeature":
151+
# Check if the discriminator maps to the same class to avoid infinite recursion
152+
if object_type == cls.__name__:
153+
return cls.model_validate(obj)
148154
return models.UserProvisioningApplicationFeature.from_dict(obj)
149155

150156
raise ValueError(

okta/models/application_sign_on_mode.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class ApplicationSignOnMode(str, Enum):
3636
Federated Authentication with OpenID Connect (OIDC) | | SAML_1_1 | Federated Authentication with SAML 1.1 WebSSO (not
3737
supported for custom apps) | | SAML_2_0 | Federated Authentication with SAML 2.0 WebSSO | | SECURE_PASSWORD_STORE |
3838
Secure Web Authentication (SWA) with POST (plugin not required) | | WS_FEDERATION | Federated Authentication with
39-
WS-Federation Passive Requestor Profile | Select the `signOnMode` for your custom app:
39+
WS-Federation Passive Requestor Profile | | MFA_AS_SERVICE | Application to use Okta's MFA as a service for RDP |
40+
Select the `signOnMode` for your custom app:
4041
"""
4142

4243
"""
@@ -51,6 +52,7 @@ class ApplicationSignOnMode(str, Enum):
5152
SAML_2_0 = "SAML_2_0"
5253
SECURE_PASSWORD_STORE = "SECURE_PASSWORD_STORE"
5354
WS_FEDERATION = "WS_FEDERATION"
55+
MFA_AS_SERVICE = "MFA_AS_SERVICE"
5456

5557
@classmethod
5658
def from_json(cls, json_str: str) -> Self:

okta/models/authenticator_base.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,38 +230,89 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[
230230
# Import from okta.models to ensure class identity consistency with lazy imports
231231
models = import_module("okta.models")
232232
if object_type == "AuthenticatorKeyCustomApp":
233+
# Check if the discriminator maps to the same class to avoid infinite recursion
234+
if object_type == cls.__name__:
235+
return cls.model_validate(obj)
233236
return models.AuthenticatorKeyCustomApp.from_dict(obj)
234237
if object_type == "AuthenticatorKeyDuo":
238+
# Check if the discriminator maps to the same class to avoid infinite recursion
239+
if object_type == cls.__name__:
240+
return cls.model_validate(obj)
235241
return models.AuthenticatorKeyDuo.from_dict(obj)
236242
if object_type == "AuthenticatorKeyExternalIdp":
243+
# Check if the discriminator maps to the same class to avoid infinite recursion
244+
if object_type == cls.__name__:
245+
return cls.model_validate(obj)
237246
return models.AuthenticatorKeyExternalIdp.from_dict(obj)
238247
if object_type == "AuthenticatorKeyGoogleOtp":
248+
# Check if the discriminator maps to the same class to avoid infinite recursion
249+
if object_type == cls.__name__:
250+
return cls.model_validate(obj)
239251
return models.AuthenticatorKeyGoogleOtp.from_dict(obj)
240252
if object_type == "AuthenticatorKeyEmail":
253+
# Check if the discriminator maps to the same class to avoid infinite recursion
254+
if object_type == cls.__name__:
255+
return cls.model_validate(obj)
241256
return models.AuthenticatorKeyEmail.from_dict(obj)
242257
if object_type == "AuthenticatorKeyPassword":
258+
# Check if the discriminator maps to the same class to avoid infinite recursion
259+
if object_type == cls.__name__:
260+
return cls.model_validate(obj)
243261
return models.AuthenticatorKeyPassword.from_dict(obj)
244262
if object_type == "AuthenticatorKeyOktaVerify":
263+
# Check if the discriminator maps to the same class to avoid infinite recursion
264+
if object_type == cls.__name__:
265+
return cls.model_validate(obj)
245266
return models.AuthenticatorKeyOktaVerify.from_dict(obj)
246267
if object_type == "AuthenticatorKeyOnprem":
268+
# Check if the discriminator maps to the same class to avoid infinite recursion
269+
if object_type == cls.__name__:
270+
return cls.model_validate(obj)
247271
return models.AuthenticatorKeyOnprem.from_dict(obj)
248272
if object_type == "AuthenticatorKeyPhone":
273+
# Check if the discriminator maps to the same class to avoid infinite recursion
274+
if object_type == cls.__name__:
275+
return cls.model_validate(obj)
249276
return models.AuthenticatorKeyPhone.from_dict(obj)
250277
if object_type == "AuthenticatorKeySecurityKey":
278+
# Check if the discriminator maps to the same class to avoid infinite recursion
279+
if object_type == cls.__name__:
280+
return cls.model_validate(obj)
251281
return models.AuthenticatorKeySecurityKey.from_dict(obj)
252282
if object_type == "AuthenticatorKeySecurityQuestion":
283+
# Check if the discriminator maps to the same class to avoid infinite recursion
284+
if object_type == cls.__name__:
285+
return cls.model_validate(obj)
253286
return models.AuthenticatorKeySecurityQuestion.from_dict(obj)
254287
if object_type == "AuthenticatorKeySmartCard":
288+
# Check if the discriminator maps to the same class to avoid infinite recursion
289+
if object_type == cls.__name__:
290+
return cls.model_validate(obj)
255291
return models.AuthenticatorKeySmartCard.from_dict(obj)
256292
if object_type == "AuthenticatorKeySymantecVip":
293+
# Check if the discriminator maps to the same class to avoid infinite recursion
294+
if object_type == cls.__name__:
295+
return cls.model_validate(obj)
257296
return models.AuthenticatorKeySymantecVip.from_dict(obj)
258297
if object_type == "AuthenticatorKeyTac":
298+
# Check if the discriminator maps to the same class to avoid infinite recursion
299+
if object_type == cls.__name__:
300+
return cls.model_validate(obj)
259301
return models.AuthenticatorKeyTac.from_dict(obj)
260302
if object_type == "AuthenticatorKeyWebauthn":
303+
# Check if the discriminator maps to the same class to avoid infinite recursion
304+
if object_type == cls.__name__:
305+
return cls.model_validate(obj)
261306
return models.AuthenticatorKeyWebauthn.from_dict(obj)
262307
if object_type == "AuthenticatorKeyYubikey":
308+
# Check if the discriminator maps to the same class to avoid infinite recursion
309+
if object_type == cls.__name__:
310+
return cls.model_validate(obj)
263311
return models.AuthenticatorKeyYubikey.from_dict(obj)
264312
if object_type == "AuthenticatorSimple":
313+
# Check if the discriminator maps to the same class to avoid infinite recursion
314+
if object_type == cls.__name__:
315+
return cls.model_validate(obj)
265316
return models.AuthenticatorSimple.from_dict(obj)
266317

267318
raise ValueError(

okta/models/authenticator_method_base.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,32 +179,74 @@ def from_dict(cls, obj: Dict[str, Any]) -> Optional[
179179
# Import from okta.models to ensure class identity consistency with lazy imports
180180
models = import_module("okta.models")
181181
if object_type == "AuthenticatorMethodWithVerifiableProperties":
182+
# Check if the discriminator maps to the same class to avoid infinite recursion
183+
if object_type == cls.__name__:
184+
return cls.model_validate(obj)
182185
return models.AuthenticatorMethodWithVerifiableProperties.from_dict(obj)
183186
if object_type == "AuthenticatorMethodWithVerifiableProperties":
187+
# Check if the discriminator maps to the same class to avoid infinite recursion
188+
if object_type == cls.__name__:
189+
return cls.model_validate(obj)
184190
return models.AuthenticatorMethodWithVerifiableProperties.from_dict(obj)
185191
if object_type == "AuthenticatorMethodSimple":
192+
# Check if the discriminator maps to the same class to avoid infinite recursion
193+
if object_type == cls.__name__:
194+
return cls.model_validate(obj)
186195
return models.AuthenticatorMethodSimple.from_dict(obj)
187196
if object_type == "AuthenticatorMethodWithVerifiableProperties":
197+
# Check if the discriminator maps to the same class to avoid infinite recursion
198+
if object_type == cls.__name__:
199+
return cls.model_validate(obj)
188200
return models.AuthenticatorMethodWithVerifiableProperties.from_dict(obj)
189201
if object_type == "AuthenticatorMethodOtp":
202+
# Check if the discriminator maps to the same class to avoid infinite recursion
203+
if object_type == cls.__name__:
204+
return cls.model_validate(obj)
190205
return models.AuthenticatorMethodOtp.from_dict(obj)
191206
if object_type == "AuthenticatorMethodSimple":
207+
# Check if the discriminator maps to the same class to avoid infinite recursion
208+
if object_type == cls.__name__:
209+
return cls.model_validate(obj)
192210
return models.AuthenticatorMethodSimple.from_dict(obj)
193211
if object_type == "AuthenticatorMethodPush":
212+
# Check if the discriminator maps to the same class to avoid infinite recursion
213+
if object_type == cls.__name__:
214+
return cls.model_validate(obj)
194215
return models.AuthenticatorMethodPush.from_dict(obj)
195216
if object_type == "AuthenticatorMethodSimple":
217+
# Check if the discriminator maps to the same class to avoid infinite recursion
218+
if object_type == cls.__name__:
219+
return cls.model_validate(obj)
196220
return models.AuthenticatorMethodSimple.from_dict(obj)
197221
if object_type == "AuthenticatorMethodSignedNonce":
222+
# Check if the discriminator maps to the same class to avoid infinite recursion
223+
if object_type == cls.__name__:
224+
return cls.model_validate(obj)
198225
return models.AuthenticatorMethodSignedNonce.from_dict(obj)
199226
if object_type == "AuthenticatorMethodSimple":
227+
# Check if the discriminator maps to the same class to avoid infinite recursion
228+
if object_type == cls.__name__:
229+
return cls.model_validate(obj)
200230
return models.AuthenticatorMethodSimple.from_dict(obj)
201231
if object_type == "AuthenticatorMethodTac":
232+
# Check if the discriminator maps to the same class to avoid infinite recursion
233+
if object_type == cls.__name__:
234+
return cls.model_validate(obj)
202235
return models.AuthenticatorMethodTac.from_dict(obj)
203236
if object_type == "AuthenticatorMethodTotp":
237+
# Check if the discriminator maps to the same class to avoid infinite recursion
238+
if object_type == cls.__name__:
239+
return cls.model_validate(obj)
204240
return models.AuthenticatorMethodTotp.from_dict(obj)
205241
if object_type == "AuthenticatorMethodSimple":
242+
# Check if the discriminator maps to the same class to avoid infinite recursion
243+
if object_type == cls.__name__:
244+
return cls.model_validate(obj)
206245
return models.AuthenticatorMethodSimple.from_dict(obj)
207246
if object_type == "AuthenticatorMethodWebAuthn":
247+
# Check if the discriminator maps to the same class to avoid infinite recursion
248+
if object_type == cls.__name__:
249+
return cls.model_validate(obj)
208250
return models.AuthenticatorMethodWebAuthn.from_dict(obj)
209251

210252
raise ValueError(

0 commit comments

Comments
 (0)