0

I am implementing my project with angular js and web api. For data access, I am using enterprise library, since to my project, I need performance. I am using enterprise library instead of EF for performance.

For authentication and authorization, I've planned to implement asp.net identity.

But when I searched tutorial, Asp.net mostly implemented with EF and Code first approach.

For database first approach in asp.net identity, I've found some solution and tutorial.

But I can't find the solution to implement ASP.NET IDENTITY WITH ENTERPRISE LIBRARY WITHOUT EF.

How to implement Asp.net Identity with enterprise library for web api ?

Can anyone please provide proper and simple tutorial?

Jeeva J
  • 3,173
  • 10
  • 38
  • 85

1 Answers1

-1

I'm going to assume you are going to host your WebAPI under IIS.

Your IIS Application is running under an Application-Pool. the Application-Pool runs under a certain Identity. The default Identity for an App-Pool is: ApplicationPoolIdentity (depending on your version of IIS)

See

http://blogs.iis.net/webdevelopertips/archive/2009/10/02/tip-98-did-you-know-the-default-application-pool-identity-in-iis-7-5-windows-7-changed-from-networkservice-to-apppoolidentity.aspx

If you follow the accepted answer to this question:

Login failed for user 'IIS APPPOOL\ASP.NET v4.0'

You'll see you need to give Sql-Server rights to the account running the App-Pool.

The quick way to test is to give the Identity running the AppPool.......the "db_reader" role. You won't be able to update, but you should see GET http actions work.

Your connection string would look like:

Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;

"Trusted_Connection" means the code will try to connect to the database using the identity which is running the code.

But to summarized, figure out which Identity is running your WebApi code.....and then give some kind of rights to this Identity to your database inside of Sql-Server. .......

Your other choice is to create a Sql-Server Login (username/password combination) and wire up your ConnectionString that EnterpriseLibrary uses to use this connection credentials information.

The below link calls it "Standard Security"

http://www.connectionstrings.com/sqlconnection/

Server=myServerAddress;Database=myDataBase;User Id=myUsername;
Password=myPassword;
Community
  • 1
  • 1
granadaCoder
  • 26,328
  • 10
  • 113
  • 146
  • I planned to use asp.net identity for authentication and authorisation... Is there any alternate solution for authentication and authorization? Or I can go with asp.net identity, web api and enterprise library.. – Jeeva J Mar 06 '15 at 07:27
  • You can use WebApi and Asp.Net Identity and Enterprise.Library.Data. As I have described in my answer, you need to give the identity (under which asp.net is running) ... authentication and authorization to the database. – granadaCoder Mar 06 '15 at 14:19
  • @granadaCoder the OP refers to the ASP.NET Identity system that was designed to replace the previous ASP.NET Membership and Simple Membership systems, the default implementation is based on Entity Framework and he would like a pointer on how to do an Enterprise Library based solution. – qbantek Sep 26 '15 at 00:50
  • Identity => http://www.asp.net/identity ; EF => http://www.asp.net/entity-framework ; Enterprise Library => https://msdn.microsoft.com/en-us/library/ff648951.aspx – qbantek Sep 26 '15 at 00:52