[ 
https://issues.apache.org/jira/browse/SHINDIG-792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12658882#action_12658882
 ] 

Henning Schmiedehausen commented on SHINDIG-792:
------------------------------------------------

Uhm, why should I want this? The current AuthenticationModule can be trivially 
replaced with

bind(new TypeLiteral<List<AuthenticationHandler>>() {}).toProvider(new 
ArrayListProvider<AuthenticationHandler>()
           .add(UrlParameterAuthenticationHandler.class)
           .add(AnonymousAuthenticationHandler.class));

thus removing the need for the whole module. And having the classes used here 
being extensible, it is easier to leverage new functionality without writing 
new code. Given your example, I have to write two new classes 
(MyAuthenticationHandler and MyAuthenticationModule) compared to a lone class 
which overrides a single method and a bind() in my module.

If it is a recommended practice to do otherwise, where is it recommended? ;-) 



> UrlParameterAuthenticationHandler is not extensible
> ---------------------------------------------------
>
>                 Key: SHINDIG-792
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-792
>             Project: Shindig
>          Issue Type: Improvement
>          Components: Gadget Rendering Server (Java)
>    Affects Versions: 1.0.x-incubating
>            Reporter: Henning Schmiedehausen
>         Attachments: SHINDIG-792.patch
>
>
> The URLParameterAuthenticationHandler is injected at some places inside the 
> Shindig codebase (AuthenticationModule, AuthenticationHandlerProvider) so to 
> override it, one must extend it. However, the class itself is not really 
> extensible. With this patch, it is possible to do e.g. the following thing:
> --- cut ---
> public class MyAuthenticationHandler extends UrlParameterAuthenticationHandler
> {
>     @Inject
>     public NingAuthenticationHandler(SecurityTokenDecoder 
> securityTokenDecoder)
>     {
>         super(securityTokenDecoder);
>     }
>     @Override
>     protected Map<String, String> getMappedParameters(final 
> HttpServletRequest req) {
>         final Map<String, String> params = new HashMap<String, 
> String>(super.getMappedParameters(req));
>         params.put("param1", req.getParameter("param1"));
>         params.put("param2", req.getParameter("param2"));
>         params.put("param3", req.getParameter("param3"));
>         return params;
>     }
> }
> --- cut ---
> Which in concert with the injected SecurityTokenDecoder allows custom 
> decoding. Else, the whole injection of the token decoder is moot because you 
> can't pass additional parameters into it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to