Basic Authentication using RestFilter

Thanks for your reply @s1monw.

My main concern is - RestController api doesn't support 'registerFilter' method anymore as shown below

@Inject
public AuthenticationHandler(Settings settings, RestController controller) {
super(settings);
controller.registerFilter(new AuthenticationFilter());
}

And also, RestFilter class is also removed from elasticsearch API, so I cant extend this class and create a custom filter class as shown below,

public class AuthenticationFilter extends RestFilter {
}

I'm trying to follow the example given in below post,

but because of above mentioned two clarifications, not sure how to proceed, please.

Could you please explain with an example or sudo code - I'm new to elasticsearch.

Many thanks in advance.