I have following problem:
I have JAX-RS service which has a get
operation:
@Path("/unsecure/")
@Produces("application/json")
public class MyUnsecureService {
public MyUnsecureService() {
}
@GET
@Path("/get/{id}")
@Produces("application/json")
public User get(@PathParam("id") String id) {
return User.get(id);
}
}
now, I'm going to open this API for mobile devices and I need authentication and authorization mechanism to access the API.
My problem is that I have trusted apps (internal jobs, a website which runs on my hosting) which should be able to expose this API as they want, with no limitation, and mobile devices, which should be able to expose this API only if they have a token, formed using real User's encrypted login/pass, which can be used on service-side to determine:
- If the request to that method is allowed.
- If the parameters are correct (so, the user can't get other user's info).
Is this possible to do using OAuth1 or OAuth2?