Skip to content

Commit 5f76a44

Browse files
Merge pull request #441 from okta/OKTA-733531
"Okta direct auth API grants" are not valid OAuthGrantType
2 parents eac5d23 + 3c582d5 commit 5f76a44

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

okta/models/o_auth_grant_type.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ class OAuthGrantType(
3838
DEVICE_CODE = "urn:ietf:params:oauth:grant-type:device_code", "URN:IETF:PARAMS:OAUTH:GRANT-TYPE:DEVICE_CODE"
3939
TOKEN_EXCHANGE = "urn:ietf:params:oauth:grant-type:token-exchange", "URN:IETF:PARAMS:OAUTH:GRANT-TYPE:TOKEN-EXCHANGE"
4040
INTERACTION_CODE = "interaction_code", "INTERACTION_CODE"
41+
OTP = "urn:okta:params:oauth:grant-type:otp", "URN:OKTA:PARAMS:OAUTH:GRANT-TYPE:OTP"
42+
OOB = "urn:okta:params:oauth:grant-type:oob", "URN:OKTA:PARAMS:OAUTH:GRANT-TYPE:OOB"
43+
MFA_OTP = "http://auth0.com/oauth/grant-type/mfa-otp", "HTTP://AUTH0.COM/OAUTH/GRANT-TYPE/MFA-OTP"
44+
MFA_OOB = "http://auth0.com/oauth/grant-type/mfa-oob", "HTTP://AUTH0.COM/OAUTH/GRANT-TYPE/MFA-OOB"

tests/unit/test_applications_ut.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ async def mock_response_text():
4545
}
4646
)
4747
provisioning_conn_req = models.ProvisioningConnectionRequest({'profile': profile})
48-
_ = await client.set_default_provisioning_connection_for_application('test_app_id', provisioning_conn_req, query_params={'activate': True})
48+
_ = await client.set_default_provisioning_connection_for_application('test_app_id', provisioning_conn_req,
49+
query_params={'activate': True})
4950
assert mock_http_request.request_info['url'].endswith('/apps/test_app_id/connections/default/?activate=True')
5051
data = mock_http_request.request_info['data']
5152
assert json.loads(data) == {"profile": {"authScheme": "TOKEN", "token": "TEST"}}
@@ -133,6 +134,7 @@ async def mock_response_text():
133134
assert isinstance(features[0].capabilities.update.password.change, models.ChangeEnum)
134135
assert isinstance(features[0].status, models.EnabledStatus)
135136

137+
136138
@pytest.mark.asyncio
137139
async def test_get_feature_for_application(monkeypatch, mocker):
138140
mocked_response = """{
@@ -256,10 +258,10 @@ async def mock_response_text():
256258
"lifecycleDeactivate": {
257259
"status": "ENABLED"
258260
},
259-
"profile":{
261+
"profile": {
260262
"status": "ENABLED"
261263
},
262-
"password":{
264+
"password": {
263265
"status": "ENABLED",
264266
"seed": "RANDOM",
265267
"change": "CHANGE"
@@ -313,3 +315,20 @@ async def mock_response_text():
313315
assert mock_http_request.request_info['url'].endswith('/apps/test_app_id/logo')
314316
data = mock_http_request.request_info['data']
315317
assert data == {'file': logo}
318+
319+
class TestOAuthGrantType:
320+
"""
321+
Unit Tests for the OAuthGrantType Enum
322+
"""
323+
324+
def test_new_enum_types(self):
325+
# List of new ENUM types to be tested
326+
new_enum_types = [
327+
"urn:okta:params:oauth:grant-type:otp",
328+
"urn:okta:params:oauth:grant-type:oob",
329+
"http://auth0.com/oauth/grant-type/mfa-otp",
330+
"http://auth0.com/oauth/grant-type/mfa-oob"
331+
]
332+
333+
for enum_type in new_enum_types:
334+
assert enum_type in models.OAuthGrantType.__members__.values()

0 commit comments

Comments
 (0)