跳到主内容

设置 Face ID 登录

本指南介绍如何启用 Face ID 登录。用户在账户中注册面部数据,然后在登录页面扫描面部以完成登录。Casdoor 使用 face-api.js 在浏览器中识别人脸。


学习目标​

  • 在组织的账户页面显示 Face ID 字段。
  • 为用户注册面部数据。
  • 提供 Face ID 作为应用的登录方式之一。

所需条件​

  • 拥有 Casdoor 管理控制台的访问权限
  • 配备摄像头的设备

在账户页面添加 Face ID​

  1. 在 Casdoor 管理控制台中,前往 User Management > Organizations 并打开组织。

  2. 在 Account items 中,添加 Face ID。

    Account items of the organization with Face ID

  3. 保存组织。

注册面部数据​

  1. 前往 User Management > Users 并打开用户。用户也可以在自己的账户页面执行相同操作。

  2. 在 Face IDs 中,添加面部条目并为其命名。每个用户最多可添加五个条目。

    Face IDs of a user

  3. 保存用户。

在登录方式中添加 Face ID​

  1. 前往 Identity > Applications 并打开应用。

  2. 在 Signin methods 中,添加 Face ID。

    Signin methods of the application with Face ID

  3. 保存应用。

验证结果​

  1. 在应用的登录页面上,选择 Face ID 方式。

  2. 输入用户名,然后点击使用面容 ID 登录。

    Sign-in page with the Face ID method

  3. 允许浏览器使用摄像头,并看向摄像头。

    Face recognition during sign-in

当面部与已注册的条目匹配时,Casdoor 将为你登录。

另请参阅​