KEYCLOAK-3365 Configure required actions for LDAP in READ_ONLY mode
This commit is contained in:
parent
be19c6b806
commit
79f0703d62
1 changed files with 23 additions and 7 deletions
|
@ -17,7 +17,9 @@
|
|||
|
||||
package org.keycloak.storage.ldap;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.keycloak.models.UserModel;
|
||||
import org.keycloak.models.utils.UserModelDelegate;
|
||||
|
@ -38,36 +40,50 @@ public class ReadonlyLDAPUserModelDelegate extends UserModelDelegate implements
|
|||
|
||||
@Override
|
||||
public void setUsername(String username) {
|
||||
if (!Objects.equals(getUsername(), username)) {
|
||||
throw new ReadOnlyException("Federated storage is not writable");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastName(String lastName) {
|
||||
if (!Objects.equals(getLastName(), lastName)) {
|
||||
throw new ReadOnlyException("Federated storage is not writable");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFirstName(String first) {
|
||||
if (!Objects.equals(getFirstName(), first)) {
|
||||
throw new ReadOnlyException("Federated storage is not writable");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEmail(String email) {
|
||||
if (!Objects.equals(getEmail(), email)) {
|
||||
throw new ReadOnlyException("Federated storage is not writable");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSingleAttribute(String name, String value) {
|
||||
if (!Objects.equals(getAttribute(name), Collections.singletonList(value))) {
|
||||
throw new ReadOnlyException("Federated storage is not writable");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, List<String> values) {
|
||||
if (!Objects.equals(getAttribute(name), values)) {
|
||||
throw new ReadOnlyException("Federated storage is not writable");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttribute(String name) {
|
||||
if (getAttribute(name) != null) {
|
||||
throw new ReadOnlyException("Federated storage is not writable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue