hstaudacher / osgi-jax-rs-connector

An OSGi - JAX-RS 2.0 Connector, software repository available on the link below
http://hstaudacher.github.io/osgi-jax-rs-connector
Other
190 stars 98 forks source link

Could not find AuthenticationHandler,AuthorizationHandler #149

Closed madhugarimilla closed 8 years ago

madhugarimilla commented 8 years ago

I have configured this bundle from and when i try to implement a authentication handler for my resources using the example provided in com.eclipsesource.jaxrs.security.example , i could not able to find these classes in my classpath.

com.eclipsesource.jaxrs.provider.security.AuthenticationHandler; com.eclipsesource.jaxrs.provider.security.AuthorizationHandler;

What dependencies do i need to to get access to these?

BryanHunt commented 8 years ago

Those dependencies are in com.eclipsesource.jaxrs.provider.security

madhugarimilla commented 8 years ago

Hi Bryan, Thanks for the quick reply.

I am trying to setup a authentication filter kind of thing for all my rest resources so when i request for any Rest resource in my application, first authentication need to be established and then the resource can be accessed.

How can i do that by using the example pointed here? Is it mandatory to use AuthenticationHandler and AuthorizationHandler and use roles? How can i do it without using roles ?

BryanHunt commented 8 years ago

The authorization handler is only necessary if you use the @RolesAllowed annotation. You can use the authentication handler to do your authentication, and then do authorization however you want (i.e., document based)

madhugarimilla commented 8 years ago

Hey Bryan, I got this thing working but it doesn't work without AuthorizationHandler. If i skip implementing AuthorizationHandler and also not registered it in the Activator , then the authenticate method in Authenticationhandler is not getting called. so i added back the AuthorizationHandler and registered it to make it work.

BryanHunt commented 8 years ago

That sounds fine. I'd suggest that your dummy implementation always returns false in the event that you later include code that uses @RolesAllowed. That would prevent a security hole in the app.

madhugarimilla commented 8 years ago

Yes. Thanks