WLST to add a user condition to a existing global role

683 Views Asked by At

I am trying to add a user condition under Security Realms -> myrealm -> Roles and Policies -> Global Roles -> Roles -> Test role -> View role conditions. There I clicked on "Add condition" button, then choose user in Predicate List and enter the user name in User Argument Name and save it.

I did tried cmo.getSecurityConfiguration().getDefaultRealm().lookupRoleMapper("XACMLRoleMapper") from Oracle support, but i am not sure how do i achieve this using wlst.

Could you help me out with this.

1

There are 1 best solutions below

0
Nikhil On

As i understand,By using below WLST script it will help you to create users, groups and let you know how to add users to an existing role. 1

connect(‘weblogic’,’weblogic’,’t3://localhost:7001′)

edit()

startEdit(-1,-1,’false’)

serverConfig()

cd(‘/SecurityConfiguration/First_Domain/Realms/myrealm/AuthenticationProviders/DefaultAuthenticator’)

cmo.createUser(‘faisal’,’weblogic’,”)

cmo.groupExists(‘TestGrp’)

cmo.createGroup(‘TestGrp’,”)

cmo.addMemberToGroup(‘testgrp’,’faisal’)

cd(‘/SecurityConfiguration/First_Domain/Realms/myrealm/RoleMappers/XACMLRoleMapper’)

cmo.setRoleExpression(”,’Admin’,’Grp(TestGrp)|Grp(Administrators)’)

edit()

undo(defaultAnswer=’y’, unactivatedChanges=’true’)

stopEdit(‘y’)