Using NetSqlAzMan with Asp.Net MVC3.0

Topics: General Topic
Sep 26, 2012 at 2:15 PM

Hi,

I am trying to use NetSqlAzMan to authenticate user using LDAP and then depends on the roles Authorize the user and give access to menus specific to that user role. I have gone through many blogs and videos, but am not sure from where to start and how to go ahead.

Any help will be appreciated!!

Thanks.

Hardik

Oct 2, 2012 at 1:55 AM

Hardik,

Here is how I have implemented:

  1. Define the Tasks in a format of Area.Controller.Action.
  2. Implemented my  ActionAuthorizeAttribute which derived from AuthorizeAttribute.  It takes the context information to determine the current task by Area+Controller+Action and make the authorization decision. (You may put this in your common library to be shared by all projects.)
  3. Register ActionAuthorizeAttribute as a global filter.

So, one line of code, authorization is done! And you can change your roles/users on the fly!

 

Richard

Oct 12, 2012 at 9:30 PM

I'm very interested in the ActionAuthorizeAttribute you mentioned, but I can't seem to find where it is.  Can you point me in the right direction?

Thanks!

 

-Mark

Oct 15, 2012 at 9:58 PM

Mark,

ActionAuthorizeAttribute is a class you need implement. It should derive from AuthorizeAttribute class. It takes the context information to determine the current task by Area+Controller+Action and make the authorization decision.

 

Richard