Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Remove AuthorizationFilterAttribute #4233

Closed
Tratcher opened this issue Mar 4, 2016 · 5 comments
Closed

Remove AuthorizationFilterAttribute #4233

Tratcher opened this issue Mar 4, 2016 · 5 comments
Assignees
Milestone

Comments

@Tratcher
Copy link
Member

Tratcher commented Mar 4, 2016

RE: aspnet/Security#720 (comment)

This regressed at some point. Authorization failures should result in a challenge. The auth middleware will take over and decide what to do with it.
@blowdart @HaoK

Update
Remove AuthorizationFilterAttribute as we do not want users to easily create their own authorization implementation. They should instead use authorization policies and requirements(IAuthorizationRequirement) to enforce authorization.

@blowdart
Copy link
Member

blowdart commented Mar 7, 2016

What will ChallengeResult end up with if there's no auth middleware?

@Tratcher
Copy link
Member Author

Tratcher commented Mar 7, 2016

An error saying nobody accepted the challenge. [Authorize] without auth providers is nonsensical.

@rynowak
Copy link
Member

rynowak commented Mar 7, 2016

Authorize requires an auth policy now, so presumably a configuration without providers would have failed earlier right?

@kevinchalet
Copy link
Contributor

Authorization failures should result in a challenge. The auth middleware will take over and decide what to do with it.

IMHO, this design has always been absolutely evil and semantically "nonsensical". The only place where we know exactly why authorization failed (not authenticated?, lack of permissions?) is in the authorization service. Taking such a decision at the authentication middleware level (by trying to determine whether AuthenticateAsync returned a principal or not) is just wrong.

A while ago, I designed a prototype moving the unauthorized/forbidden decision to the authorization service and introducting an AuthorizationResult determining why the authorization process failed: https://github.com/PinpointTownes/Security/commit/7ac1a2515015a98dc6f4919f28baa9db33beb50a

@rynowak
Copy link
Member

rynowak commented Mar 24, 2016

Do we need to provide AuthorizationFilterAttribute as a base-class? IMO we shouldn't make it easy to replace the auth system.

kichalla added a commit that referenced this issue Mar 29, 2016
kichalla added a commit that referenced this issue Mar 30, 2016
kichalla added a commit that referenced this issue Mar 30, 2016
@kichalla kichalla changed the title AuthorizationFilterAttribute returns UnauthorizedResult rather than ChallengeResult Remove AuthorizationFilterAttribute Mar 30, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants