static UserSearchMethod toUserSearchMethod(Ldap ldap) { if (StringUtils.isNotEmpty(ldap.getUserDnPattern())) { return DN_PATTERN; } else if (StringUtils.isNotEmpty(ldap.getUserSearchBase()) && StringUtils.isNotEmpty(ldap.getUserSearchFilter())) { return SEARCH_AND_FILTER; } return UNSPECIFIED_OR_INVALID; } }
static UserSearchMethod toUserSearchMethod(Ldap ldap) { if (StringUtils.isNotEmpty(ldap.getUserDnPattern())) { return DN_PATTERN; } else if (StringUtils.isNotEmpty(ldap.getUserSearchBase()) && StringUtils.isNotEmpty(ldap.getUserSearchFilter())) { return SEARCH_AND_FILTER; } return UNSPECIFIED_OR_INVALID; } }
/** * @return True if any core field in an authentication method has a non-empty value. "Core fields" * are generally required fields to make an authentication method work, such as client ID/secret, * or path to a certficate store. */ private boolean maybeShouldBeEnabled(Authn n) { OAuth2 o = n.getOauth2(); Saml s = n.getSaml(); Ldap l = n.getLdap(); IAP i = n.getIap(); // There isn't a good "core fields" for X509 return StringUtils.isNotEmpty(o.getClient().getClientId()) || StringUtils.isNotEmpty(o.getClient().getClientSecret()) || StringUtils.isNotEmpty(s.getIssuerId()) || StringUtils.isNotEmpty(s.getKeyStore()) || StringUtils.isNotEmpty(l.getUserDnPattern()) || StringUtils.isNotEmpty(l.getUserSearchBase()) || StringUtils.isNotEmpty(l.getUserSearchFilter()) || StringUtils.isNotEmpty(i.getAudience()); } }
/** * @return True if any core field in an authentication method has a non-empty value. "Core fields" * are generally required fields to make an authentication method work, such as client ID/secret, * or path to a certficate store. */ private boolean maybeShouldBeEnabled(Authn n) { OAuth2 o = n.getOauth2(); Saml s = n.getSaml(); Ldap l = n.getLdap(); IAP i = n.getIap(); // There isn't a good "core fields" for X509 return StringUtils.isNotEmpty(o.getClient().getClientId()) || StringUtils.isNotEmpty(o.getClient().getClientSecret()) || StringUtils.isNotEmpty(s.getIssuerId()) || StringUtils.isNotEmpty(s.getKeyStore()) || StringUtils.isNotEmpty(l.getUserDnPattern()) || StringUtils.isNotEmpty(l.getUserSearchBase()) || StringUtils.isNotEmpty(l.getUserSearchFilter()) || StringUtils.isNotEmpty(i.getAudience()); } }
public LdapConfig(Security security) { if (!security.getAuthn().getLdap().isEnabled()) { return; } Ldap ldap = security.getAuthn().getLdap(); this.enabled = ldap.isEnabled(); this.url = ldap.getUrl(); this.userDnPattern = ldap.getUserDnPattern(); this.userSearchBase = ldap.getUserSearchBase(); this.userSearchFilter = ldap.getUserSearchFilter(); } }
public LdapConfig(Security security) { if (!security.getAuthn().getLdap().isEnabled()) { return; } Ldap ldap = security.getAuthn().getLdap(); this.enabled = ldap.isEnabled(); this.url = ldap.getUrl(); this.userDnPattern = ldap.getUserDnPattern(); this.userSearchBase = ldap.getUserSearchBase(); this.userSearchFilter = ldap.getUserSearchFilter(); } }
@Override protected AuthnMethod editAuthnMethod(Ldap ldap) { ldap.setUrl(isSet(url) ? url : ldap.getUrl()); ldap.setUserDnPattern(isSet(userDnPattern) ? userDnPattern : ldap.getUserDnPattern()); ldap.setUserSearchBase(isSet(userSearchBase) ? userSearchBase : ldap.getUserSearchBase()); ldap.setUserSearchFilter(isSet(userSearchFilter) ? userSearchFilter : ldap.getUserSearchFilter()); if (isSet(userSearchBase)) { if (userSearchBase.isEmpty()) { ldap.setUserSearchBase(null); } } if (isSet(userSearchFilter)) { if (userSearchFilter.isEmpty()) { ldap.setUserSearchFilter(null); } } return ldap; } }
@Override protected AuthnMethod editAuthnMethod(Ldap ldap) { ldap.setUrl(isSet(url) ? url : ldap.getUrl()); ldap.setUserDnPattern(isSet(userDnPattern) ? userDnPattern : ldap.getUserDnPattern()); ldap.setUserSearchBase(isSet(userSearchBase) ? userSearchBase : ldap.getUserSearchBase()); ldap.setUserSearchFilter(isSet(userSearchFilter) ? userSearchFilter : ldap.getUserSearchFilter()); if (isSet(userSearchBase)) { if (userSearchBase.isEmpty()) { ldap.setUserSearchBase(null); } } if (isSet(userSearchFilter)) { if (userSearchFilter.isEmpty()) { ldap.setUserSearchFilter(null); } } return ldap; } }