【问题标题】:wsadmin Web authentication behaviorwsadmin Web 认证行为
【发布时间】:2012-06-01 19:34:48
【问题描述】:

我一直在搜索 IBM 文档以试图找到它,但我一直空无一物。有谁知道使用 wsadmin 为 WAS 7.0 设置配置“Web 身份验证行为”的相关脚本/命令?

我正在查看的设置可以从Security > Global Security > Web and SIP security > General Settings > Authenticate only when the URI is protected > Use available authentication data when an unprotected URI is accessed 控制台访问

更新:

基于 cmets,我切换了设置,并在 {profile}/security.xml 中找到了更改的配置。

这是未选中“访问未受保护的 URI 时使用可用的身份验证数据”复选框的样子:

<webAuthAttrs xmi:id="DescriptiveProperty_8" name="com.ibm.wsspi.security.web.webAuthReq" value="lazy" type="String" displayNameKey="" nlsRangeKey="" hoverHelpKey="" range="lazy,persisting,always" inclusive="false" firstClass="false"/>

这是我检查后的样子(这是我试图用 wsadmin 做的):

<webAuthAttrs xmi:id="DescriptiveProperty_8" name="com.ibm.wsspi.security.web.webAuthReq" value="persisting" type="String" displayNameKey="" nlsRangeKey="" hoverHelpKey="" range="lazy,persisting,always" inclusive="false" firstClass="false"/>

所以现在的问题是,如何使用 wsadmin 更新这个特定属性?

【问题讨论】:

  • 我不知道答案,但是如果您更改控制台中的设置并检查 PROFILE_HOME/wstemp/ 目录,您应该会找到更新的配置,您可以将其与 PROFILE_HOME/config/ 进行比较.
  • 感谢您的评论。根据您的建议,我更改了设置,发现 security.xml 中的此设置已更改:<webAuthAttrs xmi:id="DescriptiveProperty_8" name="com.ibm.wsspi.security.web.webAuthReq" value="persisting" type="String" displayNameKey="" nlsRangeKey="" hoverHelpKey="" range="lazy,persisting,always" inclusive="false" firstClass="false"/>。那么有没有办法使用 wsadmin 来设置呢?
  • 这看起来和我的一样,所以我建议用之前/之后更新问题。无论如何,在 wsadmin jacl 中,您想要set sec [$AdminConfig getid /Security:/] 之类的东西,然后循环遍历$AdminConfig list DescriptiveProperty $sec,然后是set name [$AdminConfig getAttribute $dc name],然后根据您要设置的内容查找等于com.ibm.wsspi.security.web.webAuthReq,然后是$AdminConfig update $dc [[...]]

标签: websphere-7 wsadmin


【解决方案1】:

相当于 bkail 的建议使用 Jython 而不是 JACL:

import java
import string

sec = AdminConfig.getid('/Security:/')
descProps = AdminConfig.list('DescriptiveProperty', sec)
lineSeparator = java.lang.System.getProperty('line.separator')
descriptiveProperties = descProps.split(lineSeparator)
for descProp in descriptiveProperties:
    id = descProp[string.find(descProp, "("):string.find(descProp, ")")+1]
    name = AdminConfig.showAttribute(id, 'name')
    if name == "com.ibm.wsspi.security.web.webAuthReq":
        print "Updating security config object with id: %s, property name: %s. Setting value to 'persisting'" % (id, name)
        AdminConfig.modify(id, '[[value persisting]]')

【讨论】:

    【解决方案2】:

    试试这个:

    set sec [$AdminConfig getid /Security:/]
    foreach descProp [$AdminConfig list DescriptiveProperty $sec] {
      set name [$AdminConfig showAttribute $descProp name]
      if {$name == "com.ibm.wsspi.security.web.webAuthReq"} {
        puts "Updating $descProp"
        $AdminConfig modify $descProp {{value persisting}}
      }
    }
    

    使用bin/wsadmin -f webAuthReq.jacl执行

    【讨论】:

    • 我没有实际测试您的代码,因为我使用的是 jython(我知道我没有提前提到这一点)。不过,我使用了您的方法并使其正常工作,因此我给您答案。有关 jython 中的等效示例,请参见下面的答案。
    猜你喜欢
    • 1970-01-01
    • 2011-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-01
    • 2011-03-01
    相关资源
    最近更新 更多