Hi,

see code below..
I've tried to replace the throwing of the GuacamoleException to
GuacamoleClientException and still no error shown to user.
just to make the scenario more clear..
we are not using the guacamole for authenticating our users.
Our AuthenticationProvider accept any user who has link to the guac client,
means once the user get access link he can use it to ssh/rdp (we are setting
the GuacamoleConfiguration for him with the right parameters), we just want
to validate the link and show an error in case something is wrong.

public class CustomAuthProvider implements AuthenticationProvider{

    public String getIdentifier() {
         return "my-auth";
    }

    public Object getResource() throws GuacamoleException {
        return null;
    }

    public AuthenticatedUser authenticateUser(Credentials credentials)
throws GuacamoleException {
        try {
           //url param validation
        }
        catch (GuacamoleException ex)
        {
            logger.error("fail to authenticateUser", ex);
            throw ex;
        }
        catch (Exception ex) {
            logger.error("fail to authenticateUser", ex);
            throw new GuacamoleException(ex);
        }
    }


    public AuthenticatedUser updateAuthenticatedUser(AuthenticatedUser
authenticatedUser, Credentials credentials) throws GuacamoleException {
       return authenticatedUser;
    }

    public UserContext getUserContext(AuthenticatedUser authenticatedUser)
throws GuacamoleException {
        try {
            AnonymousAuthenticatedUser anonymousAuthenticatedUser =
(AnonymousAuthenticatedUser) authenticatedUser;
            GuacamoleConfiguration config =
anonymousAuthenticatedUser.config;
            Map<String, GuacamoleConfiguration> configs = new
HashMap<String, GuacamoleConfiguration>();
            String configId = UUID.randomUUID().toString();
            configs.put(configId, config);
            SimpleUserContext context = new SimpleUserContext(this,
anonymousAuthenticatedUser.getIdentifier(), configs);
            return context;
         }
        catch (Exception e) {
            logger.error("fail to getUserContext", e);
            throw new GuacamoleException(e);
        }
    }

    public UserContext updateUserContext(UserContext userContext,
AuthenticatedUser authenticatedUser, Credentials credentials) throws
GuacamoleException {
        return userContext;
    }


    public class AnonymousAuthenticatedUser extends
AbstractAuthenticatedUser {

        private final GuacamoleConfiguration config;
        private final CustomAuthProvider customAuthProvider;
        private Credentials credentials;

        public AnonymousAuthenticatedUser(CustomAuthProvider
customAuthProvider, GuacamoleConfiguration config,Credentials credentials) {
            this.config = config;
            this.customAuthProvider = customAuthProvider;
            this.credentials = credentials;
            setIdentifier(ANONYMOUS_IDENTIFIER);
        }
        public GuacamoleConfiguration getAuthorizedConfiguration() {
            return config;
        }

        public AuthenticationProvider getAuthenticationProvider() {
            return customAuthProvider;
        }

        public Credentials getCredentials() {
            return credentials;
        }
    }
}




--
Sent from: http://apache-guacamole-incubating-users.2363388.n4.nabble.com/

Reply via email to