Reputation: 1476
I'm researching a new web-application that I want to develop using HATEOAS, RESTful principles. I'm looking into authentication schemes and the information for authentication of web-apps (via browsers, not machine-to-machine), seems a bit lacking.
After establishing an HTTPS session and initial log-on there doesn't seem to be any need for tokens, cookies, HMAC's, nonces, etc. to be passed. Nor does the Basic-Authentication or HMAC, OAuth, etc seem to matter: the HTTPS session is secure.
I'm probably missing something. Here's how I imagine my solution working: -
For the server to identify the authenticated user on subsequent requests, it could either: -
I see no reason to use anything else than HTTPS. What am I missing, what vulnerabilities or missing functionality?
Thanks!
Upvotes: 0
Views: 158
Reputation: 579
HTTP Basic Authentication (i.e., username and password) + HTTPS is generally considered to be secure enough for most REST APIs, especially for internal use. However without a unique nonce (or transaction ID), you are vulnerable to replay attacks.
For example, imagine an attacker was able to record a genuine PUT request to create some new record in your database. They could then replay that message in a loop to launch a DoS attack on your API by filling up your database tables. Although the message was encrypted via SSL, it still contains valid credentials, so each replayed request from the attacker would be dutifully decrypted and successfully authenticated by your API.
HTTP Digest Authentication includes a nonce that changes for each request and is therefore considered a more secure option.
Upvotes: 3
Reputation: 721
You have to define security here. SSL is fairly secure (despite there being issues recently with OpenSSL/Heartbleed).
However, as I see you are using a username and password/login, why not combine HTTP Basic and HTTPS? Most frameworks support basic auth, so. Simply authenticate the user every time you make a call. This is the only way to be RESTFul with Authentication, as you want to be stateless.
Upvotes: 1