Identity and Authentication - Common Authentication Methods

Username and Passwords
This is the most common method of identifying users in the age of Software as a Service (SaaS)
请添加图片描述
解释上面的图中的步骤:

Login Request:

POST /login
postuser = {
	username: 'users',
	password: 'pws'
}

Find users:

SELECT * FROM database_example
WHERE 'username' = postuser.username

Return to API Server

dbuser = {
	username: 'users',
	userdata: 'users_data',
	password: 'pws'
}

Compare Password:

postuser.password == dbuser.password

Return Response:

# if passwords match
Response 200 status code
# if passwords don't match
Response 401 status code

HTTP Status Codes

  • 401 Unauthorized
    The client must pass authentication before access to this resource is granted. The server cannot validate the identity of the requested parts.

  • 403 Forbidden
    The client does not have permission to access the resource. Unlike 401, the server knows who is making the request, but that requesting party has no authorization to access the resource.

更多HTTP Status Codes解释


Even though passwords are by far the most common way of authenticating, they come with a load of problems. Some issues with passwords are outside of our control as developers. Many issues come from user behavior that developers cannot directly influence, such as:

  • Users forget their passwords
  • Users use simple passwords
  • Users use common passwords
  • Users repeat passwords
  • Users share passwords

In contrast, some issues are within control as developers:

  • Passwords can be compromised
  • Developers can incorrectly check
  • Developers can cut corners
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值