如何使用针对“WebSphere 7”的jython脚本来修改“全局安全性”“自定义属性”?

时间:2012-11-09 16:14:00

标签: websphere websphere-7 websphere-portal wsadmin websphere-8

我在群集环境中使用'WebSphere 7 Application Server'。我正在尝试使用 jython 来编写配置和设置脚本。到目前为止一切顺利。但是,我遇到了障碍。我找不到修改'全局安全''自定义属性'的方法。更确切地说,我想使用 jython 添加以下自定义属性:

com.ibm.ws.security.addHttpOnlyAttributeToCookies

我知道如何使用'Integrated Solutions Console'执行此操作,但不使用脚本编写。有没有人对如何做到这一点有任何想法?

1 个答案:

答案 0 :(得分:3)

sec = AdminConfig.getid('/Security:/')
prop = AdminConfig.getid('/Cell:/Security:/Property:com.ibm.ws.security.addHttpOnlyAttributeToCookies/')
if prop:
    AdminConfig.modify(prop, [['value', 'true']])
else:
    AdminConfig.create('Property', sec, [['name','com.ibm.ws.security.addHttpOnlyAttributeToCookies'], ['value','true']])
AdminConfig.save()