My Oracle Support Banner

How to Set Authentication Providers in a WLST Script (Doc ID 1582876.1)

Last updated on DECEMBER 11, 2017

Applies to:

Oracle Weblogic Server - Version 10.3 and later
Information in this document applies to any platform.

Goal

How can one set the Authentication Providers in a WLST script? The following code:

edit()
startEdit()
realmName=cmo.getSecurityConfiguration().getDefaultRealm()
authProvider=realmName.getAuthenticationProviders()
providersList = jarray.array([], ObjectName)
for i in authProvider:
    providerName = i.getName()
    providersList.append(ObjectName("'Security:Name=myrealm" + providerName + "'"))

cd('Securityconfiguration/<DOMAIN>/Realms/myrealm')
set('AuthenticationProviders', providersList)

is failing with:

array(javax.management.ObjectName,[])
DefaultAuthenticator
array(javax.management.ObjectName,[Security:Name=myrealmDefaultIdentityAsserter])
array(javax.management.ObjectName,[Security:Name=myrealmDefaultIdentityAsserter, Security:Name=myrealmDefaultAuthenticator])
This Exception occurred at Fri Jul 26 16:17:06 IST 2013.
javax.management.AttributeNotFoundException: com.bea:Name=base_domain,Type=Domain:Securityconfiguration
Problem invoking WLST - Traceback (innermost last):
 File "D:\bea\WLS1036\user_projects\domains\base_domain\1.py", line 17, in ?
 File "<iostream>", line 182, in cd
 File "<iostream>", line 1847, in raiseWLSTException
WLSTException: Error cding to the MBean

But it works fine if we hard code as below:

set('AuthenticationProviders',jarray.array([ObjectName('Security:Name=myrealmDefaultIdentityAsserter'), ObjectName('Security:Name=myrealmDefaultAuthenticator')], ObjectName))

How can this be achieved?

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.