When making a custom [Authorize] attribute is there a way to catch what Role that is being requested?
So in the case of [Auth(Roles = "IgnoreAuth")] is there a way inside of the custom Auth to catch "IgnoreAuth" somehow?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Roles is in the base AuthorizeAttribute class. So you can simply access it from your custom Auth like this:
Just to clarify, whenever you do [Auth(Roles = “IgnoreAuth”)], you’re just setting the Roles property in the AuthorizeAttribute.