Migration fix
This commit is contained in:
parent
9688880837
commit
a5cbe113fd
3 changed files with 14 additions and 4 deletions
|
@ -52,11 +52,9 @@ public class MigrateTo2_1_0 {
|
|||
private void migrateDefaultRequiredAction(RealmModel realm) {
|
||||
RequiredActionProviderModel otpAction = realm.getRequiredActionProviderByAlias(UserModel.RequiredAction.CONFIGURE_TOTP.name());
|
||||
|
||||
if (otpAction == null) return;
|
||||
if (!otpAction.getProviderId().equals(UserModel.RequiredAction.CONFIGURE_TOTP.name())) return;
|
||||
if (!otpAction.getName().equals("Configure Totp")) return;
|
||||
MigrationUtils.updateOTPRequiredAction(otpAction);
|
||||
|
||||
otpAction.setName("Configure OTP");
|
||||
realm.updateRequiredActionProvider(otpAction);
|
||||
}
|
||||
|
||||
// KEYCLOAK-3338: Changes to how role policy config is stored"
|
||||
|
|
|
@ -47,4 +47,12 @@ public class MigrationUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void updateOTPRequiredAction(RequiredActionProviderModel otpAction) {
|
||||
if (otpAction == null) return;
|
||||
if (!otpAction.getProviderId().equals(UserModel.RequiredAction.CONFIGURE_TOTP.name())) return;
|
||||
if (!otpAction.getName().equals("Configure Totp")) return;
|
||||
|
||||
otpAction.setName("Configure OTP");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.keycloak.authorization.AuthorizationProvider;
|
|||
import org.keycloak.authorization.model.ResourceServer;
|
||||
import org.keycloak.authorization.store.ResourceServerStore;
|
||||
import org.keycloak.hash.Pbkdf2PasswordHashProvider;
|
||||
import org.keycloak.migration.migrators.MigrationUtils;
|
||||
import org.keycloak.models.ClientTemplateModel;
|
||||
import org.keycloak.models.Constants;
|
||||
import org.keycloak.common.util.Base64;
|
||||
|
@ -204,6 +205,9 @@ public class RepresentationToModel {
|
|||
if (rep.getRequiredActions() != null) {
|
||||
for (RequiredActionProviderRepresentation action : rep.getRequiredActions()) {
|
||||
RequiredActionProviderModel model = toModel(action);
|
||||
|
||||
MigrationUtils.updateOTPRequiredAction(model);
|
||||
|
||||
newRealm.addRequiredActionProvider(model);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue