public DecoratedUserContext getUserContext(String authProviderIdentifier)
            throws GuacamoleException {

        // Locate and return the UserContext associated with the
        // AuthenticationProvider having the given identifier, if any
        for (DecoratedUserContext userContext : getUserContexts()) {

            // Get AuthenticationProvider associated with current UserContext
            AuthenticationProvider authProvider = userContext.getAuthenticationProvider();

            // If AuthenticationProvider identifier matches, done
            if (authProvider.getIdentifier().equals(authProviderIdentifier))
                return userContext;

        }

        throw new GuacamoleResourceNotFoundException("Session not associated "
                + "with authentication provider \"" + authProviderIdentifier + "\".");


    }
Returns the UserContext associated with this session that originated
from the AuthenticationProvider with the given identifier. If no such
UserContext exists, an exception is thrown. Invoking this function
automatically updates this session's last access time.

@param authProviderIdentifier
    The unique identifier of the AuthenticationProvider that created the
    UserContext being retrieved.

@return
    The UserContext that was created by the AuthenticationProvider
    having the given identifier.

@throws GuacamoleException
    If no such UserContext exists.
guacamole/src/main/java/org/apache/guacamole/GuacamoleSession.java