Search code examples
ldapweblogicwlst

WebLogic WLST find AuthenticationProviderName


I'm looking for the solution which provides me to find Authentication Provider name and place it to variable. I want something like that:

LDAPProviderName = getAuthenticationProviderName(ProviderClassName='weblogic.security.providers.authentication.LDAPAuthenticationProviderImpl')
cd('/base_domain/serverConfig/SecurityConfiguration/base_domain/Realms/myrealm/AuthenticationProviders/' + LDAPProviderName)

Solution

  • i've found a dirty workaround for that:

    import re
    AuthProviders = find('ProviderClassName')
    LDAPProviderRegex = re.compile(r'LDAPAuthenticationProviderImpl')
    LDAPProvider = filter(LDAPProviderRegex.search, AuthProviders)
    LDAPProviderStr = str(LDAPProvider)
    LDAPProviderSub = re.sub(r"\sProviderClassName.*$", "", LDAPProviderStr)
    LDAPProviderName = re.sub(r"^[[]['][/].*[/](.*)$", "\\1", LDAPProviderSub)