Jersey获取DIGEST或基本HTTP身份验证用户和密码

时间:2014-06-12 22:00:26

标签: java jersey basic-authentication digest-authentication

如何在Jersey 2.4中获取请求中的用户和密码?

客户端请求设置用户和密码,如下所示

protected HttpAuthenticationFeature feature = HttpAuthenticationFeature.universalBuilder()
              .credentialsForBasic("user", "123456") //these are not in header
              .credentials("adminuser", "hello")
              .build();

WebTarget loginTarget = webTarget.path("u").path("login");
loginTarget.register(feature);
ReturnMessage bean = loginTarget.request(MediaType.APPLICATION_JSON_TYPE).post(..

[已添加] 更多研究表明,这些值可以在JERSEY1.x的http标头中获取,但不能在2.x

中获取

0 个答案:

没有答案