I am looking for some pointers on how to secure my rest root resource
@Path("/employee")
public class EmployeeResource {
@GET
@Produces("text/html")
public String get(
@QueryParam("name") String empname,
@QueryParam("sn") String sn) {
// Return a data back.
}
}
I have read post's regarding basic authetication and OAuth, I know the concept but i am looking for ways on how to implement it in code.
Thanks
Declare an interceptor:
Then use it:
Then your AuthenticationInterceptor, along the lines of:
Defining acceptable credentials in a more convenient way is left as an exercise for the reader.
The way I know is to add to your webapp's
web.xml
. Minimally, I think you need to add: