Skip to content

Commit

Permalink
Merge pull request #44 from fbelzunc/JENKINS-38295
Browse files Browse the repository at this point in the history
JENKINS-38294 Add a warning when displayed name is not used with several domains
  • Loading branch information
fbelzunc committed Sep 16, 2016
2 parents 3163157 + c76d691 commit 50db0a0
Showing 1 changed file with 22 additions and 0 deletions.
Expand Up @@ -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 {
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 50db0a0

Please sign in to comment.