Skip to content

Commit

Permalink
Merge branch 'develop' into feature/alias-id-and-alias-zid-for-identi…
Browse files Browse the repository at this point in the history
…ty-providers-further-integration-tests
  • Loading branch information
adrianhoelzl-sap committed Feb 12, 2024
2 parents 55fbcaf + 115bad4 commit be1add2
Show file tree
Hide file tree
Showing 164 changed files with 972 additions and 9,054 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

**Slack** [#uaa](https://cloudfoundry.slack.com/archives/C03FXANBV)

> **_Deprecation notice_**: _The MFA feature in UAA is deprecated and will be removed in a future UAA version._
# CloudFoundry User Account and Authentication (UAA) Server

The UAA is a multi tenant identity management service, used in Cloud Foundry, but also available
Expand Down Expand Up @@ -189,18 +187,15 @@ List of relations
public | groups | table | root
public | identity_provider | table | root
public | identity_zone | table | root
public | mfa_providers | table | root
public | oauth_client_details | table | root
public | oauth_code | table | root
public | oauth_code_id_seq | sequence | root
public | revocable_tokens | table | root
public | schema_version | table | root
public | sec_audit | table | root
public | sec_audit_id_seq | sequence | root
public | service_provider | table | root
public | spring_session | table | root
public | spring_session_attributes | table | root
public | user_google_mfa_credentials | table | root
public | user_info | table | root
public | users | table | root
(23 rows)
Expand Down
15 changes: 7 additions & 8 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ext {
// Versions shared between multiple dependencies
versions.aspectJVersion = "1.9.4"
versions.apacheDsVersion = "2.0.0.AM27"
versions.bouncyCastleVersion = "1.77"
versions.bouncyCastleVersion = "1.0.2.4"
versions.hamcrestVersion = "2.2"
versions.springBootVersion = "2.7.18"
versions.springFrameworkVersion = "5.3.31"
Expand Down Expand Up @@ -40,19 +40,18 @@ libraries.apacheCommonsRngCore = "org.apache.commons:commons-rng-core:1.5"
libraries.apacheCommonsRngSimple = "org.apache.commons:commons-rng-simple:1.5"
libraries.apacheCommonsText = "org.apache.commons:commons-text:1.11.0"
libraries.apacheDsProtocolLdap = "org.apache.directory.server:apacheds-protocol-ldap:${versions.apacheDsVersion}"
libraries.apacheLdapApi = "org.apache.directory.api:api-ldap-model:2.1.5"
libraries.apacheLdapApi = "org.apache.directory.api:api-ldap-model:2.1.6"
libraries.aspectJRt = "org.aspectj:aspectjrt"
libraries.aspectJWeaver = "org.aspectj:aspectjweaver"
libraries.bouncyCastlePkix = "org.bouncycastle:bcpkix-jdk18on:${versions.bouncyCastleVersion}"
libraries.bouncyCastleProv = "org.bouncycastle:bcprov-jdk18on:${versions.bouncyCastleVersion}"
libraries.bouncyCastlePkix = "org.bouncycastle:bcpkix-fips:1.0.7"
libraries.bouncyCastleProv = "org.bouncycastle:bc-fips:${versions.bouncyCastleVersion}"
libraries.braveInstrumentationSpringWebmvc = "io.zipkin.brave:brave-instrumentation-spring-webmvc:${versions.braveVersion}"
libraries.braveContextSlf4j = "io.zipkin.brave:brave-context-slf4j:${versions.braveVersion}"
libraries.commonsIo = "commons-io:commons-io:2.15.1"
libraries.dumbster = "dumbster:dumbster:1.6"
libraries.eclipseJgit = "org.eclipse.jgit:org.eclipse.jgit:6.8.0.202311291450-r"
libraries.flywayCore = "org.flywaydb:flyway-core"
libraries.greenmail = "com.icegreen:greenmail:1.6.15"
libraries.googleAuth = "com.warrenstrange:googleauth:1.5.0"
libraries.guava = "com.google.guava:guava:${versions.guavaVersion}"
libraries.guavaTestLib = "com.google.guava:guava-testlib:${versions.guavaVersion}"
libraries.hamcrest = "org.hamcrest:hamcrest:${versions.hamcrestVersion}"
Expand Down Expand Up @@ -126,13 +125,13 @@ libraries.unboundIdLdapSdk = "com.unboundid:unboundid-ldapsdk"
libraries.unboundIdScimSdk = "com.unboundid.product.scim:scim-sdk:1.8.26"
libraries.velocity = "org.apache.velocity:velocity-engine-core:2.3"
libraries.xerces = "xerces:xercesImpl:2.12.2"
libraries.zxing = "com.google.zxing:javase:3.5.2"
libraries.nimbusJwt = "com.nimbusds:nimbus-jose-jwt:9.37.3"
libraries.xmlSecurity = "org.apache.santuario:xmlsec:4.0.1"
libraries.orgJson = "org.json:json:20231013"
libraries.orgJson = "org.json:json:20240205"
libraries.owaspEsapi = "org.owasp.esapi:esapi:2.5.3.1"
libraries.jodaTime = "joda-time:joda-time:2.12.6"
libraries.jodaTime = "joda-time:joda-time:2.12.7"
libraries.commonsHttpClient = "commons-httpclient:commons-httpclient:3.1"
libraries.apacheHttpClient = "org.apache.httpcomponents:httpclient:4.5.14"

// gradle plugins
libraries.testRetryPlugin = "org.gradle:test-retry-gradle-plugin:1.5.8"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.cloudfoundry.identity.uaa.util;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -55,6 +56,15 @@ public static <T> T readValue(String s, Class<T> clazz) throws JsonUtilException
}
}

public static Map<String, Object> readValueAsMap(final String input) {
try {
final JsonNode rootNode = objectMapper.readTree(input);
return getNodeAsMap(rootNode);
} catch (final JsonProcessingException e) {
throw new JsonUtilException(e);
}
}

public static <T> T readValue(byte[] data, Class<T> clazz) throws JsonUtilException {
try {
if (data!=null && data.length>0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package org.cloudfoundry.identity.uaa.util;

import com.fasterxml.jackson.core.type.TypeReference;

import org.assertj.core.api.Assertions;
import org.cloudfoundry.identity.uaa.metrics.UrlGroup;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import java.util.List;
import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -42,6 +47,26 @@ void testReadValueByteClass() {
assertNull(JsonUtils.readValue((byte[]) null, UrlGroup.class));
}

@Test
void testReadValueAsMap() {
final String jsonInput = "{\"prop1\":\"abc\",\"prop2\":{\"prop2a\":\"def\",\"prop2b\":\"ghi\"},\"prop3\":[\"jkl\",\"mno\"]}";
final Map<String, Object> map = JsonUtils.readValueAsMap(jsonInput);
Assertions.assertThat(map).isNotNull();
Assertions.assertThat(map.get("prop1")).isNotNull().isEqualTo("abc");
Assertions.assertThat(map.get("prop2")).isNotNull().isInstanceOf(Map.class);
Assertions.assertThat(((Map<String, Object>) map.get("prop2")).get("prop2a")).isNotNull().isEqualTo("def");
Assertions.assertThat(((Map<String, Object>) map.get("prop2")).get("prop2b")).isNotNull().isEqualTo("ghi");
Assertions.assertThat(map.get("prop3")).isNotNull().isInstanceOf(List.class);
Assertions.assertThat((List<String>) map.get("prop3")).containsExactly("jkl", "mno");
}

@ParameterizedTest
@ValueSource(strings = {"{", "}", "{\"prop1\":\"abc\","})
void testReadValueAsMap_Invalid(final String input) {
Assertions.assertThatExceptionOfType(JsonUtils.JsonUtilException.class)
.isThrownBy(() -> JsonUtils.readValueAsMap(input));
}

@Test
void testReadValueBytes() {
assertNotNull(JsonUtils.readValue(jsonTestObjectString.getBytes(), new TypeReference<Map<String, Object>>() {}));
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit be1add2

Please sign in to comment.