Reputation: 289
I am making an API in .net that is using WebApi. The API is going to be consumed by an adroid native application. I would like to implement OAuth2 for authentication however I don't want to use Entity Framework and the baked in implementation when you create a project seems to use that. Is there an easy way to implement the OAuth2 modules without the Entity Framework integration or do I have to try and write my own classes that implement the same interfaces as the user classes in Entity Framework?
Upvotes: 0
Views: 344
Reputation: 2440
You don't need to. That's just there for convenience. First, you need to understand how OAuth works from an Authentication Server perspective. I have a feeling you are using OWIN.
In that case, you need to enable OAuthAuthentication and use their delegates to intercept when clients are calling your API for authentication (so that you can generate a token). Then you just authenticate against a database... worst case scenario you can do.. "SELECT u, p from Users where u = 'user' and p = 'password'.... My point is that you don't need Entity Framework at all. Once you have a valid user, then you create a token, add some claims to it and send it back. Done. There are plenty of examples online.
Upvotes: 1