Search code examples
webspherewebsphere-7websphere-portalwsadminwebsphere-8

How can 'Global security' 'Custom properties' be modified using jython scripting for 'WebSphere 7'?


I am using 'WebSphere 7 Application Server' in a clustered environment. I am attempting to use jython to script the configuration and setup. All well thus far. However, I have hit a road block. I cannot find a way to modify the 'Custom properties' for 'Global security'. To be more precise, I want to add the following custom property using jython:

com.ibm.ws.security.addHttpOnlyAttributeToCookies

I know how to do this using the 'Integrated Solutions Console', but not with scripting. Does anyone have any ideas on how to do this?


Solution

  • 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()