Skip to content

Commit

Permalink
Merge pull request #43 from MRamonLeon/JENKINS-61854
Browse files Browse the repository at this point in the history
[JENKINS-61854] Follow up: Get the json value depending on the Jenkins version
  • Loading branch information
rsandell authored Apr 22, 2020
2 parents 4bfb1dc + d1a3544 commit e1ce253
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/hudson/security/LDAPSecurityRealm.java
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,13 @@ public FormValidation doValidate(StaplerRequest req) throws Exception {
JSONObject json = JSONObject.fromObject(IOUtils.toString(req.getInputStream()));
String user = json.getString("testUser");
String password = json.getString("testPassword");
JSONObject realmCfg = json.getJSONObject("useSecurity").getJSONObject("realm");
JSONObject realmCfg;
if (hasEnableSecurityForm()) {
realmCfg = json.getJSONObject("useSecurity").getJSONObject("realm");
} else {
realmCfg = json.getJSONObject("realm");
}

// instantiate the realm
LDAPSecurityRealm realm = req.bindJSON(LDAPSecurityRealm.class, realmCfg);
return validate(realm, user, password);
Expand Down

0 comments on commit e1ce253

Please sign in to comment.