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 public void validate(ConfigProblemSetBuilder p, Ldap ldap) { if (!ldap.isEnabled()) { return; } if (ldap.getUrl() == null) { p.addProblem(Problem.Severity.ERROR, "LDAP url missing."); } else if (ldap.getUrl().getScheme() == null) { p.addProblem(Problem.Severity.ERROR, "LDAP url scheme is missing."); } else if (ldap.getUrl().getPort() == -1) { p.addProblem(Problem.Severity.ERROR, "LDAP url port is undefined"); } else if (!ldap.getUrl().getScheme().equalsIgnoreCase("ldaps") && !ldap.getUrl().getScheme().equalsIgnoreCase("ldap")) { p.addProblem(Problem.Severity.ERROR, "LDAP url must use ldap or ldaps protocol."); } switch(UserSearchMethod.toUserSearchMethod(ldap)) { case DN_PATTERN: // fall through. case SEARCH_AND_FILTER: break; case UNSPECIFIED_OR_INVALID: // fall through. default: p.addProblem(Problem.Severity.ERROR, "No valid user search method defined. Please " + "specify with either --user-dn-pattern OR (--user-search-base and --user-search-filter)."); } }
@Override public void validate(ConfigProblemSetBuilder p, Ldap ldap) { if (!ldap.isEnabled()) { return; } if (ldap.getUrl() == null) { p.addProblem(Problem.Severity.ERROR, "LDAP url missing."); } else if (ldap.getUrl().getScheme() == null) { p.addProblem(Problem.Severity.ERROR, "LDAP url scheme is missing."); } else if (ldap.getUrl().getPort() == -1) { p.addProblem(Problem.Severity.ERROR, "LDAP url port is undefined"); } else if (!ldap.getUrl().getScheme().equalsIgnoreCase("ldaps") && !ldap.getUrl().getScheme().equalsIgnoreCase("ldap")) { p.addProblem(Problem.Severity.ERROR, "LDAP url must use ldap or ldaps protocol."); } switch(UserSearchMethod.toUserSearchMethod(ldap)) { case DN_PATTERN: // fall through. case SEARCH_AND_FILTER: break; case UNSPECIFIED_OR_INVALID: // fall through. default: p.addProblem(Problem.Severity.ERROR, "No valid user search method defined. Please " + "specify with either --user-dn-pattern OR (--user-search-base and --user-search-filter)."); } }
public boolean isEnabled() { return getOauth2().isEnabled() || getSaml().isEnabled() || getLdap().isEnabled() || getX509().isEnabled() || getIap().isEnabled(); }
public boolean isEnabled() { return getOauth2().isEnabled() || getSaml().isEnabled() || getLdap().isEnabled() || getX509().isEnabled() || getIap().isEnabled(); }
@Override protected GateConfig getGateConfig(ServiceSettings gate, Security security) { GateConfig config = new GateConfig(gate, security); if (security.getAuthn().getOauth2().isEnabled()) { config.spring = new SpringConfig(security); } else if (security.getAuthn().getSaml().isEnabled()) { config.saml = new SamlConfig(security); } else if (security.getAuthn().getLdap().isEnabled()) { config.ldap = new LdapConfig(security); } else if (security.getAuthn().getIap().isEnabled()) { config.google.iap = new IAPConfig(security); } if (security.getAuthn().getX509().isEnabled()) { config.x509 = new X509Config(security); } return config; } }
@Override protected GateConfig getGateConfig(ServiceSettings gate, Security security) { GateConfig config = new GateConfig(gate, security); if (security.getAuthn().getOauth2().isEnabled()) { config.spring = new SpringConfig(security); } else if (security.getAuthn().getSaml().isEnabled()) { config.saml = new SamlConfig(security); } else if (security.getAuthn().getLdap().isEnabled()) { config.ldap = new LdapConfig(security); } else if (security.getAuthn().getIap().isEnabled()) { config.google.iap = new IAPConfig(security); } if (security.getAuthn().getX509().isEnabled()) { config.x509 = new X509Config(security); } return config; } }
@Override protected GateConfig getGateConfig(ServiceSettings gate, Security security) { GateConfig config = new GateConfig(gate, security); if (security.getAuthn().getOauth2().isEnabled()) { config.security.oauth2 = security.getAuthn().getOauth2(); } else if (security.getAuthn().getSaml().isEnabled()) { config.saml = new SamlConfig(security); } else if (security.getAuthn().getLdap().isEnabled()) { config.ldap = new LdapConfig(security); } else if (security.getAuthn().getIap().isEnabled()) { config.google.iap = new IAPConfig(security); } if (security.getAuthn().getX509().isEnabled()) { config.x509 = new X509Config(security); } return config; } }
@Override protected GateConfig getGateConfig(ServiceSettings gate, Security security) { GateConfig config = new GateConfig(gate, security); if (security.getAuthn().getOauth2().isEnabled()) { config.security.oauth2 = security.getAuthn().getOauth2(); } else if (security.getAuthn().getSaml().isEnabled()) { config.saml = new SamlConfig(security); } else if (security.getAuthn().getLdap().isEnabled()) { config.ldap = new LdapConfig(security); } else if (security.getAuthn().getIap().isEnabled()) { config.google.iap = new IAPConfig(security); } if (security.getAuthn().getX509().isEnabled()) { config.x509 = new X509Config(security); } return config; } }