mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-38: Implement the AuthenticationProvider instead of extending another.
This commit is contained in:
@@ -23,10 +23,10 @@ import java.util.Collections;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
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.Credentials;
|
||||||
import org.apache.guacamole.net.auth.credentials.CredentialsInfo;
|
import org.apache.guacamole.net.auth.credentials.CredentialsInfo;
|
||||||
import org.apache.guacamole.net.auth.credentials.GuacamoleInvalidCredentialsException;
|
import org.apache.guacamole.net.auth.credentials.GuacamoleInvalidCredentialsException;
|
||||||
import org.apache.guacamole.net.auth.simple.SimpleAuthenticationProvider;
|
|
||||||
import org.apache.guacamole.net.auth.UserContext;
|
import org.apache.guacamole.net.auth.UserContext;
|
||||||
import org.apache.guacamole.protocol.GuacamoleConfiguration;
|
import org.apache.guacamole.protocol.GuacamoleConfiguration;
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ import org.apache.guacamole.protocol.GuacamoleConfiguration;
|
|||||||
* process so that the QuickConnect functionality can be initialized and be used
|
* process so that the QuickConnect functionality can be initialized and be used
|
||||||
* throughout the web client.
|
* throughout the web client.
|
||||||
*/
|
*/
|
||||||
public class QuickConnectAuthenticationProvider extends SimpleAuthenticationProvider {
|
public class QuickConnectAuthenticationProvider implements AuthenticationProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* userContext for this authentication provider.
|
* userContext for this authentication provider.
|
||||||
@@ -47,6 +47,11 @@ public class QuickConnectAuthenticationProvider extends SimpleAuthenticationProv
|
|||||||
return "quickconnect";
|
return "quickconnect";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getResource() throws GuacamoleException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For QuickConnect, authenticateUser simply returns null because this
|
* For QuickConnect, authenticateUser simply returns null because this
|
||||||
* extension is designed to provide only a connection directory to users
|
* extension is designed to provide only a connection directory to users
|
||||||
@@ -67,15 +72,6 @@ public class QuickConnectAuthenticationProvider extends SimpleAuthenticationProv
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, GuacamoleConfiguration>
|
|
||||||
getAuthorizedConfigurations(Credentials credentials)
|
|
||||||
throws GuacamoleException {
|
|
||||||
|
|
||||||
return Collections.<String, GuacamoleConfiguration>emptyMap();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserContext getUserContext(AuthenticatedUser authenticatedUser)
|
public UserContext getUserContext(AuthenticatedUser authenticatedUser)
|
||||||
throws GuacamoleException {
|
throws GuacamoleException {
|
||||||
@@ -84,4 +80,45 @@ public class QuickConnectAuthenticationProvider extends SimpleAuthenticationProv
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AuthenticatedUser updateAuthenticatedUser(AuthenticatedUser authenticatedUser,
|
||||||
|
Credentials credentials) throws GuacamoleException {
|
||||||
|
|
||||||
|
// Simply return the given user, updating nothing
|
||||||
|
return authenticatedUser;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserContext updateUserContext(UserContext context,
|
||||||
|
AuthenticatedUser authorizedUser, Credentials credentials)
|
||||||
|
throws GuacamoleException {
|
||||||
|
|
||||||
|
// Simply return the given context, updating nothing
|
||||||
|
return context;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserContext decorate(UserContext context,
|
||||||
|
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||||
|
throws GuacamoleException {
|
||||||
|
|
||||||
|
// Simply return the given context, decorating nothing
|
||||||
|
return context;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserContext redecorate(UserContext decorated, UserContext context,
|
||||||
|
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||||
|
throws GuacamoleException {
|
||||||
|
return decorate(context, authenticatedUser, credentials);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shutdown() {
|
||||||
|
// Nothing to do, here.
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user