RAD-如何在Websphere应用程序服务器管理控制台中为JAX RPC添加用户名令牌 [英] RAD - How to add username token for JAX RPC in websphere application server admin console

查看:125
本文介绍了RAD-如何在Websphere应用程序服务器管理控制台中为JAX RPC添加用户名令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了Web服务,并尝试添加其中的安全性.我正在使用RAD,想知道如何在webservices.xml扩展标签中添加用户名令牌?

I have created web services and trying to add security part of it. I'm using RAD and wondering how to add the username token in the webservices.xml extension tab?

感谢您的帮助.

谢谢.

推荐答案

@parthkansara添加了一条评论,询问如何针对JAX-WS应用程序执行此操作.我正在回答该评论,作为对此主题的另一种回答,因为在评论字段中没有足够的字符可以这样做.

A comment was added by @parthkansara asking about how to do this for a JAX-WS application. I'm answering that comment as an additional answer to this topic since there aren't enough characters to do so in the comment field.

您可以在RAD中为JAX-WS应用程序添加WS-Security Policy和Bindings.但是,这不是最直接的事情.另外,如果您通过RAD应用策略/绑定并进行部署,然后使用管理控制台对其进行修改,那么您对管理控制台所做的操作将不会生效.这是非常令人困惑的行为,在我撰写有关此问题的疑难解答文章之前,我经常会得到一些故障报告.如果要使用RAD部署应用程序,建议您通过管理控制台(而不是RAD)应用策略/绑定.如果这样做,您的策略/绑定将在整个重新部署过程中保持不变;仅当您卸载应用后,它们才会消失.

You can add a WS-Security Policy and Bindings for a JAX-WS application in RAD. However, its not the most straightforward thing. Also, if you apply the policy/bindings with RAD and deploy, then modify them with the admin console, what you did with the admin console won't take effect. This is very confusing behavior and something I would frequently get trouble reports for until I wrote a troubleshooting article about it. If you are going to deploy your app with RAD, I suggest that you apply your policy/bindings with the admin console, NOT with RAD. If you do this, your policy/bindings will stay throughout redeploys; they'll only disappear if you uninstall your app.

如果您要导出耳朵,我只建议您使用RAD应用策略/绑定,然后使用管理控制台安装耳朵,而不是直接通过RAD进行部署.

I only suggest that you apply policy/bindings using RAD if you intend to export your ear, then install the ear with the admin console, not by deploying directly with RAD.

因此,我将向您提供使用管理控制台在RAD部署的应用程序上添加UsernameToken的说明.

So, I'm going to give you the instructions for adding a UsernameToken on a RAD deployed application using the admin console.

您需要做的第一件事是确保RAD使用服务器上的资源,而不是工作区上的资源:

The first thing that you need to do is make sure that your RAD is using resources on server, not workspace:

  1. 窗口>显示视图>服务器
  2. 在服务器"窗格中,右键单击服务器>打开"
  3. 在右侧,展开"WebSphere Application Server的发布设置"

  1. Window > Show view > Servers
  2. In the Servers pane, right click on the server > Open
  3. On the right, expand 'Publishing settings for WebSphere Application Server'

  • 如果当前设置为使用工作空间中的资源运行服务器",请执行以下操作:
  • If it is currently set to 'Run server with resources within the workspace', do the following:
  1. 将设置更改为使用服务器上的资源运行服务器"
  2. 点击文件>保存

  • 更改为使用服务器上的资源运行服务器"后,必须先卸载,然后重新安装该应用程序.仅进行重新部署是不够的.请执行以下操作:

  • After changing to 'Run server with resources on Server', you must uninstall, then re-install the application. Just doing a redeploy does not suffice. Do the following:

    1. 在服务器"窗格中,右键单击服务器>添加和删除..."
    2. 在右侧的已配置"部分中,选择您的应用程序
    3. 点击删除
    4. 单击完成
    5. 在服务器"窗格中,右键单击服务器>添加和删除..."
    6. 在左侧的可用"部分中,选择您的应用程序
    7. 点击添加
    8. 单击完成

  • 创建jax-ws自定义策略集:

    1. 在管理控制台中,单击服务">策略集">应用程序策略集".
    2. 点击新建.
    3. 指定名称= UntPolicy.
    4. 点击应用".
    5. 在策略"下,单击添加">"WS-Security".

    编辑自定义策略集

    1. 删除数字签名,加密和时间戳.
    1. Remove digital signature, encryption, and timestamp.
    1. 在管理控制台中,单击"WS-Security">主策略".
    2. 取消选择消息级别保护.
    3. 点击应用".

  • 添加UsernameToken.

  • Add the UsernameToken.

    1. 在策略详细信息"下,单击请求令牌策略".
    2. 选择添加令牌类型.
    3. 选择用户名.
    4. 单击确定".

  • 配置客户端以使用UntPolicy策略集.

    1. 在管理控制台中,单击服务>服务客户端>(serviceName)
    2. 检查您要对其应用策略的服务/端点/操作.如果您希望将其应用于所有这些对象,请仅选中顶部的一个对象.
    3. 点击附加策略集> UntPolicy

    为客户端创建自定义绑定.

    1. 再次检查资源.
    2. 点击分配绑定
    3. 点击新应用程序特定绑定"
    4. 指定绑定配置名称.名称:untClientBinding
    5. 单击添加> WS-Security
    6. 如果主消息安全策略绑定"面板未显示,请选择"WS-Security".

    编辑客户端的自定义绑定.

    1. 点击身份验证和保护
    2. 编辑身份令牌生成器以发送身份用户名.
    1. Click Authentication and Protection
    2. Edit the identity token generator to send the identity username.
    1. 点击请求:myToken.
    2. 点击应用".
    3. 单击回调处理程序.用户名=(yourUserid)密码=(yourPassword)
      • 避免麻烦:这是在提供者系统的用户注册表上有效的用户名/密码.
    1. Click request:myToken.
    2. Click Apply.
    3. Click Callback handler. User name=(yourUserid) Password=(yourPassword)
      • Avoid trouble: This is a userid/password that is valid on the user registry on the provider's system.

  • (可选)如果配置UsernameToken,请添加以下WS-Security定制属性:
    • com.ibm.wsspi.wssecurity.token.username.addNonce = true
    • com.ibm.wsspi.wssecurity.token.username.addTimestamp = true
    • 添加了这些自定义属性,因为它们是在UsernameToken使用者默认提供程序常规绑定上指定的.如果我们在此处未指定这些属性,则您将需要从默认提供程序常规绑定中删除这些属性,或者为不包含这些属性的提供程序创建应用程序特定的绑定.
    • (Optional) If configuring a UsernameToken, add the following WS-Security custom properties:
      • com.ibm.wsspi.wssecurity.token.username.addNonce=true
      • com.ibm.wsspi.wssecurity.token.username.addTimestamp=true
      • These custom properties are added because they are specified on the UsernameToken consumer default provider general bindings. If we do not specify those properties here, you will either need to remove those properties from the default provider general bindings or create application-specific bindings for the provider that does not include those properties.
      • 重新启动应用程序

        • 启动带有附加策略的应用程序后,如果对该策略进行了修改,则必须重新启动应用程序服务器以获取更改.
        • 启动带有附加通用绑定的应用程序后,如果修改了通用绑定,则必须重新启动应用服务器以获取更改.

        测试应用程序.

        要在跟踪中查看入站/出站SOAP消息,请执行以下操作

        1. 添加以下跟踪规范:

        1. Add the following trace spec:

        • com.ibm.ws.webservices.trace.* = all

        重新启动应用程序服务器.

        Restart the application server.

        在(profileRoot)/logs/(serverName)/trace.log中的跟踪中搜索以下字符串:

        Search the trace in (profileRoot)/logs/(serverName)/trace.log for the following string:

        • 绑定http
        • 这应该在入站和出站消息之间切换.
        • 出站HTTP SOAP请求
        • 入站HTTP SOAP请求
        • 出站HTTP SOAP响应
        • 入站HTTP SOAP响应

        来源:这些步骤是从WebSphere知识中心的此任务执行的:

        Source: These steps were taken from this task in the WebSphere knowledge center:

        https://www.ibm.com/support/knowledgecenter/SSAW57_9.0.0/com.ibm.websphere.nd.multiplatform.doc/ae/twbs_stand_alone_security_token.html

        在WebSphere WS-Security故障排除指南中,有一个页面包含可用的jax-ws策略/绑定示例的列表:

        In the WebSphere WS-Security troubleshooting guide, there is a page that contains a list of the jax-ws policy/binding examples that are available:

        WebSphere WS-Security示例:JAX-WS策略/绑定配置和代码示例

        该页面上有很多内容,包括但不限于:

        There are a lot on that page including, but not limited to:

        • UsernameToken
        • LTPA
        • 签名
        • 加密
        • 常规绑定
        • SAML

        这篇关于RAD-如何在Websphere应用程序服务器管理控制台中为JAX RPC添加用户名令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆