WebLogic WLST 查找 AuthenticationProviderName

WebLogic WLST find AuthenticationProviderName

我正在寻找让我找到身份验证提供程序名称并将其放入变量的解决方案。我想要这样的东西:

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

我找到了一个肮脏的解决方法:

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)