我正在寻找能够找到身份验证提供程序名称并将其置于变量的解决方案。我想要这样的东西:
LDAPProviderName = getAuthenticationProviderName(ProviderClassName='weblogic.security.providers.authentication.LDAPAuthenticationProviderImpl')
cd('/base_domain/serverConfig/SecurityConfiguration/base_domain/Realms/myrealm/AuthenticationProviders/' + LDAPProviderName)
答案 0 :(得分:0)
我发现了一个肮脏的解决方法:
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)