diff --git a/src/app/components/IdentityProviderWizard/Wizards/Providers/Generic/OIDC/index.tsx b/src/app/components/IdentityProviderWizard/Wizards/Providers/Generic/OIDC/index.tsx index 7f64b14b..4a580feb 100644 --- a/src/app/components/IdentityProviderWizard/Wizards/Providers/Generic/OIDC/index.tsx +++ b/src/app/components/IdentityProviderWizard/Wizards/Providers/Generic/OIDC/index.tsx @@ -126,7 +126,12 @@ export const GenericOIDC: FC = () => { }; } } catch (e) { - console.log(err); + console.log(e); + return { + status: API_STATUS.ERROR, + message: + "Configuration validation failed with OIDC. Check URL and try again.", + }; } return { @@ -253,9 +258,9 @@ export const GenericOIDC: FC = () => { }; try { - await CreateIdp({createIdPUrl, payload, featureFlags}); + await CreateIdp({ createIdPUrl, payload, featureFlags }); // TODO emailAsUsername, Mapper? - + setResults(`${idpCommonName} created successfully. Click finish.`); setStepIdReached(finishStep); setError(false); diff --git a/src/app/components/IdentityProviderWizard/Wizards/components/forms/file.tsx b/src/app/components/IdentityProviderWizard/Wizards/components/forms/file.tsx index 0075d1dd..bf01bc2a 100644 --- a/src/app/components/IdentityProviderWizard/Wizards/components/forms/file.tsx +++ b/src/app/components/IdentityProviderWizard/Wizards/components/forms/file.tsx @@ -89,7 +89,7 @@ export const MetadataFile: FC = ({ browseButtonText="Select" onChange={(val) => setFieldValue("metadataFile", val)} dropzoneProps={{ - accept: "text/xml", + accept: "text/xml, application/json", }} isLoading={isSubmitting} isDisabled={!formActive} diff --git a/src/app/components/IdentityProviderWizard/Wizards/components/forms/url.tsx b/src/app/components/IdentityProviderWizard/Wizards/components/forms/url.tsx index 191eb568..e5f5cc2e 100644 --- a/src/app/components/IdentityProviderWizard/Wizards/components/forms/url.tsx +++ b/src/app/components/IdentityProviderWizard/Wizards/components/forms/url.tsx @@ -16,10 +16,13 @@ import { API_STATUS, } from "@app/configurations/api-status"; +const URL_REGEX = + /^(https?:\/\/)(localhost|([-\w]+\.)*\w+)(:\d+)?(\/[-\w@:%._\+~#=]+)*(\/[\w\/]*)*(\?.*)?(#.*)?$/; + const UrlSchema = Yup.object().shape({ url: Yup.string() - .url("Url should be a valid Url.") - .required("Url is a required field."), + .matches(URL_REGEX, "URL should be a valid URL.") + .required("URL is a required field."), }); type Props = {