Posts

Showing posts from February 14, 2016

Import and Export users from Embedded LDAP using WLST

Import and Export users from Embedded LDAP using WLST: Export connect(‘weblogic’,’weblogic’, ‘t3://localhost:8003′) domainRuntime() cd(‘/DomainServices/DomainRuntimeService/DomainConfiguration/DomainA/SecurityConfiguration/DomainA/DefaultRealm/myrealm/AuthenticationProviders/DefaultAuthenticator’) cmo.exportData(‘DefaultAtn’,’c:/export.ldif’, Properties()) Import connect(‘weblogic’,’weblogic’, ‘t3://localhost:8003′) domainRuntime() cd(‘/DomainServices/DomainRuntimeService/DomainConfiguration/DomainB/SecurityConfiguration/DomainB/DefaultRealm/myrealm/AuthenticationProviders/DefaultAuthenticator’) cmo.importData(‘DefaultAtn’,’c:/export.ldif’, Properties()) Example as follows: To export security data to a file: In the left pane, select Security Realms and then select the realm whose security data you want to export (for example, myrealm). Expand Migration > Export. In the Export Directory on Server field, specify the directory on the Admin...

WLST Script to add users, groups and modify roles

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’)

Creating a DataSource in WebLogic Using WLST

Creating JDBC DataSources in WebLogic Server using WLST (WebLogic Scripting Tool),including authentication, connection pool configuration, and deployment targets. Prerequisites: WebLogic Server installed JDBC driver JAR available (e.g.,  ojdbc8.jar  for Oracle) Admin credentials and server URL Basic WLST DataSource Creation Script: Save as  create_datasource.py : # Connect to Admin Server connect('weblogic', 'welcome1', 't3://localhost:7001 edit() startEdit() # Create JDBC DataSource cd('/') cmo.createJDBCSystemResource('MyDS') cd('/JDBCSystemResources/MyDS/JDBCResource/MyDS') cmo.setName('MyDS') # JDBC DataSource Parameters cd('/JDBCSystemResources/MyDS/JDBCResource/MyDS/JDBCDataSourceParams/MyDS') cmo.setJNDINames(['jdbc/MyDS'])  # JNDI Name cmo.setGlobalTransactionsProtocol('TwoPhaseCommit')  # For XA transactions #JDBC Driver Properties cd('/JDBCSystemResources/MyDS/JDBCResource/MyDS/JDBCDriverParams/My...

DISABLING AND ENABLING ADMIN CONSOLE

Disabling your Admin Console: We can disable our weblogic admin console in two different ways 1)Admin console 2)Weblogic Scripting Tool From Admin console:- To disable access to the Administration Console: After you log in to admin console click Lock & Edit. In the left pane of the Console, under Domain Structure, select the domain name. Select Configuration > General, and click Advanced at the bottom of the page. Deselect Console Enabled. Click Save. To activate these changes, click Activate Changes. From WLST:- connect(“weblogic“,”weblogic“,”t3://localhost:7001“) edit() startEdit() cmo.setConsoleEnabled(false) save() activate() disconnect() exit() Enabling the Admin Console: After we disable the admin console we can enable it again by using WLST. Following are the steps on the same: connect(“weblogic“,”weblogic“,”t3://localhost:7001“) edit() startEdit() cmo.setConsoleEnabled(true) save() activate() disconnect() exit() Note: Here, 1...