diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java index 53d3877131b..3faf8b768b2 100644 --- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java +++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/command/LDAPConfigCmd.java @@ -188,7 +188,7 @@ public class LDAPConfigCmd extends BaseCmd { } else { boolean result = this.updateLDAP(); if (result) { - LDAPConfigResponse lr = this.createLDAPConfigResponse(getHostname(), getPort().toString(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN()); + LDAPConfigResponse lr = this.createLDAPConfigResponse(getHostname(), getPort(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN()); lr.setResponseName(getCommandName()); this.setResponseObject(lr); } @@ -196,10 +196,10 @@ public class LDAPConfigCmd extends BaseCmd { } - private LDAPConfigResponse createLDAPConfigResponse(String hostname, String port, Boolean useSSL, String queryFilter, String searchBase, String bindDN) { + private LDAPConfigResponse createLDAPConfigResponse(String hostname, Integer port, Boolean useSSL, String queryFilter, String searchBase, String bindDN) { LDAPConfigResponse lr = new LDAPConfigResponse(); lr.setHostname(hostname); - lr.setPort(port); + lr.setPort(port.toString()); lr.setUseSSL(useSSL.toString()); lr.setQueryFilter(queryFilter); lr.setBindDN(bindDN); diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/response/LdapConfigurationResponse.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/response/LdapConfigurationResponse.java index caabbe7298a..39d5baeae84 100644 --- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/response/LdapConfigurationResponse.java +++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/api/response/LdapConfigurationResponse.java @@ -28,7 +28,7 @@ public class LdapConfigurationResponse extends BaseResponse { @SerializedName("port") @Param(description = "port") - private String port; + private int port; public LdapConfigurationResponse() { super(); @@ -39,7 +39,7 @@ public class LdapConfigurationResponse extends BaseResponse { this.hostname = hostname; } - public LdapConfigurationResponse(final String hostname, final String port) { + public LdapConfigurationResponse(final String hostname, final int port) { this.hostname = hostname; this.port = port; } @@ -48,7 +48,7 @@ public class LdapConfigurationResponse extends BaseResponse { return hostname; } - public String getPort() { + public int getPort() { return port; } @@ -56,7 +56,7 @@ public class LdapConfigurationResponse extends BaseResponse { this.hostname = hostname; } - public void setPort(final String port) { + public void setPort(final int port) { this.port = port; } } \ No newline at end of file diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapConfigurationVO.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapConfigurationVO.java index 2fb63328173..98e42f8af40 100644 --- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapConfigurationVO.java +++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapConfigurationVO.java @@ -23,30 +23,26 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; -import com.cloud.utils.db.Encrypt; import org.apache.cloudstack.api.InternalIdentity; @Entity @Table(name = "ldap_configuration") public class LdapConfigurationVO implements InternalIdentity { + @Column(name = "hostname") + private String hostname; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private Long id; - @Encrypt - @Column(name = "hostname") - private String hostname; - - @Encrypt @Column(name = "port") - private String port; + private int port; public LdapConfigurationVO() { } - public LdapConfigurationVO(final String hostname, final String port) { + public LdapConfigurationVO(final String hostname, final int port) { this.hostname = hostname; this.port = port; } @@ -60,7 +56,7 @@ public class LdapConfigurationVO implements InternalIdentity { return id; } - public String getPort() { + public int getPort() { return port; } diff --git a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapManagerImpl.java b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapManagerImpl.java index c2158f4128e..578ebce7f77 100644 --- a/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapManagerImpl.java +++ b/plugins/user-authenticators/ldap/src/org/apache/cloudstack/ldap/LdapManagerImpl.java @@ -67,10 +67,10 @@ public class LdapManagerImpl implements LdapManager, LdapValidator { try { final String providerUrl = "ldap://" + hostname + ":" + port; _ldapContextFactory.createBindContext(providerUrl); - configuration = new LdapConfigurationVO(hostname, Integer.toString(port)); + configuration = new LdapConfigurationVO(hostname, port); _ldapConfigurationDao.persist(configuration); s_logger.info("Added new ldap server with hostname: " + hostname); - return new LdapConfigurationResponse(hostname, Integer.toString(port)); + return new LdapConfigurationResponse(hostname, port); } catch (final NamingException e) { throw new InvalidParameterValueException("Unable to bind to the given LDAP server"); } diff --git a/setup/db/db/schema-421to430.sql b/setup/db/db/schema-421to430.sql index 06e6a27a2b0..d1d87928394 100644 --- a/setup/db/db/schema-421to430.sql +++ b/setup/db/db/schema-421to430.sql @@ -612,7 +612,7 @@ INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, CREATE TABLE `cloud`.`ldap_configuration` ( `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', `hostname` varchar(255) NOT NULL COMMENT 'the hostname of the ldap server', - `port` varchar(255) COMMENT 'port that the ldap server is listening on', + `port` int(10) COMMENT 'port that the ldap server is listening on', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;