This repository has been archived by the owner on Nov 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
Security
Jens Reimann edited this page Nov 20, 2015
·
2 revisions
An OSGi friendly integration of Jersey's/JAX-RS security features comes with the bundle com.eclipsesource.jaxrs.provider.security
. This bundle provides two interfaces that needs to be implemented and registered as OSGi services:
-
com.eclipsesource.jaxrs.provider.security.AuthenticationHandler
: For handling authentication. -
com.eclipsesource.jaxrs.provider.security.AuthorizationHandler
: For handling authorization. To see an example implementation of these interfaces take a look at the exampleSecurityHandler
.
To use the security integration you need to start the bundle com.eclipsesource.jaxrs.provider.security
and implement the two handlers explained above.
An example that shows how to integrate these features can be found in the bundle com.eclipsesource.jaxrs.security.example
. This bundle contains also an Eclipse launch configuration in the folder launchers
called JAX-RS Security Example.launch
.
After starting the example you can access two services:
-
public service
: A public service can be accessed by sending aGET
request tohttp://localhost:9090/services/security/unsecure
. -
private service
: A secured service can be accessed by sending aGET
request tohttp://localhost:9090/services/security/secure'. Please note that you need to send a request header for authentication
user=test. Otherwise you will receive a
403`.