I've implemented REST APIs for my application using Jersey 2.x. I went with a REST approach is because I plan to add mobile apps at a later time. Right now it's only a web app. I am at a point where I am thinking about security. There are two things that I need handle.
- Authenticating and Authorizing users: Right now, I am using HTTP Basic auth over HTTPs. But is there a better way instead of having users send username and password over the wire. I understand it is over HTTPS but I am exploring. OAuth 1.0a comes to mind. Am I on the right track?
- Securing the API itself: I don't want any other client except for my web app to be in the white list. I will later add my mobile apps to this white list. I am imagining some kind of secret key to identify this client?
I imagine both #1 and #2 above can be done with OAuth 1.0a but they are two different implementations in terms of what is being secured and authorized. Can they both co-exist? Can you provide me with any pointers on how to get started and some examples in the real world?
There is a lot of information out there but security is not my strong suit and I am trying to understand by coding it myself in my own app.