From 029b126850db6e405e762b4a25966fbd0c901367 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Wed, 30 Dec 2020 16:06:15 -0500 Subject: Added new column to the identity service. Added new column to the identity service. Issue-ID: SO-3448 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I5151016d1b4874cb77eecddc17169c04f59dc9a5 --- .../AuthenticationMethodFactory.java | 2 +- .../V8.8.1__AddColumnAdminProjectDomainName.sql | 3 ++ .../onap/so/db/catalog/beans/CloudIdentity.java | 35 ++++++++++++++++------ 3 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.8.1__AddColumnAdminProjectDomainName.sql diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java index ab0239057a..c1c7ed5fd6 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java @@ -100,7 +100,7 @@ public final class AuthenticationMethodFactory { Project project = new Project(); Project.Domain projectDomain = new Project.Domain(); userDomain.setName(cloudIdentity.getUserDomainName()); - projectDomain.setName(cloudIdentity.getProjectDomainName()); + projectDomain.setName(cloudIdentity.getAdminProjectDomainName()); user.setName(cloudIdentity.getMsoId()); user.setPassword(CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass())); user.setDomain(userDomain); diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.8.1__AddColumnAdminProjectDomainName.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.8.1__AddColumnAdminProjectDomainName.sql new file mode 100644 index 0000000000..a883466515 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.8.1__AddColumnAdminProjectDomainName.sql @@ -0,0 +1,3 @@ +use catalogdb; + +ALTER TABLE identity_services ADD COLUMN ADMIN_PROJECT_DOMAIN_NAME varchar(255) DEFAULT 'Default'; \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java index 61b0b11445..63ee35cd9c 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudIdentity.java @@ -20,13 +20,7 @@ package org.onap.so.db.catalog.beans; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.openpojo.business.annotation.BusinessKey; -import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.Date; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; @@ -36,6 +30,12 @@ import javax.persistence.PrePersist; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.openpojo.business.annotation.BusinessKey; import uk.co.blackpepper.bowman.annotation.RemoteResource; /** @@ -74,6 +74,11 @@ public class CloudIdentity { @Column(name = "PROJECT_DOMAIN_NAME") private String projectDomainName; + @JsonProperty("admin_project_domain_name ") + @BusinessKey + @Column(name = "ADMIN_PROJECT_DOMAIN_NAME") + private String adminProjectDomainName; + @JsonProperty("user_domain_name") @BusinessKey @Column(name = "USER_DOMAIN_NAME") @@ -245,6 +250,14 @@ public class CloudIdentity { this.projectDomainName = projectDomainName; } + public String getAdminProjectDomainName() { + return adminProjectDomainName; + } + + public void setAdminProjectDomainName(String adminProjectDomainName) { + this.adminProjectDomainName = adminProjectDomainName; + } + public String getUserDomainName() { return userDomainName; } @@ -267,6 +280,7 @@ public class CloudIdentity { cloudIdentityCopy.identityServerType = this.identityServerType; cloudIdentityCopy.identityAuthenticationType = this.identityAuthenticationType; cloudIdentityCopy.projectDomainName = this.projectDomainName; + cloudIdentityCopy.adminProjectDomainName = this.adminProjectDomainName; cloudIdentityCopy.userDomainName = this.userDomainName; return cloudIdentityCopy; @@ -279,7 +293,8 @@ public class CloudIdentity { .append("projectDomain", getProjectDomainName()).append("userDomain", getUserDomainName()) .append("adminTenant", getAdminTenant()).append("memberRole", getMemberRole()) .append("tenantMetadata", getTenantMetadata()).append("identityServerType", getIdentityServerType()) - .append("identityAuthenticationType", getIdentityAuthenticationType()).toString(); + .append("identityAuthenticationType", getIdentityAuthenticationType()) + .append("adminProjectDomainName", getAdminProjectDomainName()).toString(); } @Override @@ -299,7 +314,8 @@ public class CloudIdentity { .append(getMemberRole(), castOther.getMemberRole()) .append(getTenantMetadata(), castOther.getTenantMetadata()) .append(getIdentityServerType(), castOther.getIdentityServerType()) - .append(getIdentityAuthenticationType(), castOther.getIdentityAuthenticationType()).isEquals(); + .append(getIdentityAuthenticationType(), castOther.getIdentityAuthenticationType()) + .append(getAdminProjectDomainName(), castOther.getAdminProjectDomainName()).isEquals(); } @Override @@ -307,6 +323,7 @@ public class CloudIdentity { return new HashCodeBuilder(1, 31).append(getId()).append(getIdentityUrl()).append(getMsoId()) .append(getMsoPass()).append(getProjectDomainName()).append(getUserDomainName()) .append(getAdminTenant()).append(getMemberRole()).append(getTenantMetadata()) - .append(getIdentityServerType()).append(getIdentityAuthenticationType()).toHashCode(); + .append(getIdentityServerType()).append(getIdentityAuthenticationType()) + .append(getAdminProjectDomainName()).toHashCode(); } } -- cgit 1.2.3-korg