Script to Setup security realm in Weblogic

Oracle Weblogic Server

WLST script to Setup security realm in weblogic . Below script can be used for the same

 

Please modify the script according to your need.

 

import os
adminUrl = 'xxx'
domainName = 'xxx'
realmName = 'TPRealm'

if os.environ.has_key('wlsUserID'):
wlsUserID = os.environ['wlsUserID']
if os.environ.has_key('wlsPassword'):
wlsPassword = os.environ['wlsPassword']
if os.environ.has_key('ADMIN_URL'):
adminUrl = os.environ['ADMIN_URL']
if os.environ.has_key('DOMAIN_NAME'):
domainName = os.environ['DOMAIN_NAME']

 

print 'connecting to admin server....' + adminUrl + ' setting up the realm ' + realmName
connect( url=adminUrl, adminServerName='AdminServer')
edit()
startEdit()

cd('/SecurityConfiguration/'+domainName)
cmo.createRealm(realmName)

cd('/SecurityConfiguration/'+domainName+'/Realms/' + realmName)
cmo.setDeployCredentialMappingIgnored(false)
save()
activate(block="true")
print 'disconnecting from admin server....'
disconnect()
exit()

 

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.