跳到主内容

使用 Casdoor Authenticator 应用

本指南介绍如何安装 Casdoor Authenticator,将其连接到您的 Casdoor 实例,并将账户从其他身份验证器应用迁移到其中。


学习目标​

  • 在 Android 上安装应用或为 iOS 构建应用。
  • 将应用连接到 Casdoor 并同步账户。
  • 从 Google Authenticator 和 Microsoft Authenticator 导入账户。

前提条件​

  • Android 或 iOS 设备
  • 同步账户:需要一个 Casdoor 实例以及该实例上的一个账户

关于 Casdoor Authenticator​

Casdoor Authenticator 是一款开源应用(源代码),用于生成基于时间的一次性密码 (TOTP),类似于 Google Authenticator 和 Microsoft Authenticator。它是多因素认证 (MFA) 的第二重验证因子。

TOTP 代码是根据应用与服务共享的密钥以及当前时间计算得出的(RFC 6238)。该代码有效期为 30 秒,且应用无需网络连接即可生成代码。

FeatureDescription
MFAGenerates TOTP codes for any service that supports them
Offline useGenerates codes without an internet connection
SyncSyncs accounts between devices through Casdoor
PrivacyEncrypts the stored data
AndroidiOS
androidios

安装应用​

在 Casdoor 中开启账户存储​

此步骤为可选操作。若要将应用的 TOTP 账户存储在 Casdoor 中以实现跨设备同步,请在 Casdoor 管理控制台的组织 Account items 中添加 MFA accounts。

MFA accounts setting in Casdoor

将应用连接到 Casdoor​

打开应用并通过以下三种方式之一进行连接:

方法步骤
手动点击手动输入服务器,输入服务器URL、客户端ID和组织名称,然后登录。
二维码点击扫描二维码,扫描Casdoor服务器上我的账户→MFA账户中的二维码。
演示点击试用演示服务器以使用预配置的演示实例。

Connection options in the app

现在,应用将显示您的 TOTP 代码,您可以添加和管理账户。

从其他应用导入账户​

从 Google Authenticator 导入​

  1. 在 Google Authenticator 中,打开菜单并点击 Transfer accounts。

  2. 选择要导出的账户并点击 Export。Google Authenticator 将显示一个二维码。

    Export screen of Google Authenticator

  3. 在 Casdoor Authenticator 中扫描该二维码。

    Recording of the import from Google Authenticator

从 Microsoft Authenticator 导入​

此导入功能仅支持 Android 系统,且需要 root 权限,因为 Microsoft Authenticator 的数据位于私有目录 /data/data/com.azure.authenticator/databases/ 中。

  1. 在装有 Microsoft Authenticator 的设备上,从上述目录复制 PhoneFactor 数据库文件。

  2. 在 Casdoor Authenticator 中,打开导入菜单并点击 Import from Microsoft Authenticator。

  3. Select the PhoneFactor file. 该应用会导入TOTP账户。

    Recording of the import from Microsoft Authenticator

另请参阅​