I am creating a RESTful web service using Apache CXF. I want to do an authentication of requests to resources that are annotated with @Authenticate. For this I intend to write a post matching ContainerRequestFilter and validate the request and do ContainerRequestContext.abortWith(javax.ws.rs.core.Response) if the authentication failed. However I only want to do authentication for resources that are annotated with @Authenticate.
The problem is I can't find out how to get access to the matched resource. I know I can use CXF interceptors to do it, but I want to stick with what JAX-RS 2.0 provides. I saw in another post that you can use the below in Rest-easy
ResourceMethodInvoker methodInvoker = (ResourceMethodInvoker)
requestContext.getProperty("org.jboss.resteasy.core.ResourceMethodInvoker");
Method method = methodInvoker.getMethod();
Can a similar approach be done in CXF?
Thanks