Skip to Content
Node与Express开发(第2版)
book

Node与Express开发(第2版)

by Ethan Brown
June 2021
Intermediate to advanced
290 pages
9h 21m
Chinese
Posts & Telecom Press
Content preview from Node与Express开发(第2版)
安全
|
205
略,因此为了避免冲突,这个
ID
属性将是认证策略类型和第三方
ID
的组合。例如,一个
Facebook
用户的
authId
可能为
facebook:525764102
,而一个
Twitter
用户的
authId
可能为
twitter:376841763
。
在示例中,我们将使用两个角色:“客户”和“雇员”。
18.3.5
 认证与注册及用户体验
认证指的是核对用户的
ID
,要么是使用某个受信任的第三方来核对,要么是通过提供给用
户的身份凭证(比如用户名和密码)来核对。而注册指的是用户在网站上获得一个账号的
过程(从我们的视角来看,如果数据库里创建了一条用户记录,那么注册就完成了)。
当用户第一次加入你的网站时,应该让他们明白自己正在注册。如果我们在使用一个第三
方认证系统,当用户成功地通过认证之后,就可以给他们完成注册,而无须让他们知道。
不过,这通常不是一个好做法。如果用户是在注册,就应该让他们知道(不管他们是否是
通过第三方来认证的)。如果以后用户想注销账号,也应该提供一个明确的机制。
在用户体验上需要考虑的一种情形是“第三方混淆”。如果用户在一月份使用
Facebook
注
册了你的服务,然后在七月份又来了,这时屏幕上显示着各种登录方式可供选择,包括
Facebook
、
T
witter
、谷歌或
LinkedIn
,用户可能会忘记当初是用哪个账号注册的,这很正
常。这是第三方认证带来的一个隐患,对此你所能做的很有限。因此让用户提供电子邮件
地址又有了一个合适的理由:如果用户留了电子邮件地址,你就可以给用户一个选择
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

面向对象的思考过程(原书第5版)

面向对象的思考过程(原书第5版)

马特 魏斯费尔德
精通模块化JavaScript

精通模块化JavaScript

Nicolás Bevacqua

Publisher Resources

ISBN: 9787115565099