我在IBM WebSphere上部署了JAX-RS Web服务,我希望在接收请求(从其他服务器委派)时保护此WS。 因此,我使用basic auth并在BasicAuthSecurityHandler对象上设置用户名和密码,并将请求委托给其他服务器。 现在,当其他服务器收到请求时,我使用全局安全下的WAS中的联合存储库并执行身份验证。jax-rs only认证无授权
如果我在部署描述符中注释掉auth-constraint
,则认证不会发生。 我想只做认证和没有授权。 我尝试在Jax-WS方法上使用@PermitAll
批注,但授权也在Jax-WS方法执行之前发生。 那么有什么办法可以跳过授权并仍然进行身份验证?
我没有任何规则与我的用户相关联,所以我想跳过授权。
<security-constraint id="SecurityConstraint_1">
<display-name>RESTSecurity</display-name>
<web-resource-collection id="WebResourceCollection_1">
<web-resource-name>DelegateReqComApp</web-resource-name>
<description>
Protection area for Rest resource /addresses
</description>
<url-pattern>/rest/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<!-- Authorization Constraint commented out -->
<auth-constraint id="AuthConstraint_1">
<description>
Used to guard resources under this url-pattern
</description>
<role-name>iapawas012</role-name>
</auth-constraint>
</security-constraint>
非常感谢你,能解决问题。 – user2608576 2014-11-25 08:07:27