我一直在尝试对我将要开发的API进行身份验证。
我试图想出一种方法来成功地对用户进行身份验证,记住用户可以访问客户端上的所有数据,我提出了这个想法。
Client sends username and password to the server
Server checks if they match a user.
If it does, we create a hashed string with user_id+e-mail+currentTime+salt
and stores this in a database-table with an expiration date.
Server returns hashed string to client
Client sends random request to server including key
Server checks if key is correct and if it's expired这是一种安全的方式吗,或者你看到任何安全缺陷了吗?
发布于 2013-11-11 01:30:04
首先,Do i see security flaws?是和否。如果您使用的不是安全连接,则通过网络发送用户密码和用户名不是一个好主意。特别是如果您没有在sha512或您使用的任何东西中散列用户的密码。
我会在客户端散列密码,然后发送它。
以Twitter的API为例。他们还使用密钥来验证您的帐户。
这是一个有用的article。
https://stackoverflow.com/questions/19892697
复制相似问题