Merge pull request #948 from pedroigor/master
[KEYCLOAK-883] - Fixing alias update.
This commit is contained in:
commit
9b6254399d
4 changed files with 27 additions and 2 deletions
|
@ -28,6 +28,8 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class IdentityProviderModel {
|
public class IdentityProviderModel {
|
||||||
|
|
||||||
|
private String internalId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>An user-defined identifier to unique identify an identity provider instance.</p>
|
* <p>An user-defined identifier to unique identify an identity provider instance.</p>
|
||||||
*/
|
*/
|
||||||
|
@ -58,6 +60,7 @@ public class IdentityProviderModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IdentityProviderModel(IdentityProviderModel model) {
|
public IdentityProviderModel(IdentityProviderModel model) {
|
||||||
|
this.internalId = model.getInternalId();
|
||||||
this.providerId = model.getProviderId();
|
this.providerId = model.getProviderId();
|
||||||
this.id = model.getId();
|
this.id = model.getId();
|
||||||
this.name = model.getName();
|
this.name = model.getName();
|
||||||
|
@ -66,6 +69,14 @@ public class IdentityProviderModel {
|
||||||
this.updateProfileFirstLogin = model.isUpdateProfileFirstLogin();
|
this.updateProfileFirstLogin = model.isUpdateProfileFirstLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getInternalId() {
|
||||||
|
return this.internalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInternalId(String internalId) {
|
||||||
|
this.internalId = internalId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class IdentityProviderEntity {
|
public class IdentityProviderEntity {
|
||||||
|
|
||||||
|
private String internalId;
|
||||||
private String name;
|
private String name;
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
private boolean updateProfileFirstLogin;
|
private boolean updateProfileFirstLogin;
|
||||||
|
@ -32,6 +33,14 @@ public class IdentityProviderEntity {
|
||||||
private String id;
|
private String id;
|
||||||
private Map<String, String> config = new HashMap<String, String>();
|
private Map<String, String> config = new HashMap<String, String>();
|
||||||
|
|
||||||
|
public String getInternalId() {
|
||||||
|
return this.internalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInternalId(String internalId) {
|
||||||
|
this.internalId = internalId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1115,6 +1115,7 @@ public class RealmAdapter implements RealmModel {
|
||||||
|
|
||||||
identityProviderModel.setProviderId(entity.getProviderId());
|
identityProviderModel.setProviderId(entity.getProviderId());
|
||||||
identityProviderModel.setId(entity.getId());
|
identityProviderModel.setId(entity.getId());
|
||||||
|
identityProviderModel.setInternalId(entity.getInternalId());
|
||||||
identityProviderModel.setName(entity.getName());
|
identityProviderModel.setName(entity.getName());
|
||||||
identityProviderModel.setConfig(entity.getConfig());
|
identityProviderModel.setConfig(entity.getConfig());
|
||||||
identityProviderModel.setEnabled(entity.isEnabled());
|
identityProviderModel.setEnabled(entity.isEnabled());
|
||||||
|
@ -1168,7 +1169,8 @@ public class RealmAdapter implements RealmModel {
|
||||||
@Override
|
@Override
|
||||||
public void updateIdentityProvider(IdentityProviderModel identityProvider) {
|
public void updateIdentityProvider(IdentityProviderModel identityProvider) {
|
||||||
for (IdentityProviderEntity entity : this.realm.getIdentityProviders()) {
|
for (IdentityProviderEntity entity : this.realm.getIdentityProviders()) {
|
||||||
if (entity.getId().equals(identityProvider.getId())) {
|
if (entity.getInternalId().equals(identityProvider.getInternalId())) {
|
||||||
|
entity.setId(identityProvider.getId());
|
||||||
entity.setName(identityProvider.getName());
|
entity.setName(identityProvider.getName());
|
||||||
entity.setEnabled(identityProvider.isEnabled());
|
entity.setEnabled(identityProvider.isEnabled());
|
||||||
entity.setUpdateProfileFirstLogin(identityProvider.isUpdateProfileFirstLogin());
|
entity.setUpdateProfileFirstLogin(identityProvider.isUpdateProfileFirstLogin());
|
||||||
|
|
|
@ -791,6 +791,7 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
|
||||||
|
|
||||||
identityProviderModel.setProviderId(entity.getProviderId());
|
identityProviderModel.setProviderId(entity.getProviderId());
|
||||||
identityProviderModel.setId(entity.getId());
|
identityProviderModel.setId(entity.getId());
|
||||||
|
identityProviderModel.setInternalId(entity.getInternalId());
|
||||||
identityProviderModel.setName(entity.getName());
|
identityProviderModel.setName(entity.getName());
|
||||||
identityProviderModel.setConfig(entity.getConfig());
|
identityProviderModel.setConfig(entity.getConfig());
|
||||||
identityProviderModel.setEnabled(entity.isEnabled());
|
identityProviderModel.setEnabled(entity.isEnabled());
|
||||||
|
@ -817,6 +818,7 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
|
||||||
public void addIdentityProvider(IdentityProviderModel identityProvider) {
|
public void addIdentityProvider(IdentityProviderModel identityProvider) {
|
||||||
IdentityProviderEntity entity = new IdentityProviderEntity();
|
IdentityProviderEntity entity = new IdentityProviderEntity();
|
||||||
|
|
||||||
|
entity.setInternalId(KeycloakModelUtils.generateId());
|
||||||
entity.setId(identityProvider.getId());
|
entity.setId(identityProvider.getId());
|
||||||
entity.setProviderId(identityProvider.getProviderId());
|
entity.setProviderId(identityProvider.getProviderId());
|
||||||
entity.setName(identityProvider.getName());
|
entity.setName(identityProvider.getName());
|
||||||
|
@ -843,7 +845,8 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
|
||||||
@Override
|
@Override
|
||||||
public void updateIdentityProvider(IdentityProviderModel identityProvider) {
|
public void updateIdentityProvider(IdentityProviderModel identityProvider) {
|
||||||
for (IdentityProviderEntity entity : this.realm.getIdentityProviders()) {
|
for (IdentityProviderEntity entity : this.realm.getIdentityProviders()) {
|
||||||
if (entity.getId().equals(identityProvider.getId())) {
|
if (entity.getInternalId().equals(identityProvider.getInternalId())) {
|
||||||
|
entity.setId(identityProvider.getId());
|
||||||
entity.setName(identityProvider.getName());
|
entity.setName(identityProvider.getName());
|
||||||
entity.setEnabled(identityProvider.isEnabled());
|
entity.setEnabled(identityProvider.isEnabled());
|
||||||
entity.setUpdateProfileFirstLogin(identityProvider.isUpdateProfileFirstLogin());
|
entity.setUpdateProfileFirstLogin(identityProvider.isUpdateProfileFirstLogin());
|
||||||
|
|
Loading…
Reference in a new issue