Skip to content
Permalink
Browse files
JENKINS-38294 Add a warning when displayed name is not used with seve…
…ral domains
  • Loading branch information
fbelzunc committed Sep 16, 2016
1 parent 9369861 commit c76d69179ba72dad4633e18e7a014f99892ad2c3
Showing 1 changed file with 22 additions and 0 deletions.
@@ -393,6 +393,15 @@ public ListBoxModel doFillGroupLookupStrategyItems() {

public FormValidation doValidate(@QueryParameter(fixEmpty = true) String domain, @QueryParameter(fixEmpty = true) String site, @QueryParameter(fixEmpty = true) String bindName,
@QueryParameter(fixEmpty = true) String bindPassword, @QueryParameter(fixEmpty = true) String server) throws IOException, ServletException, NamingException {
String [] domains = domain.split(",");
String[] DnItems = {"CN=", "DC=", "OU="};
if (domains.length > 1 ) {
for (String dnItem : DnItems) {
if (bindName.contains(dnItem)) {
return FormValidation.error("Use multiple domains require the bindName to be expressed with the displayedName");
}
}
}
ClassLoader ccl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
try {
@@ -503,6 +512,19 @@ public FormValidation doValidate(@QueryParameter(fixEmpty = true) String domain,
}
}

public FormValidation doCheckBindName(@QueryParameter String domain, @QueryParameter String bindName) {
String [] domains = domain.split(",");
String[] DnItems = {"CN=", "DC=", "OU="};
if (domains.length > 1 ) {
for (String dnItem : DnItems) {
if (bindName.contains(dnItem)) {
return FormValidation.warning("Please, use the displayedName");
}
}
}
return FormValidation.ok();
}

/**
* Binds to the server using the specified username/password.
* <p>

0 comments on commit c76d691

Please sign in to comment.