-
Notifications
You must be signed in to change notification settings - Fork 42
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
Remove deprecated @okta/configuration-validation and integrate essential functions #439
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vero1024
commented
Dec 12, 2024
Comment on lines
+56
to
+109
class ConfigurationValidationError extends Error {} | ||
const findDomainURL = 'https://bit.ly/finding-okta-domain'; | ||
const findAppCredentialsURL = 'https://bit.ly/finding-okta-app-credentials'; | ||
const copyCredentialsMessage = 'You can copy it from the Okta Developer Console ' + | ||
'in the details for the Application you created. ' + | ||
`Follow these instructions to find it: ${findAppCredentialsURL}`; | ||
|
||
const isHttps = new RegExp('^https://'); | ||
const hasDomainAdmin = /-admin.(okta|oktapreview|okta-emea).com/; | ||
|
||
function assertIssuer(issuer, testing = {}){ | ||
const copyMessage = 'You can copy your domain from the Okta Developer ' + | ||
'Console. Follow these instructions to find it: ' + findDomainURL; | ||
|
||
if (testing.disableHttpsCheck) { | ||
const httpsWarning = 'Warning: HTTPS check is disabled. ' + | ||
'This allows for insecure configurations and is NOT recommended for production use.'; | ||
/* eslint-disable-next-line no-console */ | ||
console.warn(httpsWarning); | ||
} | ||
|
||
if (!issuer) { | ||
throw new ConfigurationValidationError('Your Okta URL is missing. ' + copyMessage); | ||
} else if (!testing.disableHttpsCheck && !issuer.match(isHttps)) { | ||
throw new ConfigurationValidationError( | ||
'Your Okta URL must start with https. ' + | ||
`Current value: ${issuer}. ${copyMessage}` | ||
); | ||
} else if (issuer.match(/{yourOktaDomain}/)) { | ||
throw new ConfigurationValidationError('Replace {yourOktaDomain} with your Okta domain. ' + copyMessage); | ||
} else if (issuer.match(hasDomainAdmin)) { | ||
throw new ConfigurationValidationError( | ||
'Your Okta domain should not contain -admin. ' + | ||
`Current value: ${issuer}. ${copyMessage}` | ||
); | ||
} | ||
} | ||
|
||
function assertClientId(clientId){ | ||
if (!clientId) { | ||
throw new ConfigurationValidationError('Your client ID is missing. ' + copyCredentialsMessage); | ||
} else if (clientId.match(/{clientId}/)) { | ||
throw new ConfigurationValidationError('Replace {clientId} with the client ID of your Application. ' + copyCredentialsMessage); | ||
} | ||
} | ||
|
||
function assertRedirectUri(redirectUri){ | ||
if (!redirectUri) { | ||
throw new ConfigurationValidationError('Your redirect URI is missing.'); | ||
} else if (redirectUri.match(/{redirectUri}/)) { | ||
throw new ConfigurationValidationError('Replace {redirectUri} with the redirect URI of your Application.'); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy and convert javascript based configuration-validation
@rajdeepnanua-okta |
Thanks for your contribution @vero1024! I'm working on some CI fixes to merge this change and I will release a new version with this branch asap (hopefully today) |
rajdeepnanua-okta
changed the base branch from
master
to
remove_jsonpath_plus
December 16, 2024 20:39
rajdeepnanua-okta
merged commit Dec 16, 2024
7cea49c
into
okta:remove_jsonpath_plus
1 of 2 checks passed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes the deprecated @okta/configuration-validation package and integrates the essential functions directly into index.js.
Additionally, this change resolves a security vulnerability in the
jsonpath-plus
package.Resolves: #432