public DecoratedUserContext decorate(UserContext userContext,
            AuthenticatedUser authenticatedUser, Credentials credentials)
            throws GuacamoleAuthenticationProcessException {

        // Get first AuthenticationProvider in list
        Iterator<AuthenticationProvider> current = authProviders.iterator();
        if (!current.hasNext())
            return null;

        // Use first AuthenticationProvider to produce the root-level
        // decorated UserContext
        DecoratedUserContext decorated = new DecoratedUserContext(current.next(),
                userContext, authenticatedUser, credentials);

        // Repeatedly wrap the decorated UserContext with additional layers of
        // decoration for each remaining AuthenticationProvider
        while (current.hasNext()) {
            decorated = new DecoratedUserContext(current.next(), decorated,
                    authenticatedUser, credentials);
        }

        return decorated;

    }
Creates a new DecoratedUserContext, invoking the decorate() function
of all AuthenticationProviders to decorate the provided UserContext.
Decoration by each AuthenticationProvider will occur in the order that
the AuthenticationProviders were loaded. Only AuthenticationProviders
which did not originate the given UserContext will be used.

@param userContext
    The UserContext to decorate.

@param authenticatedUser
    The AuthenticatedUser identifying the user associated with the given
    UserContext.

@param credentials
    The credentials associated with the request which produced the given
    UserContext.

@return
    A new DecoratedUserContext which has been decorated by all
    AuthenticationProviders.

@throws GuacamoleAuthenticationProcessException
    If any AuthenticationProvider fails while decorating the UserContext.
guacamole/src/main/java/org/apache/guacamole/rest/auth/DecorationService.java