mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-5: Do not bind/inject AuthenticationProvider.
This commit is contained in:
@@ -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.SharingProfileParameterMapper;
|
||||||
import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileService;
|
import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileService;
|
||||||
import org.apache.guacamole.auth.jdbc.tunnel.RestrictedGuacamoleTunnelService;
|
import org.apache.guacamole.auth.jdbc.tunnel.RestrictedGuacamoleTunnelService;
|
||||||
import org.apache.guacamole.net.auth.AuthenticationProvider;
|
|
||||||
import org.mybatis.guice.MyBatisModule;
|
import org.mybatis.guice.MyBatisModule;
|
||||||
import org.mybatis.guice.datasource.builtin.PooledDataSourceProvider;
|
import org.mybatis.guice.datasource.builtin.PooledDataSourceProvider;
|
||||||
|
|
||||||
@@ -93,27 +92,15 @@ public class JDBCAuthenticationProviderModule extends MyBatisModule {
|
|||||||
*/
|
*/
|
||||||
private final JDBCEnvironment environment;
|
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
|
* Creates a new JDBC authentication provider module that configures the
|
||||||
* various injected base classes using the given environment, and provides
|
* various injected base classes using the given environment, and provides
|
||||||
* connections using the given socket service.
|
* connections using the given socket service.
|
||||||
*
|
*
|
||||||
* @param authProvider
|
|
||||||
* The AuthenticationProvider which is using this module to configure
|
|
||||||
* injection.
|
|
||||||
*
|
|
||||||
* @param environment
|
* @param environment
|
||||||
* The environment to use to configure injected classes.
|
* The environment to use to configure injected classes.
|
||||||
*/
|
*/
|
||||||
public JDBCAuthenticationProviderModule(AuthenticationProvider authProvider,
|
public JDBCAuthenticationProviderModule(JDBCEnvironment environment) {
|
||||||
JDBCEnvironment environment) {
|
|
||||||
this.authProvider = authProvider;
|
|
||||||
this.environment = environment;
|
this.environment = environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +130,6 @@ public class JDBCAuthenticationProviderModule extends MyBatisModule {
|
|||||||
// Bind core implementations of guacamole-ext classes
|
// Bind core implementations of guacamole-ext classes
|
||||||
bind(ActiveConnectionDirectory.class);
|
bind(ActiveConnectionDirectory.class);
|
||||||
bind(ActiveConnectionPermissionSet.class);
|
bind(ActiveConnectionPermissionSet.class);
|
||||||
bind(AuthenticationProvider.class).toInstance(authProvider);
|
|
||||||
bind(JDBCEnvironment.class).toInstance(environment);
|
bind(JDBCEnvironment.class).toInstance(environment);
|
||||||
bind(ConnectionDirectory.class);
|
bind(ConnectionDirectory.class);
|
||||||
bind(ConnectionGroupDirectory.class);
|
bind(ConnectionGroupDirectory.class);
|
||||||
|
@@ -61,7 +61,6 @@ public class SharedConnectionUserContext implements UserContext {
|
|||||||
/**
|
/**
|
||||||
* The AuthenticationProvider that created this SharedConnectionUserContext.
|
* The AuthenticationProvider that created this SharedConnectionUserContext.
|
||||||
*/
|
*/
|
||||||
@Inject
|
|
||||||
private AuthenticationProvider authProvider;
|
private AuthenticationProvider authProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -118,6 +117,9 @@ public class SharedConnectionUserContext implements UserContext {
|
|||||||
Collection<String> connectionIdentifiers =
|
Collection<String> connectionIdentifiers =
|
||||||
Collections.singletonList(connection.getIdentifier());
|
Collections.singletonList(connection.getIdentifier());
|
||||||
|
|
||||||
|
// Associate the originating authentication provider
|
||||||
|
this.authProvider = user.getAuthenticationProvider();
|
||||||
|
|
||||||
// The connection directory should contain only the shared connection
|
// The connection directory should contain only the shared connection
|
||||||
this.connectionDirectory = new SimpleConnectionDirectory(
|
this.connectionDirectory = new SimpleConnectionDirectory(
|
||||||
Collections.<Connection>singletonList(connection));
|
Collections.<Connection>singletonList(connection));
|
||||||
|
@@ -53,12 +53,6 @@ import org.apache.guacamole.net.auth.User;
|
|||||||
public class UserContext extends RestrictedObject
|
public class UserContext extends RestrictedObject
|
||||||
implements org.apache.guacamole.net.auth.UserContext {
|
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
|
* User directory restricted by the permissions of the user associated
|
||||||
* with this context.
|
* with this context.
|
||||||
@@ -127,7 +121,7 @@ public class UserContext extends RestrictedObject
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AuthenticationProvider getAuthenticationProvider() {
|
public AuthenticationProvider getAuthenticationProvider() {
|
||||||
return authProvider;
|
return getCurrentUser().getAuthenticationProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -65,7 +65,7 @@ public class MySQLAuthenticationProvider implements AuthenticationProvider {
|
|||||||
new MySQLAuthenticationProviderModule(environment),
|
new MySQLAuthenticationProviderModule(environment),
|
||||||
|
|
||||||
// Configure JDBC authentication core
|
// Configure JDBC authentication core
|
||||||
new JDBCAuthenticationProviderModule(this, environment)
|
new JDBCAuthenticationProviderModule(environment)
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -26,7 +26,6 @@ import org.apache.guacamole.net.auth.AuthenticationProvider;
|
|||||||
import org.apache.guacamole.net.auth.Credentials;
|
import org.apache.guacamole.net.auth.Credentials;
|
||||||
import org.apache.guacamole.net.auth.UserContext;
|
import org.apache.guacamole.net.auth.UserContext;
|
||||||
import org.apache.guacamole.auth.jdbc.JDBCAuthenticationProviderModule;
|
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.auth.jdbc.user.AuthenticationProviderService;
|
||||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -73,7 +72,7 @@ public class PostgreSQLAuthenticationProvider implements AuthenticationProvider
|
|||||||
new PostgreSQLAuthenticationProviderModule(environment),
|
new PostgreSQLAuthenticationProviderModule(environment),
|
||||||
|
|
||||||
// Configure JDBC authentication core
|
// Configure JDBC authentication core
|
||||||
new JDBCAuthenticationProviderModule(this, environment)
|
new JDBCAuthenticationProviderModule(environment)
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user