diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/ldap/service/LdapService.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/ldap/service/LdapService.java index dd53309193..e5b703f7aa 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/ldap/service/LdapService.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/ldap/service/LdapService.java @@ -38,7 +38,7 @@ public class LdapService { } private LdapTemplate getConnect(LdapRequest request) { - String credentials = EncryptUtils.aesDecrypt(request.getLadpPassword()).toString(); + String credentials = EncryptUtils.aesDecrypt(request.getLdapPassword()).toString(); LdapContextSource sourceLdapCtx; if (StringUtils.startsWithIgnoreCase(request.getLdapUrl(), "ldaps://")) { sourceLdapCtx = new SSLLdapContextSource(); @@ -47,7 +47,7 @@ public class LdapService { sourceLdapCtx = new LdapContextSource(); } sourceLdapCtx.setUrl(request.getLdapUrl()); - sourceLdapCtx.setUserDn(request.getLadpDn()); + sourceLdapCtx.setUserDn(request.getLdapDn()); sourceLdapCtx.setPassword(credentials); sourceLdapCtx.setDirObjectFactory(DefaultDirObjectFactory.class); sourceLdapCtx.afterPropertiesSet(); @@ -59,7 +59,7 @@ public class LdapService { sourceLdapCtx.setBaseEnvironmentProperties(baseEnv); ldapTemplate.setDefaultSearchScope(SearchScope.SUBTREE.getId()); try { - authenticate(request.getLadpDn(), credentials, ldapTemplate); + authenticate(request.getLdapDn(), credentials, ldapTemplate); } catch (AuthenticationException e) { LogUtils.error(e.getMessage(), e); throw new MSException(Translator.get("ldap_connect_fail_user")); diff --git a/backend/framework/sdk/src/main/java/io/metersphere/sdk/ldap/vo/LdapRequest.java b/backend/framework/sdk/src/main/java/io/metersphere/sdk/ldap/vo/LdapRequest.java index 9b17dcdd6d..05df020686 100644 --- a/backend/framework/sdk/src/main/java/io/metersphere/sdk/ldap/vo/LdapRequest.java +++ b/backend/framework/sdk/src/main/java/io/metersphere/sdk/ldap/vo/LdapRequest.java @@ -18,9 +18,9 @@ public class LdapRequest implements Serializable { @Schema(description = "LDAP绑定DN", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{ldap_dn_is_null}") - private String ladpDn; + private String ldapDn; @Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{ldap_password_is_null}") - private String ladpPassword; + private String ldapPassword; } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/AuthSourceController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/AuthSourceController.java index 8af9b7bab4..53de27a15b 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/AuthSourceController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/AuthSourceController.java @@ -90,13 +90,14 @@ public class AuthSourceController { @PostMapping("/ldap/test-connect") - @Operation(summary = "ladp测试连接") + @Operation(summary = "ldap测试连接") @RequiresPermissions(PermissionConstants.SYSTEM_PARAMETER_SETTING_AUTH_READ_UPDATE) public void ldapTestConnect(@Validated @RequestBody LdapRequest request) { ldapService.testConnect(request); } @PostMapping("/ldap/test-login") + @Operation(summary = "ldap测试登录") @RequiresPermissions(PermissionConstants.SYSTEM_PARAMETER_SETTING_AUTH_READ_UPDATE) public void testLogin(@RequestBody LdapLoginRequest request) { ldapService.testLogin(request); diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/AuthSourceControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/AuthSourceControllerTests.java index dc3e3d998a..e6d8d38191 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/AuthSourceControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/AuthSourceControllerTests.java @@ -235,8 +235,8 @@ public class AuthSourceControllerTests extends BaseTest { private LdapRequest getRequest(String ldapUrl, String ldapDn, String ldapPassword) { LdapRequest ldapRequest = new LdapRequest(); ldapRequest.setLdapUrl(ldapUrl); - ldapRequest.setLadpDn(ldapDn); - ldapRequest.setLadpPassword(ldapPassword); + ldapRequest.setLdapDn(ldapDn); + ldapRequest.setLdapPassword(ldapPassword); return ldapRequest; } } diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/param/LdapRequestDefinition.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/param/LdapRequestDefinition.java index 2525b269bd..5a31e3c8e8 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/param/LdapRequestDefinition.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/param/LdapRequestDefinition.java @@ -12,8 +12,8 @@ public class LdapRequestDefinition { private String ldapUrl; @NotBlank(message = "{ldap_dn_is_null}") - private String ladpDn; + private String ldapDn; @NotBlank(message = "{ldap_password_is_null}") - private String ladpPassword; + private String ldapPassword; }