GUACAMOLE-38: Implement the AuthenticationProvider instead of extending another.

This commit is contained in:
Nick Couchman
2018-03-24 21:58:19 -04:00
parent 5c96cd6326
commit fb5d2723bc

View File

@@ -23,10 +23,10 @@ import java.util.Collections;
import java.util.Map;
import org.apache.guacamole.GuacamoleException;
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.CredentialsInfo;
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.protocol.GuacamoleConfiguration;
@@ -35,7 +35,7 @@ import org.apache.guacamole.protocol.GuacamoleConfiguration;
* process so that the QuickConnect functionality can be initialized and be used
* throughout the web client.
*/
public class QuickConnectAuthenticationProvider extends SimpleAuthenticationProvider {
public class QuickConnectAuthenticationProvider implements AuthenticationProvider {
/**
* userContext for this authentication provider.
@@ -47,6 +47,11 @@ public class QuickConnectAuthenticationProvider extends SimpleAuthenticationProv
return "quickconnect";
}
@Override
public Object getResource() throws GuacamoleException {
return null;
}
/**
* For QuickConnect, authenticateUser simply returns null because this
* 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
public UserContext getUserContext(AuthenticatedUser authenticatedUser)
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.
}
}