2

我一直在搜索 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

更新:

根据评论,我切换了设置并在 {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 更新这个特定的属性?

4

2 回答 2

2

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

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]]')
于 2012-06-06T15:46:50.437 回答
1

尝试这个:

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

于 2012-06-01T21:04:27.773 回答