Repository: guacamole-client
Updated Branches:
  refs/heads/staging/1.0.0 2fb377ac8 -> 72bc8c01a


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


Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/fb5d2723
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/fb5d2723
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/fb5d2723

Branch: refs/heads/staging/1.0.0
Commit: fb5d2723bcc7cad1585736e644e367d802082d29
Parents: 5c96cd6
Author: Nick Couchman <vn...@apache.org>
Authored: Sat Mar 24 21:58:19 2018 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Fri Jun 1 13:40:50 2018 -0400

----------------------------------------------------------------------
 .../QuickConnectAuthenticationProvider.java     | 53 +++++++++++++++++---
 1 file changed, 45 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/fb5d2723/extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/QuickConnectAuthenticationProvider.java
----------------------------------------------------------------------
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 c809709..d638ff8 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
@@ -68,20 +73,52 @@ public class QuickConnectAuthenticationProvider extends 
SimpleAuthenticationProv
     }
 
     @Override
-    public Map<String, GuacamoleConfiguration>
-        getAuthorizedConfigurations(Credentials credentials)
-        throws GuacamoleException {
+    public UserContext getUserContext(AuthenticatedUser authenticatedUser)
+            throws GuacamoleException {
 
-        return Collections.<String, GuacamoleConfiguration>emptyMap();
+        return new QuickConnectUserContext(this, 
authenticatedUser.getIdentifier());
 
     }
 
     @Override
-    public UserContext getUserContext(AuthenticatedUser authenticatedUser)
+    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 {
 
-        return new QuickConnectUserContext(this, 
authenticatedUser.getIdentifier());
+        // 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.
+    }
+
 }

Reply via email to