GitHub user ceharris opened a pull request:
https://github.com/apache/incubator-guacamole-client/pull/184
GUACAMOLE-364: authentication and tunnel listener extension support
This PR adds support for extensions that include listeners that implement
the interfaces declared in the `org.apache.guacamole.ext.net.event.listener`
package of the guacamole-ext module of the client.
The fully-qualified names of classes that implement one or more of these
listener interfaces are configured in the extension manifest using the
`listeners` property. Listener classes are wrapped in a facade in a fashion
similar to that used for authentication providers. A `ListenerService` is
registered as a Guice service (in `RESTServiceModule`) and injected into the
`AuthenticationService` and `TunnelRequestService`. The `ListenerService` is
used to notify all bound listeners in each of the situations in which a
listener is to be notified.
I made some assumptions about the desired semantics of the boolean return
value of some of the listener methods in the presence of multiple listeners,
since the expected behavior isn't really expressed in the contract of the
listener interfaces. Similarly, I made assumptions about the effect of listener
exceptions. I describe the behavior in the `ListenerService` Javadoc, although
it should probably be documented as part of the extension API. My assumptions
could obviously be revisited and the implementation adjusted, as well.
I used a fairly simplistic approach to loading and binding listeners. The
facade that wraps an extension listener class implements all of the existing
listener interfaces, and uses `instanceof` to determine whether the delegate
listener actually implements a given interface. This probably works well enough
for a small number of event types with a reasonably small number of listeners,
but should be revisited if either of these assumptions changes.
I was a little uncertain of what should happen WRT authentication listener
notification on a re-authentication. I decided that notifying listeners of the
re-authentication success was what was intended. See
`AuthenticationService.getAuthenticatedUser` around line 290.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/soulwing/incubator-guacamole-client
GUACAMOLE-364
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-guacamole-client/pull/184.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #184
----
commit 287ab56f0f793190522e9d173f3fbd61c9155919
Author: Carl Harris <[email protected]>
Date: 2017-08-16T10:52:10Z
GUACAMOLE-364: factor out common provider class instantiation support
This will allow the same error and debug logging to be used both
for the AuthenticationProviderFacade and a new ListenerFacade.
commit 6f89a0b53047dd1cc9fac8264639c30067bf6cb6
Author: Carl Harris <[email protected]>
Date: 2017-08-16T10:54:16Z
GUACAMOLE-364: listener interfaces now extend a common marker interface
commit dca7862351fd4c27e82ecaf1cf540180501f48ec
Author: Carl Harris <[email protected]>
Date: 2017-08-16T10:54:55Z
GUACAMOLE-364: add facade used to wrap extension listeners
commit 109d57ecb372c3fc8114792086f339e9269eaf98
Author: Carl Harris <[email protected]>
Date: 2017-08-16T10:55:28Z
GUACAMOLE-364: add extension module support for event listeners
commit cfb879b763b4254ba1c44b38d7fb5993b3e62187
Author: Carl Harris <[email protected]>
Date: 2017-08-16T10:57:16Z
GUACAMOLE-364: add injectable ListenerService
commit 5a232f6825deb9b73f89473f941d92d012e36f67
Author: Carl Harris <[email protected]>
Date: 2017-08-16T10:58:18Z
GUACAMOLE-364: notify authentication listeners in AuthenticationService
commit 6b6340ac464e03cc2a7bb8e9f72f8044e79beed6
Author: Carl Harris <[email protected]>
Date: 2017-08-16T10:59:12Z
GUACAMOLE-364: notify tunnel listeners in TunnelRequestService
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---