mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-5: Ensure random password is generated for new users (if not otherwise specified).
This commit is contained in:
@@ -21,6 +21,7 @@ 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;
|
||||||
@@ -89,6 +90,17 @@ public class UserDirectoryResource extends DirectoryResource<User, APIUser> {
|
|||||||
this.resourceFactory = resourceFactory;
|
this.resourceFactory = 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DirectoryObjectResource<User, APIUser>
|
public DirectoryObjectResource<User, APIUser>
|
||||||
getObjectResource(String identifier) throws GuacamoleException {
|
getObjectResource(String identifier) throws GuacamoleException {
|
||||||
|
Reference in New Issue
Block a user