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

Initialization of descendants of AuthorizeAttribute not having a default constructor fails inside AuthorizeAttributeAclModule #156

Closed
estrizhok opened this issue Apr 23, 2013 · 2 comments

Comments

@estrizhok
Copy link

The way you instantiate filter attributes inherited from AuthorizeAttribute to check whether a user can access a certain link does not work for inheritors not providing an accessible default constructor, nor it does for sealed attributes.

Here is how I did that: I inherited a class I used to check permissions from ControllerActionInvoker, which allowed me to use its GetFilters method. You could then invoke InvokeAuthorizationFilters passing authorization filters as a parameter and check result has a non-nullable action result.

@NightOwl888
Copy link
Collaborator

Could you post your fix? Are you using v3 or v4?

@NightOwl888
Copy link
Collaborator

The way that AuthorizeAttribute is handled is largely based on the recommendation of this blog post. I was going down the road of trying to support any IFilterProvider as some people had complained, but it turned out that an older version of MvcSiteMapProvider did it that way which turned out to be all wrong.

Anyway, I am trying to work out if there is an actual problem here that needs to be addressed, there is a new feature that we need to add, or if you are just boasting your skills :). If there is something that needs to be done, please post some code so we can work it out. If not, let's just close this issue.

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

No branches or pull requests

2 participants