mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +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>
|
||||
</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 -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
|
@@ -39,7 +39,6 @@ import com.google.inject.Binder;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.name.Names;
|
||||
import java.util.Properties;
|
||||
import net.sourceforge.guacamole.GuacamoleException;
|
||||
@@ -57,6 +56,8 @@ import net.sourceforge.guacamole.properties.GuacamoleProperties;
|
||||
import org.mybatis.guice.MyBatisModule;
|
||||
import org.mybatis.guice.datasource.builtin.PooledDataSourceProvider;
|
||||
import org.mybatis.guice.datasource.helper.JdbcHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Provides a MySQL based implementation of the AuthenticationProvider
|
||||
@@ -65,13 +66,14 @@ import org.mybatis.guice.datasource.helper.JdbcHelper;
|
||||
*/
|
||||
public class MySQLAuthenticationProvider implements AuthenticationProvider {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(MySQLUserContext.class);
|
||||
|
||||
private Injector injector;
|
||||
private Credentials credentials;
|
||||
|
||||
@Override
|
||||
public UserContext getUserContext(Credentials credentials) throws GuacamoleException {
|
||||
this.credentials = credentials;
|
||||
UserContext context = injector.getInstance(UserContext.class);
|
||||
MySQLUserContext context = injector.getInstance(MySQLUserContext.class);
|
||||
context.init(credentials);
|
||||
return context;
|
||||
}
|
||||
|
||||
@@ -102,13 +104,7 @@ public class MySQLAuthenticationProvider implements AuthenticationProvider {
|
||||
addMapperClass(SystemPermissionMapper.class);
|
||||
addMapperClass(UserMapper.class);
|
||||
addMapperClass(UserPermissionMapper.class);
|
||||
bind(UserContext.class).to(MySQLUserContext.class);
|
||||
bind(Credentials.class).toProvider(new Provider<Credentials>() {
|
||||
@Override
|
||||
public Credentials get() {
|
||||
return credentials;
|
||||
}
|
||||
});
|
||||
bind(MySQLUserContext.class);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@@ -42,6 +42,8 @@ import net.sourceforge.guacamole.net.auth.Credentials;
|
||||
import net.sourceforge.guacamole.net.auth.Directory;
|
||||
import net.sourceforge.guacamole.net.auth.User;
|
||||
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 {
|
||||
|
||||
@Inject
|
||||
MySQLUserContext(Credentials credentials) {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(MySQLUserContext.class);
|
||||
|
||||
void init(Credentials credentials) {
|
||||
// load the required data with the provided credentials
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user