gbehrmann/xrootd4j — pull request #1 by gbehrmann (2011-11-26 17:29:36+00:00)
Title: Add Netty channel handlers for authentication and authorization

Most of the code is extracted from DataServerHandler (which got it from the dCache xrootd door). XrootdAuthenticationHandler and XrootdAuthorizationHandler are Netty channel handlers and are used in a channel pipeline. Each delegate the work to an AuthenticationHandler and AuthorizationHandler plugin, respectively.

XrootdAuthenticationHandler adds the Subject to each xrootd request before passing it on. XrootdAuthorizationHandler extracts the subject from the request and gives it to the authorization plugin.

The AuthorizationHandler interface is updated to no longer map Subjects - mapping Subjects in the AuthorizationHandler is inherently wrong as the handler works on paths and is invoked multiple times for some requests.

Refactoring the code into these two Netty handlers make it possible to reuse the code. It also proofs that Netty channel handlers can provide the functionality needed, allowing a more generic plugin mechanism to be added in the future. If per request Subject mapping is needed in the future then that functionality can be added as a new channel handler.

Part of this work was to refactor all the request messages. A positive side effect is that a lot of duplicated code is eliminated.