Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to model generation for MultiValueEnum's #317

Merged
merged 7 commits into from
Dec 1, 2022

Conversation

justinabrokwah-okta
Copy link
Contributor

@justinabrokwah-okta justinabrokwah-okta commented Oct 14, 2022

Problem:
Python SDK does not have the urn:ietf:params:oauth:grant-type:saml2-bearer OAuthGrantType here that the customer cannot create such an OAuth2 Client using the Python SDK.

This PR updates the model generation within model.py.hbs to handle these cases after updates to the openAPI spec here: okta/okta-management-openapi-spec#148

Generated code in OAuthGrantType now looks like this with newly added types:
image

JIRA: OKTA-531005
Intended to Resolve: #298

Especially OAuthGrantType in question
Comment on lines -42 to -43
self.pkce_required = config["pkceRequired"]\
if "pkceRequired" in config else None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removals in this file were done when running yarn build against the spec

Comment on lines +37 to +40
SAML_2_BEARER = "urn:ietf:params:oauth:grant-type:saml2-bearer", "URN:IETF:PARAMS:OAUTH:GRANT-TYPE:SAML2-BEARER"
DEVICE_CODE = "urn:ietf:params:oauth:grant-type:device_code", "URN:IETF:PARAMS:OAUTH:GRANT-TYPE:DEVICE_CODE"
TOKEN_EXCHANGE = "urn:ietf:params:oauth:grant-type:token-exchange", "URN:IETF:PARAMS:OAUTH:GRANT-TYPE:TOKEN-EXCHANGE"
INTERACTION_CODE = "interaction_code", "INTERACTION_CODE"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newly added OAuthGrantTypes

@@ -31,4 +31,3 @@ class OpenIdConnectApplicationIssuerMode(

CUSTOM_URL = "CUSTOM_URL", "custom_url"
ORG_URL = "ORG_URL", "org_url"
DYNAMIC = "DYNAMIC", "dynamic"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed during yarn build

Comment on lines +480 to +496
const URN_GRANT_TYPES = ['device_code', 'saml2_bearer', 'token_exchange'];
const URN_PREFIX = 'urn:ietf:params:oauth:grant-type:';
const URN_SUFFIXES = {
'device_code': 'device_code',
'saml2_bearer': 'saml2-bearer',
'token_exchange': 'token-exchange'
};

// Determines if OAuthGrantType needs prefix
function isUrnGrantType(grantType) {
return URN_GRANT_TYPES.includes(grantType);
}

// Prefixes openAPI spec enum with OAuthGrantType urn prefix
function prefixUrnGrantType(grantType) {
return URN_PREFIX + URN_SUFFIXES[grantType];
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helper functions used to determine if a grant type needs the urn prefix (urn:ietf:params:oauth:grant-type:) and if so, to prefix it onto the actual enum value

version "2.11.1"
resolved "https://registry.yarnpkg.com/@okta/openapi/-/openapi-2.11.1.tgz#49e9738fbd68520b7a2deaf74d63f67e41a3e924"
integrity sha512-FdDTwscwULg94nGFAhlncLpKr+46nfkjWe2npe9+Th8xaMcnRYtymsUMI8wXNMrOxOJ9+lxTplnfJVl1n4i/Cw==
"@apidevtools/[email protected]":
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left yarn.lock changes in as it seemed the yarn build ran consistently faster with them

@justinabrokwah-okta justinabrokwah-okta marked this pull request as ready for review October 14, 2022 13:28
@bretterer bretterer merged commit ab346a8 into master Dec 1, 2022
@bretterer bretterer deleted the jabro-okta-531005-update-oauthgranttype-enum branch December 1, 2022 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

urn:ietf:params:oauth:grant-type:saml2-bearer Not included in OAuthGrantType
2 participants