GUACAMOLE-5: Do not bind/inject AuthenticationProvider.

This commit is contained in:
Michael Jumper
2016-07-26 21:21:17 -07:00
parent 7325b7e9c9
commit cadaefa5f6
5 changed files with 7 additions and 26 deletions

View File

@@ -74,7 +74,6 @@ import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileMapper;
import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileParameterMapper;
import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileService;
import org.apache.guacamole.auth.jdbc.tunnel.RestrictedGuacamoleTunnelService;
import org.apache.guacamole.net.auth.AuthenticationProvider;
import org.mybatis.guice.MyBatisModule;
import org.mybatis.guice.datasource.builtin.PooledDataSourceProvider;
@@ -93,27 +92,15 @@ public class JDBCAuthenticationProviderModule extends MyBatisModule {
*/
private final JDBCEnvironment environment;
/**
* The AuthenticationProvider which is using this module to configure
* injection.
*/
private final AuthenticationProvider authProvider;
/**
* Creates a new JDBC authentication provider module that configures the
* various injected base classes using the given environment, and provides
* connections using the given socket service.
*
* @param authProvider
* The AuthenticationProvider which is using this module to configure
* injection.
*
* @param environment
* The environment to use to configure injected classes.
*/
public JDBCAuthenticationProviderModule(AuthenticationProvider authProvider,
JDBCEnvironment environment) {
this.authProvider = authProvider;
public JDBCAuthenticationProviderModule(JDBCEnvironment environment) {
this.environment = environment;
}
@@ -143,7 +130,6 @@ public class JDBCAuthenticationProviderModule extends MyBatisModule {
// Bind core implementations of guacamole-ext classes
bind(ActiveConnectionDirectory.class);
bind(ActiveConnectionPermissionSet.class);
bind(AuthenticationProvider.class).toInstance(authProvider);
bind(JDBCEnvironment.class).toInstance(environment);
bind(ConnectionDirectory.class);
bind(ConnectionGroupDirectory.class);

View File

@@ -61,7 +61,6 @@ public class SharedConnectionUserContext implements UserContext {
/**
* The AuthenticationProvider that created this SharedConnectionUserContext.
*/
@Inject
private AuthenticationProvider authProvider;
/**
@@ -118,6 +117,9 @@ public class SharedConnectionUserContext implements UserContext {
Collection<String> connectionIdentifiers =
Collections.singletonList(connection.getIdentifier());
// Associate the originating authentication provider
this.authProvider = user.getAuthenticationProvider();
// The connection directory should contain only the shared connection
this.connectionDirectory = new SimpleConnectionDirectory(
Collections.<Connection>singletonList(connection));

View File

@@ -53,12 +53,6 @@ import org.apache.guacamole.net.auth.User;
public class UserContext extends RestrictedObject
implements org.apache.guacamole.net.auth.UserContext {
/**
* The AuthenticationProvider that created this UserContext.
*/
@Inject
private AuthenticationProvider authProvider;
/**
* User directory restricted by the permissions of the user associated
* with this context.
@@ -127,7 +121,7 @@ public class UserContext extends RestrictedObject
@Override
public AuthenticationProvider getAuthenticationProvider() {
return authProvider;
return getCurrentUser().getAuthenticationProvider();
}
@Override

View File

@@ -65,7 +65,7 @@ public class MySQLAuthenticationProvider implements AuthenticationProvider {
new MySQLAuthenticationProviderModule(environment),
// Configure JDBC authentication core
new JDBCAuthenticationProviderModule(this, environment)
new JDBCAuthenticationProviderModule(environment)
);

View File

@@ -26,7 +26,6 @@ import org.apache.guacamole.net.auth.AuthenticationProvider;
import org.apache.guacamole.net.auth.Credentials;
import org.apache.guacamole.net.auth.UserContext;
import org.apache.guacamole.auth.jdbc.JDBCAuthenticationProviderModule;
import org.apache.guacamole.auth.jdbc.JDBCEnvironment;
import org.apache.guacamole.auth.jdbc.user.AuthenticationProviderService;
import org.apache.guacamole.net.auth.AuthenticatedUser;
import org.slf4j.Logger;
@@ -73,7 +72,7 @@ public class PostgreSQLAuthenticationProvider implements AuthenticationProvider
new PostgreSQLAuthenticationProviderModule(environment),
// Configure JDBC authentication core
new JDBCAuthenticationProviderModule(this, environment)
new JDBCAuthenticationProviderModule(environment)
);