Skip to content
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

ControllerTypeExtensions should look for ControllerBase type #16187

Merged
merged 4 commits into from
May 30, 2024
Merged

Conversation

Skrypt
Copy link
Contributor

@Skrypt Skrypt commented May 28, 2024

image

Fixes #16186

@MikeAlhayek
Copy link
Member

@Skrypt this is a good change. What would be better "if you like", is converting these to minimalAPI instead. Here is an example of MinimalAPI converting that I did recently https://github.com/OrchardCMS/OrchardCore/pull/16174/files

@Skrypt
Copy link
Contributor Author

Skrypt commented May 28, 2024

Yeah, could be that too but we still need to fix the issue for those who want to use this method with their ApiControllers. So, I think that would be a different PR.

@Piedone Piedone merged commit 39c970e into main May 30, 2024
11 checks passed
@Piedone Piedone deleted the skrypt/16186 branch May 30, 2024 10:22
@@ -25,15 +25,15 @@ public static ActionResult ChallengeOrForbid(this Controller controller)
/// <param name="controller"></param>
/// <param name="authenticationSchemes">The authentication schemes to challenge.</param>
/// <returns>The proper actionresult based upon if the user is authenticated.</returns>
public static ActionResult ChallengeOrForbid(this Controller controller, params string[] authenticationSchemes)
public static ActionResult ChallengeOrForbid(this ControllerBase controller, params string[] authenticationSchemes)
Copy link
Contributor Author

@Skrypt Skrypt Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebastienros There is also this which needed to also be extended on top of the ControllerBase just because we need it for Api Controllers too.

@Skrypt
Copy link
Contributor Author

Skrypt commented Jul 9, 2024

More on this. When inheriting Controller on an Api Controller it also allows doing bad practice like using

return View();
return Json(something);

Which should not be options that are available with an ApiController.

@Piedone
Copy link
Member

Piedone commented Jul 9, 2024

Yep!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ControllerTypeExtensions ControllerName should look for ControllerBase
3 participants