public SharedAuthenticatedUser retrieveSharedConnectionUser(
            AuthenticationProvider authProvider, Credentials credentials) {

        // Validate the share key
        String shareKey = getShareKey(credentials);
        if (shareKey == null || connectionMap.get(shareKey) == null)
            return null;

        // Return temporary in-memory user
        return new SharedAuthenticatedUser(authProvider, credentials, shareKey);

    }
Returns a SharedAuthenticatedUser if the given credentials contain a
valid share key. The returned user will be associated with the single
shared connection to which they have been granted temporary access. If
the share key is invalid, or no share key is contained within the given
credentials, null is returned.

@param authProvider
    The AuthenticationProvider on behalf of which the user is being
    retrieved.

@param credentials
    The credentials which are expected to contain the share key.

@return
    A SharedAuthenticatedUser with access to a single shared connection,
    if the share key within the given credentials is valid, or null if
    the share key is invalid or absent.
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/ConnectionSharingService.java