开发者

Authentication protocol for AJAX-based service

开发者 https://www.devze.com 2023-02-28 04:03 出处:网络
We are currently in the process of building a new service, the intent is to use PHP for the backend, and more importantly, use AJAX rather than regular HTTP requests for the frontend. So there will on

We are currently in the process of building a new service, the intent is to use PHP for the backend, and more importantly, use AJAX rather than regular HTTP requests for the frontend. So there will only ever be one initial page request.

While doing this, we'd also like to make sure that it is secure.

So the problem is this: Login is based on regular username/password. The AJAX frontend will make AJAX-requests to the server as necessary, but what should be done to avoid unnecessary security issues? Hashing the password is obviously one, it can be further improved by also including a server generated token in the hash, etc, etc.

But, I'm sure there are established protocols for these things, but I really don't know the merits of them... or even what they're called or where to find them (note, the server itself is trusted).

Would using HTTPS make all this redundant? Or is for instanc开发者_高级运维e hashing the password still strictly necessary (theoretical question)? Would using a protocol still be important/useful/pointless over HTTPS?

http://en.wikipedia.org/wiki/Secure_Remote_Password_protocol, is that something I should look into? Does HTTPS make SRP redundant? Are there more suitable protocols, especially over HTTPS?


If you use PHP sessions, you should be fine. When you make a AJAX call, the server will be sent a cookie payload from your page indicating which session ID it corresponds to. Obviously, do this over HTTPS to make the communication secure.

0

精彩评论

暂无评论...
验证码 换一张
取 消