Last active
August 29, 2015 14:01
-
-
Save mbarkley/dae9123a618295947739 to your computer and use it in GitHub Desktop.
An example of securing a JAX-RS Endpoint using Errai Security
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Path("/services") | |
public interface RestService { | |
@GET | |
@Path("/name-lookup") | |
@RestrictedAccess | |
public String getMyName(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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