Monthly Archives: September 2014

Configure Azman in your application

If you need to add Azman Window’s authentication to your application, here are the steps

Step 1

Import ‘EnterpriseLibrary.Security’ nugget package in your application

It will download all its dependency with it

Step 2

Create the Azman file, with azman management console

Create Application, Operations, Role, Role assignment in it. I am not going to explain this here, if you need to know more, there is excellent video on Microsoft Channel 9 for this.

Step 3

Configure Azman Provider in your Web.Config/App.Config

Step 4

Use it in your code.

private static bool IsUserAuthentiateforOperation(string azmanOperation)
    bool isUserAuthenticate = false;
    WindowsIdentity userIdentity = System.Security.Principal.WindowsIdentity.GetCurrent();
    IPrincipal principal = new GenericPrincipal(userIdentity, new string[] { azmanOperation.ToLower() });
    IAuthorizationProvider provider = AuthorizationFactory.GetAuthorizationProvider("AzMan Provider");
    isUserAuthenticate = provider.Authorize(principal, azmanOperation);
    return isUserAuthenticate;

That’s it, so simple and magnificent.

I have attached the sample application with this blog post, you can download and feel the bare metal yourself.