Skip to content

Instantly share code, notes, and snippets.

@mbarkley
Last active August 29, 2015 14:01
Show Gist options
  • Save mbarkley/dae9123a618295947739 to your computer and use it in GitHub Desktop.
Save mbarkley/dae9123a618295947739 to your computer and use it in GitHub Desktop.
An example of securing a JAX-RS Endpoint using Errai Security
@Path("/services")
public interface RestService {
@GET
@Path("/name-lookup")
@RestrictedAccess
public String getMyName();
}
public class Sender {
@Inject
private Caller<RestService> serviceCaller;
public void callService() {
// Note that we MUST pass an ErrorCallback for JAX-RS calls.
serviceCaller.call(new RemoteCallback<String>() {
public void callback(String myName) {
// ...
}
}, new DefaultSecurityErrorCallback()).getMyName();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment