mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-542: Migrate to simpler AbstractAuthenticationProvider / AbstractUserContext base classes.
This commit is contained in:
@@ -22,10 +22,9 @@ package org.apache.guacamole.auth.cas;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.net.auth.AbstractAuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.Credentials;
|
||||
import org.apache.guacamole.net.auth.UserContext;
|
||||
|
||||
/**
|
||||
* Guacamole authentication backend which authenticates users using an
|
||||
@@ -33,7 +32,7 @@ import org.apache.guacamole.net.auth.UserContext;
|
||||
* provided - only authentication. Storage must be provided by some other
|
||||
* extension.
|
||||
*/
|
||||
public class CASAuthenticationProvider implements AuthenticationProvider {
|
||||
public class CASAuthenticationProvider extends AbstractAuthenticationProvider {
|
||||
|
||||
/**
|
||||
* Injector which will manage the object graph of this authentication
|
||||
@@ -63,11 +62,6 @@ public class CASAuthenticationProvider implements AuthenticationProvider {
|
||||
return "cas";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getResource() throws GuacamoleException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser authenticateUser(Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
@@ -78,52 +72,4 @@ public class CASAuthenticationProvider implements AuthenticationProvider {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser updateAuthenticatedUser(
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
|
||||
// No update necessary
|
||||
return authenticatedUser;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext getUserContext(AuthenticatedUser authenticatedUser)
|
||||
throws GuacamoleException {
|
||||
|
||||
// No associated data whatsoever
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext updateUserContext(UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
|
||||
// No update necessary
|
||||
return context;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext decorate(UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext redecorate(UserContext decorated, UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,9 +22,8 @@ package org.apache.guacamole.auth.duo;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.net.auth.AbstractAuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.Credentials;
|
||||
import org.apache.guacamole.net.auth.UserContext;
|
||||
|
||||
/**
|
||||
@@ -32,7 +31,7 @@ import org.apache.guacamole.net.auth.UserContext;
|
||||
* authentication factor for users which have already been authenticated by
|
||||
* some other AuthenticationProvider.
|
||||
*/
|
||||
public class DuoAuthenticationProvider implements AuthenticationProvider {
|
||||
public class DuoAuthenticationProvider extends AbstractAuthenticationProvider {
|
||||
|
||||
/**
|
||||
* Injector which will manage the object graph of this authentication
|
||||
@@ -62,23 +61,6 @@ public class DuoAuthenticationProvider implements AuthenticationProvider {
|
||||
return "duo";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getResource() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser authenticateUser(Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser updateAuthenticatedUser(AuthenticatedUser authenticatedUser,
|
||||
Credentials credentials) throws GuacamoleException {
|
||||
return authenticatedUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext getUserContext(AuthenticatedUser authenticatedUser)
|
||||
throws GuacamoleException {
|
||||
@@ -95,30 +77,4 @@ public class DuoAuthenticationProvider implements AuthenticationProvider {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext updateUserContext(UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext decorate(UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext redecorate(UserContext decorated, UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,10 +22,9 @@ package org.apache.guacamole.auth.header;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.net.auth.AbstractAuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.Credentials;
|
||||
import org.apache.guacamole.net.auth.UserContext;
|
||||
|
||||
/**
|
||||
* Guacamole authentication backend which authenticates users using an
|
||||
@@ -33,7 +32,7 @@ import org.apache.guacamole.net.auth.UserContext;
|
||||
* provided - only authentication. Storage must be provided by some other
|
||||
* extension.
|
||||
*/
|
||||
public class HTTPHeaderAuthenticationProvider implements AuthenticationProvider {
|
||||
public class HTTPHeaderAuthenticationProvider extends AbstractAuthenticationProvider {
|
||||
|
||||
/**
|
||||
* Injector which will manage the object graph of this authentication
|
||||
@@ -63,11 +62,6 @@ public class HTTPHeaderAuthenticationProvider implements AuthenticationProvider
|
||||
return "header";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getResource() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser authenticateUser(Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
@@ -78,52 +72,4 @@ public class HTTPHeaderAuthenticationProvider implements AuthenticationProvider
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser updateAuthenticatedUser(
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
|
||||
// No update necessary
|
||||
return authenticatedUser;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext getUserContext(AuthenticatedUser authenticatedUser)
|
||||
throws GuacamoleException {
|
||||
|
||||
// No associated data whatsoever
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext updateUserContext(UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
|
||||
// No update necessary
|
||||
return context;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext decorate(UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext redecorate(UserContext decorated, UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ package org.apache.guacamole.auth.jdbc;
|
||||
|
||||
import com.google.inject.Injector;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.AbstractAuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.Credentials;
|
||||
import org.apache.guacamole.net.auth.UserContext;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
@@ -34,7 +34,7 @@ import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
* AuthenticationProvider, even though it is the AuthenticationProvider that
|
||||
* serves as the entry point.
|
||||
*/
|
||||
public abstract class InjectedAuthenticationProvider implements AuthenticationProvider {
|
||||
public abstract class InjectedAuthenticationProvider extends AbstractAuthenticationProvider {
|
||||
|
||||
/**
|
||||
* The AuthenticationProviderService to which all AuthenticationProvider
|
||||
@@ -70,26 +70,12 @@ public abstract class InjectedAuthenticationProvider implements AuthenticationPr
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getResource() throws GuacamoleException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser authenticateUser(Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return authProviderService.authenticateUser(this, credentials);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser updateAuthenticatedUser(AuthenticatedUser authenticatedUser,
|
||||
Credentials credentials) throws GuacamoleException {
|
||||
|
||||
// No need to update authenticated users
|
||||
return authenticatedUser;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext getUserContext(AuthenticatedUser authenticatedUser)
|
||||
throws GuacamoleException {
|
||||
@@ -104,23 +90,4 @@ public abstract class InjectedAuthenticationProvider implements AuthenticationPr
|
||||
authenticatedUser, credentials);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext decorate(UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext redecorate(UserContext decorated, UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -20,27 +20,16 @@
|
||||
package org.apache.guacamole.auth.jdbc.sharing.user;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.auth.jdbc.sharing.connection.SharedConnectionDirectory;
|
||||
import org.apache.guacamole.auth.jdbc.sharing.connectiongroup.SharedRootConnectionGroup;
|
||||
import org.apache.guacamole.auth.jdbc.user.RemoteAuthenticatedUser;
|
||||
import org.apache.guacamole.form.Form;
|
||||
import org.apache.guacamole.net.auth.ActiveConnection;
|
||||
import org.apache.guacamole.net.auth.ActivityRecord;
|
||||
import org.apache.guacamole.net.auth.ActivityRecordSet;
|
||||
import org.apache.guacamole.net.auth.AbstractUserContext;
|
||||
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.Connection;
|
||||
import org.apache.guacamole.net.auth.ConnectionGroup;
|
||||
import org.apache.guacamole.net.auth.ConnectionRecord;
|
||||
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.UserContext;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleActivityRecordSet;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleConnectionGroupDirectory;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleDirectory;
|
||||
|
||||
/**
|
||||
* The user context of a SharedUser, providing access ONLY to the user
|
||||
@@ -48,7 +37,7 @@ import org.apache.guacamole.net.auth.simple.SimpleDirectory;
|
||||
* keys, and an internal root connection group containing only those
|
||||
* connections.
|
||||
*/
|
||||
public class SharedUserContext implements UserContext {
|
||||
public class SharedUserContext extends AbstractUserContext {
|
||||
|
||||
/**
|
||||
* The AuthenticationProvider that created this SharedUserContext.
|
||||
@@ -67,18 +56,6 @@ public class SharedUserContext implements UserContext {
|
||||
@Inject
|
||||
private SharedConnectionDirectory connectionDirectory;
|
||||
|
||||
/**
|
||||
* A directory of all connection groups visible to the user for whom this
|
||||
* user context was created.
|
||||
*/
|
||||
private Directory<ConnectionGroup> connectionGroupDirectory;
|
||||
|
||||
/**
|
||||
* A directory of all users visible to the user for whom this user context
|
||||
* was created.
|
||||
*/
|
||||
private Directory<User> userDirectory;
|
||||
|
||||
/**
|
||||
* The root connection group of the hierarchy containing all connections
|
||||
* and connection groups visible to the user for whom this user context was
|
||||
@@ -110,15 +87,10 @@ public class SharedUserContext implements UserContext {
|
||||
|
||||
// The connection group directory contains only the root group
|
||||
this.rootGroup = new SharedRootConnectionGroup(this);
|
||||
this.connectionGroupDirectory = new SimpleConnectionGroupDirectory(
|
||||
Collections.singletonList(this.rootGroup));
|
||||
|
||||
// Create internal pseudo-account representing the authenticated user
|
||||
this.self = new SharedUser(user, this);
|
||||
|
||||
// Do not provide access to any user accounts via the directory
|
||||
this.userDirectory = new SimpleDirectory<User>();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,83 +110,20 @@ public class SharedUserContext implements UserContext {
|
||||
return self;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getResource() throws GuacamoleException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticationProvider getAuthenticationProvider() {
|
||||
return authProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Directory<User> getUserDirectory() {
|
||||
return userDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Directory<Connection> getConnectionDirectory()
|
||||
throws GuacamoleException {
|
||||
return connectionDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Directory<ConnectionGroup> getConnectionGroupDirectory() {
|
||||
return connectionGroupDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Directory<ActiveConnection> getActiveConnectionDirectory()
|
||||
throws GuacamoleException {
|
||||
return new SimpleDirectory<ActiveConnection>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Directory<SharingProfile> getSharingProfileDirectory()
|
||||
throws GuacamoleException {
|
||||
return new SimpleDirectory<SharingProfile>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivityRecordSet<ConnectionRecord> getConnectionHistory() {
|
||||
return new SimpleActivityRecordSet<ConnectionRecord>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivityRecordSet<ActivityRecord> getUserHistory()
|
||||
throws GuacamoleException {
|
||||
return new SimpleActivityRecordSet<ActivityRecord>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionGroup getRootConnectionGroup() {
|
||||
return rootGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Form> getUserAttributes() {
|
||||
return Collections.<Form>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Form> getConnectionAttributes() {
|
||||
return Collections.<Form>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Form> getConnectionGroupAttributes() {
|
||||
return Collections.<Form>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Form> getSharingProfileAttributes() {
|
||||
return Collections.<Form>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
// Nothing to invalidate
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,8 +23,8 @@ package org.apache.guacamole.auth.ldap;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.net.auth.AbstractAuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.Credentials;
|
||||
import org.apache.guacamole.net.auth.UserContext;
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.apache.guacamole.net.auth.UserContext;
|
||||
* any number of authorized configurations. Authorized configurations may be
|
||||
* shared.
|
||||
*/
|
||||
public class LDAPAuthenticationProvider implements AuthenticationProvider {
|
||||
public class LDAPAuthenticationProvider extends AbstractAuthenticationProvider {
|
||||
|
||||
/**
|
||||
* The identifier reserved for the root connection group.
|
||||
@@ -68,11 +68,6 @@ public class LDAPAuthenticationProvider implements AuthenticationProvider {
|
||||
return "ldap";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResource() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser authenticateUser(Credentials credentials) throws GuacamoleException {
|
||||
|
||||
@@ -81,12 +76,6 @@ public class LDAPAuthenticationProvider implements AuthenticationProvider {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser updateAuthenticatedUser(AuthenticatedUser authenticatedUser,
|
||||
Credentials credentials) throws GuacamoleException {
|
||||
return authenticatedUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext getUserContext(AuthenticatedUser authenticatedUser)
|
||||
throws GuacamoleException {
|
||||
@@ -96,31 +85,4 @@ public class LDAPAuthenticationProvider implements AuthenticationProvider {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext updateUserContext(UserContext context,
|
||||
AuthenticatedUser authenticatedUser,
|
||||
Credentials credentials) throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext decorate(UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext redecorate(UserContext decorated, UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -21,26 +21,18 @@ package org.apache.guacamole.auth.ldap.user;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.novell.ldap.LDAPConnection;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import org.apache.guacamole.auth.ldap.LDAPAuthenticationProvider;
|
||||
import org.apache.guacamole.auth.ldap.connection.ConnectionService;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.form.Form;
|
||||
import org.apache.guacamole.net.auth.ActiveConnection;
|
||||
import org.apache.guacamole.net.auth.ActivityRecord;
|
||||
import org.apache.guacamole.net.auth.ActivityRecordSet;
|
||||
import org.apache.guacamole.auth.ldap.LDAPAuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.AbstractUserContext;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.Connection;
|
||||
import org.apache.guacamole.net.auth.ConnectionGroup;
|
||||
import org.apache.guacamole.net.auth.ConnectionRecord;
|
||||
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.simple.SimpleActivityRecordSet;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleConnectionGroup;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleConnectionGroupDirectory;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleDirectory;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleUser;
|
||||
import org.slf4j.Logger;
|
||||
@@ -50,7 +42,7 @@ import org.slf4j.LoggerFactory;
|
||||
* An LDAP-specific implementation of UserContext which queries all Guacamole
|
||||
* connections and users from the LDAP directory.
|
||||
*/
|
||||
public class UserContext implements org.apache.guacamole.net.auth.UserContext {
|
||||
public class UserContext extends AbstractUserContext {
|
||||
|
||||
/**
|
||||
* Logger for this class.
|
||||
@@ -94,12 +86,6 @@ public class UserContext implements org.apache.guacamole.net.auth.UserContext {
|
||||
*/
|
||||
private Directory<Connection> connectionDirectory;
|
||||
|
||||
/**
|
||||
* Directory containing all ConnectionGroup objects accessible to the user
|
||||
* associated with this UserContext.
|
||||
*/
|
||||
private Directory<ConnectionGroup> connectionGroupDirectory;
|
||||
|
||||
/**
|
||||
* Reference to the root connection group.
|
||||
*/
|
||||
@@ -143,15 +129,12 @@ public class UserContext implements org.apache.guacamole.net.auth.UserContext {
|
||||
Collections.<String>emptyList()
|
||||
);
|
||||
|
||||
// Expose only the root group in the connection group directory
|
||||
connectionGroupDirectory = new SimpleConnectionGroupDirectory(Collections.singleton(rootGroup));
|
||||
|
||||
// Init self with basic permissions
|
||||
self = new SimpleUser(
|
||||
user.getIdentifier(),
|
||||
userDirectory.getIdentifiers(),
|
||||
connectionDirectory.getIdentifiers(),
|
||||
connectionGroupDirectory.getIdentifiers()
|
||||
Collections.singleton(LDAPAuthenticationProvider.ROOT_CONNECTION_GROUP)
|
||||
);
|
||||
|
||||
}
|
||||
@@ -161,11 +144,6 @@ public class UserContext implements org.apache.guacamole.net.auth.UserContext {
|
||||
return self;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResource() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticationProvider getAuthenticationProvider() {
|
||||
return authProvider;
|
||||
@@ -182,64 +160,9 @@ public class UserContext implements org.apache.guacamole.net.auth.UserContext {
|
||||
return connectionDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Directory<ConnectionGroup> getConnectionGroupDirectory()
|
||||
throws GuacamoleException {
|
||||
return connectionGroupDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionGroup getRootConnectionGroup() throws GuacamoleException {
|
||||
return rootGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Directory<ActiveConnection> getActiveConnectionDirectory()
|
||||
throws GuacamoleException {
|
||||
return new SimpleDirectory<ActiveConnection>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Directory<SharingProfile> getSharingProfileDirectory()
|
||||
throws GuacamoleException {
|
||||
return new SimpleDirectory<SharingProfile>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivityRecordSet<ConnectionRecord> getConnectionHistory()
|
||||
throws GuacamoleException {
|
||||
return new SimpleActivityRecordSet<ConnectionRecord>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivityRecordSet<ActivityRecord> getUserHistory()
|
||||
throws GuacamoleException {
|
||||
return new SimpleActivityRecordSet<ActivityRecord>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Form> getUserAttributes() {
|
||||
return Collections.<Form>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Form> getConnectionAttributes() {
|
||||
return Collections.<Form>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Form> getConnectionGroupAttributes() {
|
||||
return Collections.<Form>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Form> getSharingProfileAttributes() {
|
||||
return Collections.<Form>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
// Nothing to invalidate
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -22,10 +22,9 @@ package org.apache.guacamole.auth.openid;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.net.auth.AbstractAuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.Credentials;
|
||||
import org.apache.guacamole.net.auth.UserContext;
|
||||
|
||||
/**
|
||||
* Guacamole authentication backend which authenticates users using an
|
||||
@@ -33,7 +32,7 @@ import org.apache.guacamole.net.auth.UserContext;
|
||||
* provided - only authentication. Storage must be provided by some other
|
||||
* extension.
|
||||
*/
|
||||
public class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
||||
public class OpenIDAuthenticationProvider extends AbstractAuthenticationProvider {
|
||||
|
||||
/**
|
||||
* Injector which will manage the object graph of this authentication
|
||||
@@ -63,11 +62,6 @@ public class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
||||
return "openid";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getResource() throws GuacamoleException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser authenticateUser(Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
@@ -78,52 +72,4 @@ public class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser updateAuthenticatedUser(
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
|
||||
// No update necessary
|
||||
return authenticatedUser;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext getUserContext(AuthenticatedUser authenticatedUser)
|
||||
throws GuacamoleException {
|
||||
|
||||
// No associated data whatsoever
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext updateUserContext(UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
|
||||
// No update necessary
|
||||
return context;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext decorate(UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext redecorate(UserContext decorated, UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,17 +23,16 @@ package org.apache.guacamole.auth.radius;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.net.auth.AbstractAuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.Credentials;
|
||||
import org.apache.guacamole.net.auth.UserContext;
|
||||
|
||||
/**
|
||||
* Allows users to be authenticated against an RADIUS server. Each user may have
|
||||
* any number of authorized configurations. Authorized configurations may be
|
||||
* shared.
|
||||
*/
|
||||
public class RadiusAuthenticationProvider implements AuthenticationProvider {
|
||||
public class RadiusAuthenticationProvider extends AbstractAuthenticationProvider {
|
||||
|
||||
/**
|
||||
* Injector which will manage the object graph of this authentication
|
||||
@@ -63,30 +62,6 @@ public class RadiusAuthenticationProvider implements AuthenticationProvider {
|
||||
return "radius";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getResource() throws GuacamoleException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext decorate(UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext redecorate(UserContext decorated, UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser authenticateUser(Credentials credentials) throws GuacamoleException {
|
||||
|
||||
@@ -95,26 +70,4 @@ public class RadiusAuthenticationProvider implements AuthenticationProvider {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser updateAuthenticatedUser(AuthenticatedUser authenticatedUser,
|
||||
Credentials credentials) throws GuacamoleException {
|
||||
return authenticatedUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext getUserContext(AuthenticatedUser authenticatedUser)
|
||||
throws GuacamoleException {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext updateUserContext(UserContext context,
|
||||
AuthenticatedUser authenticatedUser,
|
||||
Credentials credentials) throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -25,8 +25,8 @@ import com.google.inject.Injector;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.auth.totp.user.CodeUsageTrackingService;
|
||||
import org.apache.guacamole.auth.totp.user.TOTPUserContext;
|
||||
import org.apache.guacamole.net.auth.AbstractAuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
||||
import org.apache.guacamole.net.auth.Credentials;
|
||||
import org.apache.guacamole.net.auth.UserContext;
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.apache.guacamole.net.auth.UserContext;
|
||||
* authentication factor for users which have already been authenticated by
|
||||
* some other AuthenticationProvider.
|
||||
*/
|
||||
public class TOTPAuthenticationProvider implements AuthenticationProvider {
|
||||
public class TOTPAuthenticationProvider extends AbstractAuthenticationProvider {
|
||||
|
||||
/**
|
||||
* Injector which will manage the object graph of this authentication
|
||||
@@ -64,36 +64,6 @@ public class TOTPAuthenticationProvider implements AuthenticationProvider {
|
||||
return "totp";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getResource() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser authenticateUser(Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthenticatedUser updateAuthenticatedUser(AuthenticatedUser authenticatedUser,
|
||||
Credentials credentials) throws GuacamoleException {
|
||||
return authenticatedUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext getUserContext(AuthenticatedUser authenticatedUser)
|
||||
throws GuacamoleException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext updateUserContext(UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
throws GuacamoleException {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext decorate(UserContext context,
|
||||
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||
|
Reference in New Issue
Block a user