使用 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 秒,且应用无需网络连接即可生成代码。
| Feature | Description |
|---|---|
| MFA | Generates TOTP codes for any service that supports them |
| Offline use | Generates codes without an internet connection |
| Sync | Syncs accounts between devices through Casdoor |
| Privacy | Encrypts the stored data |
| Android | iOS |
|---|---|
![]() | ![]() |
安装应用
- Android:下载最新 APK,或在 Releases 页面选择版本。
- iOS:该应用尚未上架 App Store。请从源代码构建。
在 Casdoor 中开启账户存储
此步骤为可选操作。若要将应用的 TOTP 账户存储在 Casdoor 中以实现跨设备同步,请在 Casdoor 管理控制台的组织 Account items 中添加 MFA accounts。

将应用连接到 Casdoor
打开应用并通过以下三种方式之一进行连接:
| 方法 | 步骤 |
|---|---|
| 手动 | 点击手动输入服务器,输入服务器URL、客户端ID和组织名称,然后登录。 |
| 二维码 | 点击扫描二维码,扫描Casdoor服务器上我的账户→MFA账户中的二维码。 |
| 演示 | 点击试用演示服务器以使用预配置的演示实例。 |

现在,应用将显示您的 TOTP 代码,您可以添加和管理账户。
从其他应用导入账户
从 Google Authenticator 导入
-
在 Google Authenticator 中,打开菜单并点击 Transfer accounts。
-
选择要导出的账户并点击 Export。Google Authenticator 将显示一个二维码。

-
在 Casdoor Authenticator 中扫描该二维码。

从 Microsoft Authenticator 导入
此导入功能仅支持 Android 系统,且需要 root 权限,因为 Microsoft Authenticator 的数据位于私有目录 /data/data/com.azure.authenticator/databases/ 中。
-
在装有 Microsoft Authenticator 的设备上,从上述目录复制
PhoneFactor数据库文件。 -
在 Casdoor Authenticator 中,打开导入菜单并点击 Import from Microsoft Authenticator。
-
Select the
PhoneFactorfile. 该应用会导入TOTP账户。

