diff --git a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLAuthenticationProvider.java b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLAuthenticationProvider.java index fa328c4cd..122e18ef6 100644 --- a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLAuthenticationProvider.java +++ b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLAuthenticationProvider.java @@ -179,4 +179,13 @@ public class MySQLAuthenticationProvider implements AuthenticationProvider { ); } // end of constructor + @Override + public UserContext updateUserContext(UserContext context, + Credentials credentials) throws GuacamoleException { + + // No need to update the context + return context; + + } + } diff --git a/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/AuthenticationProvider.java b/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/AuthenticationProvider.java index 7fd72829c..794a107ef 100644 --- a/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/AuthenticationProvider.java +++ b/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/AuthenticationProvider.java @@ -62,4 +62,25 @@ public interface AuthenticationProvider { UserContext getUserContext(Credentials credentials) throws GuacamoleException; + /** + * Returns a new or updated UserContext for the user authorized by the + * give credentials and having the given existing UserContext. Note that + * because this function will be called for all future requests after + * initial authentication, including tunnel requests, care must be taken + * to avoid using functions of HttpServletRequest which invalidate the + * entire request body, such as getParameter(). + * + * @param context The existing UserContext belonging to the user in + * question. + * @param credentials The credentials to use to retrieve or update the + * environment. + * @return The updated UserContext, which need not be the same as the + * UserContext given, or null if the user is no longer authorized. + * + * @throws GuacamoleException If an error occurs while updating the + * UserContext. + */ + UserContext updateUserContext(UserContext context, Credentials credentials) + throws GuacamoleException; + } diff --git a/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/simple/SimpleAuthenticationProvider.java b/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/simple/SimpleAuthenticationProvider.java index ebd9ed331..3be2c374f 100644 --- a/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/simple/SimpleAuthenticationProvider.java +++ b/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/simple/SimpleAuthenticationProvider.java @@ -97,4 +97,13 @@ public abstract class SimpleAuthenticationProvider } + @Override + public UserContext updateUserContext(UserContext context, + Credentials credentials) throws GuacamoleException { + + // Simply return the given context, updating nothing + return context; + + } + }