From 30f33c56a3ae981ee8e69e9a0eab984ad72b8c65 Mon Sep 17 00:00:00 2001 From: Yuriy Movchan Date: Fri, 6 Dec 2024 23:57:54 +0300 Subject: [PATCH] Jans ext uid test (#10346) * feat(jans-orm): add jansExtUid attributes persistence test Signed-off-by: Yuriy Movchan * feat(jans-orm): add jansExtUid attributes persistence test Signed-off-by: Yuriy Movchan * feat(jans-orm): add jansExtUid attributes persistence test Signed-off-by: Yuriy Movchan * feat(jans-orm): add jansExtUid attributes persistence test Signed-off-by: Yuriy Movchan --------- Signed-off-by: Yuriy Movchan Co-authored-by: YuriyZ --- jans-auth-server/pom.xml | 2 +- jans-auth-server/server/pom.xml | 57 +++- .../rs/AuthorizationChallengeValidator.java | 3 - .../comp/db/UserJansExtUidAttributeTest.java | 252 ++++++++++++++++++ jans-bom/pom.xml | 4 +- .../java/io/jans/model/user/SimpleUser.java | 16 +- .../io/jans/orm/sql/impl/SqlEntryManager.java | 7 - 7 files changed, 322 insertions(+), 19 deletions(-) create mode 100644 jans-auth-server/server/src/test/java/io/jans/as/server/comp/db/UserJansExtUidAttributeTest.java diff --git a/jans-auth-server/pom.xml b/jans-auth-server/pom.xml index fc64b514dc8..80483d7a52c 100644 --- a/jans-auth-server/pom.xml +++ b/jans-auth-server/pom.xml @@ -469,7 +469,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0 + 3.5.2 @{argLine} diff --git a/jans-auth-server/server/pom.xml b/jans-auth-server/server/pom.xml index 6f212286a4d..bf009716bc1 100644 --- a/jans-auth-server/server/pom.xml +++ b/jans-auth-server/server/pom.xml @@ -138,7 +138,15 @@ org.apache.maven.plugins maven-surefire-plugin - -Xms1024m -Xmx2048m -XX:MaxMetaspaceSize=512m -XX:+DisableExplicitGC + + + junit.jupiter.conditions.deactivate = * + junit.jupiter.extensions.autodetection.enabled = true + junit.jupiter.testinstance.lifecycle.default = per_class + junit.jupiter.execution.parallel.enabled = true + + + -Xms1024m -Xmx2048m -XX:MaxMetaspaceSize=512m -XX:+DisableExplicitGC -Djans.base=${project.build.directory} -Dlog.base=${project.build.directory} -Dgluu.disable.scheduler=true @@ -571,6 +579,12 @@ com.googlecode.json-simple json-simple + + + junit + junit + + org.mvel @@ -591,13 +605,46 @@ org.testng testng test - 6.14.3 + org.jboss.weld weld-junit5 test + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.junit.jupiter + junit-jupiter-params + test + + + + org.mockito + mockito-core + test + + + org.mockito + mockito-inline + test + + + org.mockito + mockito-junit-jupiter + test + + + org.apache.maven.surefire + surefire-testng + 3.5.2 + test + javax.xml.bind @@ -773,7 +820,7 @@ jakarta.ejb-api - + org.jboss.arquillian.container @@ -826,7 +873,7 @@ ${buildNumber} - + ${git.branch} @@ -1051,7 +1098,7 @@ - com.querydsl querydsl-sql - 4.4.0 + 5.1.0 com.github.jsqlparser diff --git a/jans-core/model/src/main/java/io/jans/model/user/SimpleUser.java b/jans-core/model/src/main/java/io/jans/model/user/SimpleUser.java index f47294d2a40..32b5484c069 100644 --- a/jans-core/model/src/main/java/io/jans/model/user/SimpleUser.java +++ b/jans-core/model/src/main/java/io/jans/model/user/SimpleUser.java @@ -231,7 +231,15 @@ public void setAttribute(String name, List values) { } public void setAttribute(String name, List values, Boolean multiValued) { - CustomObjectAttribute attribute = new CustomObjectAttribute(name, values); + List objectValues = null; + if (values != null) { + objectValues = new ArrayList(values.size()); + for(String value : values) { + objectValues.add(value); + } + } + + CustomObjectAttribute attribute = new CustomObjectAttribute(name, objectValues); if (multiValued != null) { attribute.setMultiValued(multiValued); } @@ -245,6 +253,9 @@ public void removeAttributeValue(String name) { CustomObjectAttribute customObjectAttribute = it.next(); if (StringHelper.equalsIgnoreCase(name, customObjectAttribute.getName())) { customObjectAttribute.setValue(null); + if (name.equalsIgnoreCase("jansExtUid")) { + externalUid = null; + } break; } } @@ -257,6 +268,9 @@ public void removeAttribute(String name) { break; } } + if (name.equalsIgnoreCase("jansExtUid")) { + externalUid = null; + } } } diff --git a/jans-orm/sql/src/main/java/io/jans/orm/sql/impl/SqlEntryManager.java b/jans-orm/sql/src/main/java/io/jans/orm/sql/impl/SqlEntryManager.java index 76b85f3af82..1b4f2f1dd78 100644 --- a/jans-orm/sql/src/main/java/io/jans/orm/sql/impl/SqlEntryManager.java +++ b/jans-orm/sql/src/main/java/io/jans/orm/sql/impl/SqlEntryManager.java @@ -17,8 +17,6 @@ import java.util.List; import java.util.Map; -import javax.inject.Inject; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,11 +43,9 @@ import io.jans.orm.model.PagedResult; import io.jans.orm.model.SearchScope; import io.jans.orm.model.SortOrder; -import io.jans.orm.model.base.LocalizedString; import io.jans.orm.reflect.property.PropertyAnnotation; import io.jans.orm.reflect.util.ReflectHelper; import io.jans.orm.search.filter.Filter; -import io.jans.orm.search.filter.FilterProcessor; import io.jans.orm.sql.model.ConvertedExpression; import io.jans.orm.sql.model.SearchReturnDataType; import io.jans.orm.sql.model.TableMapping; @@ -71,9 +67,6 @@ public class SqlEntryManager extends BaseEntryManager imple private static final String JSON_DATA_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS"; - @Inject - private Logger log; - private final SqlFilterConverter filterConverter; private static final GenericKeyConverter KEY_CONVERTER = new GenericKeyConverter(false);