GUACAMOLE-36: Do not automatically generate random passwords at the REST API level.

This commit is contained in:
Michael Jumper
2016-08-22 14:06:53 -07:00
parent 3744755a1e
commit 66f00adab0
2 changed files with 3 additions and 16 deletions

View File

@@ -206,10 +206,10 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
// Store plaintext password internally // Store plaintext password internally
this.password = password; this.password = password;
// If no password provided, clear password salt and hash // If no password provided, set random password
if (password == null) { if (password == null) {
userModel.setPasswordSalt(null); userModel.setPasswordSalt(saltService.generateSalt());
userModel.setPasswordHash(null); userModel.setPasswordHash(saltService.generateSalt());
} }
// Otherwise generate new salt and hash given password using newly-generated salt // Otherwise generate new salt and hash given password using newly-generated salt

View File

@@ -21,11 +21,9 @@ package org.apache.guacamole.rest.user;
import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.Assisted;
import com.google.inject.assistedinject.AssistedInject; import com.google.inject.assistedinject.AssistedInject;
import java.util.UUID;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.net.auth.User; import org.apache.guacamole.net.auth.User;
import org.apache.guacamole.net.auth.Directory; import org.apache.guacamole.net.auth.Directory;
import org.apache.guacamole.net.auth.UserContext; import org.apache.guacamole.net.auth.UserContext;
@@ -69,15 +67,4 @@ public class UserDirectoryResource extends DirectoryResource<User, APIUser> {
super(userContext, directory, translator, resourceFactory); 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);
}
} }