{"record":{"id":"7f080245407885f7","repo":"passbolt/passbolt_api","slug":"something-went-wrong-when-validating-the-single-sign-on","errorCode":null,"errorMessage":"Something went wrong when validating the single-sign on settings.","messagePattern":"Something went wrong when validating the single-sign on settings\\.","errorType":"validation","errorClass":"CustomValidationException","httpStatus":422,"severity":"error","filePath":"plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsSetService.php","lineNumber":54,"sourceCode":"\nclass SsoSettingsSetService\n{\n    /**\n     * Create an encrypted org setting\n     *\n     * @param \\App\\Utility\\UserAccessControl $uac user access control\n     * @param array $data user provided data\n     * @return \\Passbolt\\Sso\\Model\\Dto\\SsoSettingsDto\n     */\n    public function create(UserAccessControl $uac, array $data): SsoSettingsDto\n    {\n        if (!$uac->isAdmin()) {\n            throw new BadRequestException(__('Only administrators can create SSO settings.'));\n        }\n\n        $form = $this->getSsoSettingsForm($data);\n        if (!$form->execute($data)) {\n            throw new CustomValidationException(\n                __('Something went wrong when validating the single-sign on settings.'),\n                $form->getErrors()\n            );\n        }\n        $data = $form->getData();\n\n        // Prepare the data, serialize the JSON and encrypt using server key\n        $serializedData = $this->serializeData($data['provider'], $data['data']);\n        $encryptedData = $this->encrypt($serializedData);\n\n        // Build entity\n        $ssoSettingsTable = TableRegistry::getTableLocator()->get('Passbolt/Sso.SsoSettings');\n        /** @var \\Passbolt\\Sso\\Model\\Entity\\SsoSetting $ssoSettingEntity */\n        $ssoSettingEntity = $ssoSettingsTable->newEntity(\n            [\n                'provider' => $data['provider'],\n                'status' => SsoSetting::STATUS_DRAFT,\n                'data' => $encryptedData,","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsSetService.php#L36-L72","documentation":"After the admin check, create() builds the SSO settings form (getSsoSettingsForm based on the chosen provider) and executes it; on failure it throws CustomValidationException with the message 'Something went wrong when validating the single-sign on settings.' and attaches $form->getErrors() as the error details. It means the submitted data did not pass the form/schema rules for the provider.","triggerScenarios":"Posting SSO settings missing required provider fields (e.g. azure_ad client id/secret/tenant), invalid URLs, unsupported provider value, wrong data types for fields like url or scopes.","commonSituations":"Copying settings from another provider into the wrong schema; typos in field names; leaving secret/id fields empty; using HTTP instead of HTTPS URLs where required; upgrading providers where the form schema changed.","solutions":["Inspect the errors object attached to the exception (form->getErrors()) to see exactly which fields failed.","Fix the offending fields per the provider schema (client id, client secret, tenant id, redirect/urls, etc.).","Use the correct provider value (e.g. 'azure' vs 'google') so the right form is selected.","Compare your payload against the plugin's form validation class (SsoSettingsFormDataForm / provider-specific forms) for the accepted field list."],"exampleFix":"// before\n$data = ['provider' => 'azure', 'client_id' => 'abc']; // missing required fields\n$service->create($uac, $data);\n// after\n$data = ['provider' => 'azure', 'client_id' => 'abc', 'client_secret' => 'xyz', 'tenant_id' => '...', 'url' => 'https://login.microsoftonline.com'];\n$service->create($uac, $data);","handlingStrategy":"validation","validationCode":"// pre-validate key fields per provider before calling\n$required = ['provider', 'client_id', 'client_secret', 'tenant_id', 'url'];\n$missing = array_diff($required, array_keys(array_filter($data)));\nif ($missing) { throw new Exception('Missing: ' . implode(',', $missing)); }","typeGuard":null,"tryCatchPattern":"try { $service->create($uac, $data); } catch (CustomValidationException $e) { $errors = $e->getErrors(); // show field-level errors to the user }","preventionTips":["Read the exception's embedded errors() payload for exact field failures","Match the payload to the provider-specific form schema","Use HTTPS URLs and correct provider enum values","Keep clients updated when the settings schema changes"],"tags":["sso","validation","form","bad-request"],"backgroundTag":"schema-validation-failed","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}