mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
Ticket #269: Fixed synchronization issues by not trying to inject Credentials. Also included logger.
This commit is contained in:
@@ -67,6 +67,19 @@
|
|||||||
<version>0.8.0</version>
|
<version>0.8.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SLF4J - logging -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>1.6.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-jcl</artifactId>
|
||||||
|
<version>1.6.1</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- MyBatis -->
|
<!-- MyBatis -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis</groupId>
|
<groupId>org.mybatis</groupId>
|
||||||
|
@@ -39,7 +39,6 @@ import com.google.inject.Binder;
|
|||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
import com.google.inject.Provider;
|
|
||||||
import com.google.inject.name.Names;
|
import com.google.inject.name.Names;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import net.sourceforge.guacamole.GuacamoleException;
|
import net.sourceforge.guacamole.GuacamoleException;
|
||||||
@@ -57,6 +56,8 @@ import net.sourceforge.guacamole.properties.GuacamoleProperties;
|
|||||||
import org.mybatis.guice.MyBatisModule;
|
import org.mybatis.guice.MyBatisModule;
|
||||||
import org.mybatis.guice.datasource.builtin.PooledDataSourceProvider;
|
import org.mybatis.guice.datasource.builtin.PooledDataSourceProvider;
|
||||||
import org.mybatis.guice.datasource.helper.JdbcHelper;
|
import org.mybatis.guice.datasource.helper.JdbcHelper;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a MySQL based implementation of the AuthenticationProvider
|
* Provides a MySQL based implementation of the AuthenticationProvider
|
||||||
@@ -65,13 +66,14 @@ import org.mybatis.guice.datasource.helper.JdbcHelper;
|
|||||||
*/
|
*/
|
||||||
public class MySQLAuthenticationProvider implements AuthenticationProvider {
|
public class MySQLAuthenticationProvider implements AuthenticationProvider {
|
||||||
|
|
||||||
|
private Logger logger = LoggerFactory.getLogger(MySQLUserContext.class);
|
||||||
|
|
||||||
private Injector injector;
|
private Injector injector;
|
||||||
private Credentials credentials;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserContext getUserContext(Credentials credentials) throws GuacamoleException {
|
public UserContext getUserContext(Credentials credentials) throws GuacamoleException {
|
||||||
this.credentials = credentials;
|
MySQLUserContext context = injector.getInstance(MySQLUserContext.class);
|
||||||
UserContext context = injector.getInstance(UserContext.class);
|
context.init(credentials);
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,13 +104,7 @@ public class MySQLAuthenticationProvider implements AuthenticationProvider {
|
|||||||
addMapperClass(SystemPermissionMapper.class);
|
addMapperClass(SystemPermissionMapper.class);
|
||||||
addMapperClass(UserMapper.class);
|
addMapperClass(UserMapper.class);
|
||||||
addMapperClass(UserPermissionMapper.class);
|
addMapperClass(UserPermissionMapper.class);
|
||||||
bind(UserContext.class).to(MySQLUserContext.class);
|
bind(MySQLUserContext.class);
|
||||||
bind(Credentials.class).toProvider(new Provider<Credentials>() {
|
|
||||||
@Override
|
|
||||||
public Credentials get() {
|
|
||||||
return credentials;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@@ -42,6 +42,8 @@ import net.sourceforge.guacamole.net.auth.Credentials;
|
|||||||
import net.sourceforge.guacamole.net.auth.Directory;
|
import net.sourceforge.guacamole.net.auth.Directory;
|
||||||
import net.sourceforge.guacamole.net.auth.User;
|
import net.sourceforge.guacamole.net.auth.User;
|
||||||
import net.sourceforge.guacamole.net.auth.UserContext;
|
import net.sourceforge.guacamole.net.auth.UserContext;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -49,9 +51,10 @@ import net.sourceforge.guacamole.net.auth.UserContext;
|
|||||||
*/
|
*/
|
||||||
public class MySQLUserContext implements UserContext {
|
public class MySQLUserContext implements UserContext {
|
||||||
|
|
||||||
@Inject
|
private Logger logger = LoggerFactory.getLogger(MySQLUserContext.class);
|
||||||
MySQLUserContext(Credentials credentials) {
|
|
||||||
|
void init(Credentials credentials) {
|
||||||
|
// load the required data with the provided credentials
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user