# RestFilter, RestHandler, BaseRestHandler alternate Solution

**URL:** <https://discuss.elastic.co/t/restfilter-resthandler-baseresthandler-alternate-solution/148508>\
**Category:** Elasticsearch\
**Created:** [September 13, 2018, 7:37pm UTC](https://discuss.elastic.co/t/restfilter-resthandler-baseresthandler-alternate-solution/148508 "2018-09-13T19:37:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arul\_since1975](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@arul\_since1975](https://discuss.elastic.co/u/arul_since1975)\
**Post date:** [September 13, 2018, 7:37pm UTC](https://discuss.elastic.co/t/restfilter-resthandler-baseresthandler-alternate-solution/148508/1 "2018-09-13T19:37:26Z")

</div>

Hi all,

I have an Authentication plugin written in ES 5.1 has the following Classes.

1. Public Class SecurityFilter extends RestFilter  
Where  
public void process(final RestRequest request, final RestChannel channel, final NodeClient client,  
final RestFilterChain filterChain) {  
Does some validation and forward the request to Handlers using  
filterChain.continueProcessing(request, channel, client);

2. Public Class RoleAction implements RestHandler

3. Public Class DefaultAction implements RestHandler

4. Public Class UserAction implements RestHandler

And the SecurityFilter was registered using  
RestController.registerFilter method.

With the above setting, SecurityFilter receives the request first and forwards to Respective Handlers.

With ES5.6 upgrade, Support for  
RestFilter and RestController.registerFilter has been been removed.

My question is whether the following code alternate is correct for ES 5.6 upgrade

#1. Public Class SecurityFilter implements RestHandler  
Where  
public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) {  
Need to same validation and forward the request to Handlers.

How do I register the SecurityFilter as the initial Entry point as all other action Classes are also RestHandlers

#2. In case if #1 is correct way of doing it, how do I forward the request to other Handlers once Authentication is done.

Have been stuck with this code for quiet a while and didnt have any solution.  
Could you please guide?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 11, 2018, 7:37pm UTC](https://discuss.elastic.co/t/restfilter-resthandler-baseresthandler-alternate-solution/148508/2 "2018-10-11T19:37:32Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
