跳到主内容

Migrate from Okta

Move the users, groups and OpenID Connect (OIDC) applications of an Okta org into a Casdoor organization with the Okta Migration action from the Marketplace.


学习目标​

  • Give Casdoor read access to the Okta org.
  • 预览并应用迁移。
  • Switch the applications from Okta to Casdoor while the users keep their passwords.

前提条件​

  • An admin account of the Casdoor organization that the Okta org goes to. It can't be built-in.
  • An Okta admin account that can create API tokens. A super admin's token also returns the client secrets of the applications.

About the Okta migration​

The action reads the org through the Okta API with an API token, and sends requests only to the org's domain.

OktaCasdoor
UserA user. The Casdoor user ID is the Okta user ID, such as 00u1a2b3c4…, so the sub claim stays the same. The user name is the Okta login, which is often the email. Name, email, phone, title and organization go into the matching fields, and the other profile attributes into properties. Suspended users are imported as forbidden.
PasswordChecked with Okta on the user's first sign-in. See Passwords.
GroupA group with the same members. The Everyone group is skipped.
OIDC applicationAn application with the same client ID, client secret, redirect URIs and grant types, and the JWT-Standard token format. The Okta Admin Console and the Okta Dashboard are skipped.

密码​

Okta never exports password hashes. Instead, Casdoor saves these users with a password that the action checks:

  1. The first time a user signs in to Casdoor, the action sends the user name and password to the Okta authentication API, POST /api/v1/authn on the org's domain.
  2. If Okta accepts the password, the user is signed in, and Casdoor saves the password with the password type of the organization. Okta is not asked again for this user.
  3. If Okta rejects it, the sign-in fails as with any wrong password.

This works for users with an Okta password and for users whom Okta signs in through Active Directory or LDAP. A user who has to complete MFA in Okta still passes, because the password is correct. Casdoor asks for its own MFA once the user has set it up.

注意事项

Keep the Okta org running and don't delete the migration in Casdoor until your users have signed in to Casdoor once. Casdoor finds the Okta domain in the migration. After Okta is shut down, the users who haven't signed in yet reset their password in Casdoor.

Users who never activated their Okta account, and users who sign in to Okta only through an identity provider, have no Okta password. The report counts them.

Create an API token in Okta​

  1. In the Okta Admin Console, go to Security > API and open the Tokens tab.
  2. Click Create token, enter a name such as casdoor-migration, and click Create token.
  3. Copy the token value. Okta shows it only once.

The token acts with the permissions of the admin who created it. To import the client secrets of the applications, create it as a super admin. Revoke the token after the migration.

安装操作​

  1. 在 Casdoor 管理控制台中,前往 Identity > Marketplace。
  2. Search for Okta Migration and click Install.
  3. Choose the organization that the Okta org goes to, and click Install.

创建迁移​

  1. 前往 Admin > Migrations 并点击 Add。

  2. 设置以下字段:

    字段值
    Organization您安装该操作的组织。
    NameA name, such as okta.
    ActionOkta Migration.
    HostThe domain of the Okta org, such as your-org.okta.com.
    Client secretThe API token.

    Leave Client ID and Files empty.

  3. 点击 Test connection。

    An error in the Report says what Okta returned, such as HTTP 401 for a wrong or revoked token.

预览并应用​

  1. 点击 Preview 并等待 Report 显示 Previewed。
  2. 检查数字和 Warnings。常见警告:
    • The applications that are not OIDC applications, such as SAML applications. Add them to Casdoor yourself.
    • Applications whose client secret Okta didn't return. Casdoor gives them new secrets: update them in the applications, or create the token as a super admin and preview again.
    • Users who sign in to Okta through an identity provider. Add the provider to the Casdoor applications.
  3. 点击 Apply 并确认。

An AI agent connected to the Casdoor MCP server can do the same with plan_migration and apply_migration. See Migration tools.

切换应用​

  1. In each application, replace the Okta issuer, such as https://your-org.okta.com/oauth2/default, with your Casdoor address, or set the discovery URL to https://<your-casdoor-host>/.well-known/openid-configuration. Keep the client ID and client secret. See Standard OIDC client.
  2. In the APIs that check access tokens, replace Okta's issuer and JSON Web Key Set (JWKS) URL with Casdoor's.
  3. 如果您的应用读取 Okta 授权服务器添加的声明(claims),例如 groups,请在 Casdoor 中使用一个在颁发令牌之前运行的 flow 来添加它们,或者使用应用的 token attributes。

在切换之前,再次点击 Apply,以导入自上次运行以来在 Okta 中新增的用户。

验证结果​

  1. 使用已迁移用户的 Okta 登录名和密码登录其中一个应用。
  2. 在 ID 令牌中,检查 sub 是否为用户的 Okta 用户 ID。
  3. 前往 User Management > Users,打开该用户,并检查密码类型是否已从 plugin:okta-migration 更改为组织的密码类型。

未导入的内容​

  • 签名密钥。Okta 不会导出这些密钥,因此 Okta 颁发的令牌在 Casdoor 中无效,用户在切换后需要重新登录。
  • MFA 因素。使用 MFA 的用户需要重新注册。
  • 管理员角色、授权服务器、策略,以及哪些组有权访问哪些应用。
  • 非 OIDC 的应用,例如 SAML 和书签应用。
  • 已停用的用户。

另请参阅​