-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure_oud_provider.py
50 lines (48 loc) · 2.19 KB
/
configure_oud_provider.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/python
import os, sys
adminUser="weblogic"
adminPassword=""
adminServerHost="adminserver.host.com"
adminServerPort="7001"
domainName="YourDomainName"
LDAPProviderName="OUDAuthenticator"
LDAPHost="oudserver.host.com"
LDAPPort="1389"
LDAPAdmin="cn=Directory Manager,cn=Root DNs,cn=config"
LDAPAdminPassword="password"
LDAPGroupBase="cn=Groups,dc=your,dc=company,dc=com"
LDAPUserBase="cn=Users,dc=your,dc=company,dc=com"
connect (adminUser,adminPassword,'t3://'+adminServerHost+':'+adminServerPort)
edit()
startEdit()
cd('/SecurityConfiguration/'+domainName+'/Realms/myrealm')
# In the following command, substitute the appropriate class type
cmo.createAuthenticationProvider(LDAPProviderName,'weblogic.security.providers.authentication.IPlanetAuthenticator')
cd('/SecurityConfiguration/'+domainName+'/Realms/myrealm/AuthenticationProviders/'+LDAPProviderName)
cmo.setControlFlag('SUFFICIENT')
cd('/SecurityConfiguration/'+domainName+'/Realms/myrealm/AuthenticationProviders/'+LDAPProviderName)
cmo.setHost(LDAPHost)
cmo.setPort(LDAPPort)
cmo.setPrincipal(LDAPAdmin)
set("Credential",LDAPAdminPassword)
cmo.setGroupBaseDN(LDAPGroupBase)
cmo.setUserBaseDN(LDAPUserBase)
cmo.setUserNameAttribute('uid')
cmo.setAllUsersFilter('(&(uid=*)(objectclass=person))')
cmo.setStaticMemberDNAttribute('uniquemember')
cmo.setStaticGroupDNsfromMemberDNFilter('(&(uniquemember=%M)(objectclass=groupofuniquenames))')
cmo.setDynamicGroupNameAttribute('cn')
cmo.setDynamicGroupObjectClass('groupOfURLs')
cmo.setUserFromNameFilter('(&(uid=%u)(objectclass=person))')
cmo.setDynamicMemberURLAttribute('memberURL')
cmo.setStaticGroupObjectClass('groupofuniquenames')
cmo.setUserObjectClass('inetOrgPerson')
cmo.setGuidAttribute('entryuuid')
cd('/SecurityConfiguration/'+domainName+'/Realms/myrealm/AuthenticationProviders/DefaultAuthenticator')
cmo.setControlFlag('SUFFICIENT')
cd('/SecurityConfiguration/'+domainName+'/Realms/myrealm')
set('AuthenticationProviders',jarray.array([ObjectName('Security:Name=myrealm'+LDAPProviderName), ObjectName('Security:Name=myrealmDefaultAuthenticator'),ObjectName('Security:Name=myrealmDefaultIdentityAsserter')], ObjectName))
save()
activate()
disconnect()
exit()