-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix required tenant in OpenId Validation settings UI #17266
Fix required tenant in OpenId Validation settings UI #17266
Conversation
…r, if authority is provided, tenant is not required
Thank you for submitting your first pull request, awesome! 🚀 If you haven't already, please take a moment to review our contribution guide. This guide provides helpful information to ensure your contribution aligns with our standards. A core team member will review your pull request. |
@dotnet-policy-service agree company="Imatra" |
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.
Thanks for your PR, @salmattia!
@@ -72,7 +72,10 @@ public override async Task<IDisplayResult> UpdateAsync(OpenIdValidationSettings | |||
|
|||
if (string.IsNullOrWhiteSpace(model.Tenant)) |
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.
While we're at it, let's use string.IsNullOrEmpty()
instead of string.IsNullOrWhiteSpace()
lines 73 and 75 😃
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.
Done!
…gsDisplayDriver.cs
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.
Looks great!
I'll let @MikeAlhayek merge it and backport it to make sure it's included in the next patch/minor release.
Happy holidays! 🎄
Thank you! Happy holidays |
@kevinchalet I see couple of issues with the code. I think the code should look like this instead. do you agree? I think the old code should be kept. Instead, replace the line
with this code
If Authority should be only validated if there is not Tenant, then we may need to fix the error to this instead
|
Personally, I'd even remove all this validation code and simply rely on OrchardCore/src/OrchardCore.Modules/OrchardCore.OpenId/Services/OpenIdValidationService.cs Lines 80 to 223 in d64eb52
|
@kevinchalet The OpenIdValidationService is good. But in the driver, we assign prefix for the validation error key names. Also, if for some reason the property names in I think its better to leave the validation in the driver "I know it repeated logic", but it's clear what we are validating and what keys we are settings with the errors. Please check out the updated validation logic. If you are good with this, I'll merge and portback. |
Well, if you're concerned by that, we should be duplicating all the validation checks and not just a single one? 😄 If you strongly think we should have a duplicated check, let's merge it. Otherwise, just remove it. |
I'll merge this one and back port it. We can submit another PR in v3 that removed the validation from the driver. |
Congratulations on your first PR merge! 🎉 Thank you for your contribution! We're looking forward to welcoming other contributions of yours in the future. @all-contributors please add @salmattia for code. |
@github-actions[bot] I've put up a pull request to add @salmattia! 🎉 |
/backport to release/2.1 |
Started backporting to release/2.1: https://github.com/OrchardCMS/OrchardCore/actions/runs/12486787988 |
Fix #17233. Now one of tenant or authority is required. Tenant can be empty when an external authority validates tokens.
Error is displayed on save only if both tenant and authority fields are not filled out