mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-5: Bring JDBC authentication up to date with sharing profile API changes.
This commit is contained in:
@@ -20,11 +20,14 @@
|
|||||||
package org.apache.guacamole.auth.jdbc.activeconnection;
|
package org.apache.guacamole.auth.jdbc.activeconnection;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import org.apache.guacamole.GuacamoleException;
|
||||||
|
import org.apache.guacamole.GuacamoleSecurityException;
|
||||||
import org.apache.guacamole.auth.jdbc.base.RestrictedObject;
|
import org.apache.guacamole.auth.jdbc.base.RestrictedObject;
|
||||||
import org.apache.guacamole.auth.jdbc.tunnel.ActiveConnectionRecord;
|
import org.apache.guacamole.auth.jdbc.tunnel.ActiveConnectionRecord;
|
||||||
import org.apache.guacamole.auth.jdbc.user.AuthenticatedUser;
|
import org.apache.guacamole.auth.jdbc.user.AuthenticatedUser;
|
||||||
import org.apache.guacamole.net.GuacamoleTunnel;
|
import org.apache.guacamole.net.GuacamoleTunnel;
|
||||||
import org.apache.guacamole.net.auth.ActiveConnection;
|
import org.apache.guacamole.net.auth.ActiveConnection;
|
||||||
|
import org.apache.guacamole.net.auth.credentials.UserCredentials;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of the ActiveConnection object which has an associated
|
* An implementation of the ActiveConnection object which has an associated
|
||||||
@@ -44,6 +47,11 @@ public class TrackedActiveConnection extends RestrictedObject implements ActiveC
|
|||||||
*/
|
*/
|
||||||
private String connectionIdentifier;
|
private String connectionIdentifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of the associated sharing profile.
|
||||||
|
*/
|
||||||
|
private String sharingProfileIdentifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The date and time this active connection began.
|
* The date and time this active connection began.
|
||||||
*/
|
*/
|
||||||
@@ -90,7 +98,8 @@ public class TrackedActiveConnection extends RestrictedObject implements ActiveC
|
|||||||
super.init(currentUser);
|
super.init(currentUser);
|
||||||
|
|
||||||
// Copy all non-sensitive data from given record
|
// Copy all non-sensitive data from given record
|
||||||
this.connectionIdentifier = activeConnectionRecord.getConnection().getIdentifier();
|
this.connectionIdentifier = activeConnectionRecord.getConnectionIdentifier();
|
||||||
|
this.sharingProfileIdentifier = activeConnectionRecord.getSharingProfileIdentifier();
|
||||||
this.identifier = activeConnectionRecord.getUUID().toString();
|
this.identifier = activeConnectionRecord.getUUID().toString();
|
||||||
this.startDate = activeConnectionRecord.getStartDate();
|
this.startDate = activeConnectionRecord.getStartDate();
|
||||||
|
|
||||||
@@ -123,6 +132,22 @@ public class TrackedActiveConnection extends RestrictedObject implements ActiveC
|
|||||||
this.connectionIdentifier = connnectionIdentifier;
|
this.connectionIdentifier = connnectionIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSharingProfileIdentifier() {
|
||||||
|
return sharingProfileIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSharingProfileIdentifier(String sharingProfileIdentifier) {
|
||||||
|
this.sharingProfileIdentifier = sharingProfileIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserCredentials getSharingCredentials(String identifier)
|
||||||
|
throws GuacamoleException {
|
||||||
|
throw new GuacamoleSecurityException("Permission denied");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getStartDate() {
|
public Date getStartDate() {
|
||||||
return startDate;
|
return startDate;
|
||||||
|
@@ -27,6 +27,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import org.apache.guacamole.auth.jdbc.tunnel.GuacamoleTunnelService;
|
import org.apache.guacamole.auth.jdbc.tunnel.GuacamoleTunnelService;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
import org.apache.guacamole.auth.jdbc.JDBCEnvironment;
|
import org.apache.guacamole.auth.jdbc.JDBCEnvironment;
|
||||||
@@ -156,6 +157,12 @@ public class ModeledConnection extends ModeledGroupedDirectoryObject<ConnectionM
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getSharingProfileIdentifiers()
|
||||||
|
throws GuacamoleException {
|
||||||
|
return Collections.<String>emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends ConnectionRecord> getHistory() throws GuacamoleException {
|
public List<? extends ConnectionRecord> getHistory() throws GuacamoleException {
|
||||||
return connectionService.retrieveHistory(getCurrentUser(), this);
|
return connectionService.retrieveHistory(getCurrentUser(), this);
|
||||||
|
@@ -58,6 +58,16 @@ public class ModeledConnectionRecord implements ConnectionRecord {
|
|||||||
return model.getConnectionName();
|
return model.getConnectionName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSharingProfileIdentifier() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSharingProfileName() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getStartDate() {
|
public Date getStartDate() {
|
||||||
return model.getStartDate();
|
return model.getStartDate();
|
||||||
|
@@ -171,6 +171,16 @@ public class ActiveConnectionRecord implements ConnectionRecord {
|
|||||||
return connection.getName();
|
return connection.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSharingProfileIdentifier() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSharingProfileName() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getStartDate() {
|
public Date getStartDate() {
|
||||||
return startDate;
|
return startDate;
|
||||||
|
@@ -49,6 +49,7 @@ import org.apache.guacamole.net.auth.User;
|
|||||||
import org.apache.guacamole.net.auth.permission.ObjectPermissionSet;
|
import org.apache.guacamole.net.auth.permission.ObjectPermissionSet;
|
||||||
import org.apache.guacamole.net.auth.permission.SystemPermission;
|
import org.apache.guacamole.net.auth.permission.SystemPermission;
|
||||||
import org.apache.guacamole.net.auth.permission.SystemPermissionSet;
|
import org.apache.guacamole.net.auth.permission.SystemPermissionSet;
|
||||||
|
import org.apache.guacamole.net.auth.simple.SimpleObjectPermissionSet;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -251,6 +252,12 @@ public class ModeledUser extends ModeledDirectoryObject<UserModel> implements Us
|
|||||||
return connectionGroupPermissionService.getPermissionSet(getCurrentUser(), this);
|
return connectionGroupPermissionService.getPermissionSet(getCurrentUser(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectPermissionSet getSharingProfilePermissions()
|
||||||
|
throws GuacamoleException {
|
||||||
|
return new SimpleObjectPermissionSet();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ObjectPermissionSet getActiveConnectionPermissions()
|
public ObjectPermissionSet getActiveConnectionPermissions()
|
||||||
throws GuacamoleException {
|
throws GuacamoleException {
|
||||||
|
@@ -26,6 +26,7 @@ import org.apache.guacamole.auth.jdbc.connection.ConnectionDirectory;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
import org.apache.guacamole.auth.jdbc.base.RestrictedObject;
|
import org.apache.guacamole.auth.jdbc.base.RestrictedObject;
|
||||||
import org.apache.guacamole.auth.jdbc.activeconnection.ActiveConnectionDirectory;
|
import org.apache.guacamole.auth.jdbc.activeconnection.ActiveConnectionDirectory;
|
||||||
@@ -38,7 +39,9 @@ import org.apache.guacamole.net.auth.AuthenticationProvider;
|
|||||||
import org.apache.guacamole.net.auth.Connection;
|
import org.apache.guacamole.net.auth.Connection;
|
||||||
import org.apache.guacamole.net.auth.ConnectionGroup;
|
import org.apache.guacamole.net.auth.ConnectionGroup;
|
||||||
import org.apache.guacamole.net.auth.Directory;
|
import org.apache.guacamole.net.auth.Directory;
|
||||||
|
import org.apache.guacamole.net.auth.SharingProfile;
|
||||||
import org.apache.guacamole.net.auth.User;
|
import org.apache.guacamole.net.auth.User;
|
||||||
|
import org.apache.guacamole.net.auth.simple.SimpleDirectory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UserContext implementation which is driven by an arbitrary, underlying
|
* UserContext implementation which is driven by an arbitrary, underlying
|
||||||
@@ -134,6 +137,12 @@ public class UserContext extends RestrictedObject
|
|||||||
return connectionGroupDirectory;
|
return connectionGroupDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Directory<SharingProfile> getSharingProfileDirectory()
|
||||||
|
throws GuacamoleException {
|
||||||
|
return new SimpleDirectory<SharingProfile>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Directory<ActiveConnection> getActiveConnectionDirectory()
|
public Directory<ActiveConnection> getActiveConnectionDirectory()
|
||||||
throws GuacamoleException {
|
throws GuacamoleException {
|
||||||
@@ -173,4 +182,9 @@ public class UserContext extends RestrictedObject
|
|||||||
return ModeledConnectionGroup.ATTRIBUTES;
|
return ModeledConnectionGroup.ATTRIBUTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Form> getSharingProfileAttributes() {
|
||||||
|
return Collections.<Form>emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user