KEYCLOAK-1421 Added timestamp of keycloak user creation into user models
and persistence
This commit is contained in:
1 parent
aaa83dc19a
commit
d7379f29da
21 files changed
+206
-37
No files matched your search
@@ -20,6 +20,13 @@ public interface UserModel {
|
||||
String getUsername();
|
||||
|
||||
void setUsername(String username);
|
||||
|
||||
/**
|
||||
* Get timestamp of user creation. May be null for old users created before this feature introduction.
|
||||
*/
|
||||
Long getCreatedTimestamp();
|
||||
|
||||
void setCreatedTimestamp(Long timestamp);
|
||||
|
||||
boolean isEnabled();
|
||||
|
||||
@@ -88,4 +95,4 @@ public interface UserModel {
|
||||
public static enum RequiredAction {
|
||||
VERIFY_EMAIL, UPDATE_PROFILE, CONFIGURE_TOTP, UPDATE_PASSWORD
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import java.util.Map;
|
||||
public class UserEntity extends AbstractIdentifiableEntity {
|
||||
|
||||
private String username;
|
||||
private Long createdTimestamp;
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
private String email;
|
||||
@@ -36,6 +37,15 @@ public class UserEntity extends AbstractIdentifiableEntity {
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public Long getCreatedTimestamp() {
|
||||
return createdTimestamp;
|
||||
}
|
||||
|
||||
public void setCreatedTimestamp(Long timestamp) {
|
||||
this.createdTimestamp = timestamp;
|
||||
}
|
||||
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ModelToRepresentation {
|
||||
UserRepresentation rep = new UserRepresentation();
|
||||
rep.setId(user.getId());
|
||||
rep.setUsername(user.getUsername());
|
||||
rep.setCreatedTimestamp(user.getCreatedTimestamp());
|
||||
rep.setLastName(user.getLastName());
|
||||
rep.setFirstName(user.getFirstName());
|
||||
rep.setEmail(user.getEmail());
|
||||
|
||||
@@ -798,6 +798,7 @@ public class RepresentationToModel {
|
||||
// Import users just to user storage. Don't federate
|
||||
UserModel user = session.userStorage().addUser(newRealm, userRep.getId(), userRep.getUsername(), false, false);
|
||||
user.setEnabled(userRep.isEnabled());
|
||||
user.setCreatedTimestamp(userRep.getCreatedTimestamp());
|
||||
user.setEmail(userRep.getEmail());
|
||||
user.setEmailVerified(userRep.isEmailVerified());
|
||||
user.setFirstName(userRep.getFirstName());
|
||||
|
||||
@@ -225,4 +225,14 @@ public class UserModelDelegate implements UserModel {
|
||||
public UserModel getDelegate() {
|
||||
return delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getCreatedTimestamp(){
|
||||
return delegate.getCreatedTimestamp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreatedTimestamp(Long timestamp){
|
||||
delegate.setCreatedTimestamp(timestamp);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user