MDL-77287 tool_oauth2: fix issuer form validation

This ensures validation errors from the issuer persistent are seen.
This commit is contained in:
Jake Dallimore 2023-02-17 14:52:05 +08:00
parent eb84455a05
commit efe9ac66be
2 changed files with 6 additions and 3 deletions

View File

@ -244,7 +244,6 @@ class issuer extends persistent {
* @return array of additional errors, or overridden errors.
*/
protected function extra_validation($data, $files, array &$errors) {
$errors = [];
if ($data->showonloginpage != \core\oauth2\issuer::SERVICEONLY) {
if (!strlen(trim($data->loginscopes))) {
$errors['loginscopes'] = get_string('required');

View File

@ -218,9 +218,13 @@ Feature: Basic OAuth2 functionality
| Name | Invalid custom service |
| Client ID | thisistheclientid |
| Client secret | supersecret |
| Service base URL | https://dc.imsglobal.org/ |
| Service base URL | http://dc.imsglobal.org/ |
When I press "Save changes"
Then I should see "Could not discover end points for identity issuer: Invalid custom service"
Then I should see "For security reasons only https connections are allowed, sorry"
And I set the following fields to these values:
| Service base URL | https://dc.imsglobal.org/ |
And I press "Save changes"
And I should see "Could not discover end points for identity issuer: Invalid custom service"
And I should see "URL: https://dc.imsglobal.org/.well-known/openid-configuration"
And "Allow services" "icon" should exist in the "Invalid custom service" "table_row"
And "Do not allow login" "icon" should exist in the "Invalid custom service" "table_row"