mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-36: Do not automatically generate random passwords at the REST API level.
This commit is contained in:
@@ -206,10 +206,10 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
|
||||
// Store plaintext password internally
|
||||
this.password = password;
|
||||
|
||||
// If no password provided, clear password salt and hash
|
||||
// If no password provided, set random password
|
||||
if (password == null) {
|
||||
userModel.setPasswordSalt(null);
|
||||
userModel.setPasswordHash(null);
|
||||
userModel.setPasswordSalt(saltService.generateSalt());
|
||||
userModel.setPasswordHash(saltService.generateSalt());
|
||||
}
|
||||
|
||||
// Otherwise generate new salt and hash given password using newly-generated salt
|
||||
|
@@ -21,11 +21,9 @@ package org.apache.guacamole.rest.user;
|
||||
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.google.inject.assistedinject.AssistedInject;
|
||||
import java.util.UUID;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.net.auth.User;
|
||||
import org.apache.guacamole.net.auth.Directory;
|
||||
import org.apache.guacamole.net.auth.UserContext;
|
||||
@@ -69,15 +67,4 @@ public class UserDirectoryResource extends DirectoryResource<User, APIUser> {
|
||||
super(userContext, directory, translator, resourceFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public APIUser createObject(APIUser object) throws GuacamoleException {
|
||||
|
||||
// Randomly set the password if it wasn't provided
|
||||
if (object.getPassword() == null)
|
||||
object.setPassword(UUID.randomUUID().toString());
|
||||
|
||||
return super.createObject(object);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user