From fb5d2723bcc7cad1585736e644e367d802082d29 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Sat, 24 Mar 2018 21:58:19 -0400 Subject: [PATCH] GUACAMOLE-38: Implement the AuthenticationProvider instead of extending another. --- .../QuickConnectAuthenticationProvider.java | 59 +++++++++++++++---- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectAuthenticationProvider.java b/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectAuthenticationProvider.java index c8097094a..d638ff847 100644 --- a/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectAuthenticationProvider.java +++ b/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectAuthenticationProvider.java @@ -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 - getAuthorizedConfigurations(Credentials credentials) - throws GuacamoleException { - - return Collections.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. + } + }