0

I need to build a RESTfull web service using OAuth, bearer access_token and refresh_token. Authentication and authorization should be done by checking existing sql db.

The web api template, provided by VS2013 writes/reads in/from its own local sqlexpress db by this connectionString:

connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-WebApiTest-20150423094253.mdf;Initial Catalog=aspnet-WebApiTest-20150423094253;Integrated Security=True"

After hours of googling, I just got tutorials and examples, which do not match with my issue.

So how can I bind my db into the project for authentication/athorization?

4
  • Did you ever find an answer to this issue? Commented Jun 11, 2015 at 18:04
  • No. Do you know the answer? Commented Jun 12, 2015 at 10:33
  • I"m in the middle of doing it now. Its a bit of a complicated answer and I dont have it complete yet, but I've received help from these answers. Once I get through it I'll try to create an answer that is not too long. Commented Jun 12, 2015 at 15:02
  • I've found this post and it is exactly what I want. I think it is what you're describing here also. The key is in his TokenValidationAttribute there is a line AuthorizedUserRepository.GetUsers... this just needs to be replaced with a query to your database. Seems to be much simpler than the OWIN stuff. Commented Jun 12, 2015 at 18:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.