From 5d70e687f6760c9a5d8b04f46fa97579429d2271 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Tue, 17 Dec 2024 13:18:25 +0100 Subject: [PATCH] replaced Content by Payload due to upstream library changes Signed-off-by: Stephan Richter --- de.srsoftware.oidc.api/build.gradle | 2 +- de.srsoftware.oidc.app/build.gradle.kts | 4 ++-- .../src/main/java/de/srsoftware/oidc/app/Application.java | 4 +--- de.srsoftware.oidc.backend/build.gradle.kts | 2 +- .../main/java/de/srsoftware/oidc/backend/UserController.java | 4 ++-- de.srsoftware.oidc.datastore.encrypted/build.gradle.kts | 2 +- .../oidc/datastore/encrypted/EncryptedUserService.java | 4 ++-- .../oidc/datastore/encrypted/EncryptedUserServiceTest.java | 4 ++-- de.srsoftware.oidc.datastore.file/build.gradle.kts | 2 +- .../java/de/srsoftware/oidc/datastore/file/FileStore.java | 4 ++-- 10 files changed, 15 insertions(+), 17 deletions(-) diff --git a/de.srsoftware.oidc.api/build.gradle b/de.srsoftware.oidc.api/build.gradle index 155010e..6ece1fa 100644 --- a/de.srsoftware.oidc.api/build.gradle +++ b/de.srsoftware.oidc.api/build.gradle @@ -6,7 +6,7 @@ dependencies { testImplementation 'org.junit.jupiter:junit-jupiter' implementation 'de.srsoftware:tools.optionals:1.0.0' - implementation 'de.srsoftware:tools.util:1.0.3' + implementation 'de.srsoftware:tools.util:1.1.0' implementation 'org.bitbucket.b_c:jose4j:0.9.6' implementation 'org.json:json:20240303' implementation 'com.sun.mail:jakarta.mail:2.0.1' diff --git a/de.srsoftware.oidc.app/build.gradle.kts b/de.srsoftware.oidc.app/build.gradle.kts index 2eb579d..06baa7d 100644 --- a/de.srsoftware.oidc.app/build.gradle.kts +++ b/de.srsoftware.oidc.app/build.gradle.kts @@ -3,9 +3,9 @@ description = "SRSoftware OIDC: app" dependencies{ implementation("org.json:json:20240303") implementation("de.srsoftware:tools.http:1.0.1") - implementation("de.srsoftware:tools.logging:1.0.0") + implementation("de.srsoftware:tools.logging:1.0.1") implementation("de.srsoftware:tools.optionals:1.0.0") - implementation("de.srsoftware:tools.util:1.0.3") + implementation("de.srsoftware:tools.util:1.1.0") implementation(project(":de.srsoftware.oidc.api")) implementation(project(":de.srsoftware.oidc.backend")) implementation(project(":de.srsoftware.oidc.datastore.encrypted")) diff --git a/de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java b/de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java index a73af90..3c1b1a7 100644 --- a/de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java +++ b/de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java @@ -8,7 +8,6 @@ import static de.srsoftware.tools.Optionals.absentIfBlank; import static de.srsoftware.tools.Optionals.nullable; import static de.srsoftware.tools.Paths.configDir; import static de.srsoftware.tools.Strings.uuid; -import static java.lang.System.Logger.Level.DEBUG; import static java.lang.System.Logger.Level.ERROR; import static java.lang.System.getenv; import static java.util.Optional.empty; @@ -25,7 +24,6 @@ import de.srsoftware.oidc.datastore.file.FileStoreProvider; import de.srsoftware.oidc.datastore.file.PlaintextKeyStore; import de.srsoftware.oidc.web.Forward; import de.srsoftware.oidc.web.StaticPages; -import de.srsoftware.tools.ColorLogger; import de.srsoftware.tools.UuidHasher; import java.io.File; import java.net.InetSocketAddress; @@ -50,7 +48,7 @@ public class Application { private static final String FAVICON = "/favicon.ico"; private static final String INDEX = STATIC_PATH + "/index.html"; private static final String WELL_KNOWN = "/.well-known"; - private static final System.Logger LOG = new ColorLogger("Application").setLogLevel(DEBUG); + private static final System.Logger LOG = System.getLogger("Application"); // new ColorLogger("Application").setLogLevel(DEBUG); public static void main(String[] args) throws Exception { var argMap = map(args); diff --git a/de.srsoftware.oidc.backend/build.gradle.kts b/de.srsoftware.oidc.backend/build.gradle.kts index cd45bee..d5e007d 100644 --- a/de.srsoftware.oidc.backend/build.gradle.kts +++ b/de.srsoftware.oidc.backend/build.gradle.kts @@ -4,7 +4,7 @@ dependencies{ implementation("com.sun.mail:jakarta.mail:2.0.1") implementation("de.srsoftware:tools.http:1.0.1") implementation("de.srsoftware:tools.optionals:1.0.0") - implementation("de.srsoftware:tools.util:1.0.3") + implementation("de.srsoftware:tools.util:1.1.0") implementation("org.bitbucket.b_c:jose4j:0.9.6") implementation("org.json:json:20240303") diff --git a/de.srsoftware.oidc.backend/src/main/java/de/srsoftware/oidc/backend/UserController.java b/de.srsoftware.oidc.backend/src/main/java/de/srsoftware/oidc/backend/UserController.java index a3382e0..2dfe1c4 100644 --- a/de.srsoftware.oidc.backend/src/main/java/de/srsoftware/oidc/backend/UserController.java +++ b/de.srsoftware.oidc.backend/src/main/java/de/srsoftware/oidc/backend/UserController.java @@ -14,7 +14,7 @@ import de.srsoftware.oidc.api.*; import de.srsoftware.oidc.api.data.Permission; import de.srsoftware.oidc.api.data.Session; import de.srsoftware.oidc.api.data.User; -import de.srsoftware.tools.Content; +import de.srsoftware.tools.Payload; import de.srsoftware.tools.Result; import de.srsoftware.tools.SessionToken; import jakarta.mail.*; @@ -198,7 +198,7 @@ public class UserController extends Controller { var trust = body.has(TRUST) && body.getBoolean(TRUST); Result result = users.login(username, password); - if (result instanceof Content user) return sendUserAndCookie(ex, sessions.createSession(user.get(), trust), user.get()); + if (result instanceof Payload user) return sendUserAndCookie(ex, sessions.createSession(user.get(), trust), user.get()); return sendContent(ex, HTTP_UNAUTHORIZED, result); } diff --git a/de.srsoftware.oidc.datastore.encrypted/build.gradle.kts b/de.srsoftware.oidc.datastore.encrypted/build.gradle.kts index 115944b..cf6d8cc 100644 --- a/de.srsoftware.oidc.datastore.encrypted/build.gradle.kts +++ b/de.srsoftware.oidc.datastore.encrypted/build.gradle.kts @@ -3,7 +3,7 @@ description = "SRSoftware OIDC: encrypted datastore module" dependencies{ implementation("com.sun.mail:jakarta.mail:2.0.1") implementation("de.srsoftware:tools.optionals:1.0.0") - implementation("de.srsoftware:tools.util:1.0.3") + implementation("de.srsoftware:tools.util:1.1.0") implementation(project(":de.srsoftware.oidc.api")) testImplementation(project(":de.srsoftware.oidc.api","testBundle")) diff --git a/de.srsoftware.oidc.datastore.encrypted/src/main/java/de/srsoftware/oidc/datastore/encrypted/EncryptedUserService.java b/de.srsoftware.oidc.datastore.encrypted/src/main/java/de/srsoftware/oidc/datastore/encrypted/EncryptedUserService.java index 0e552e1..d0c73bc 100644 --- a/de.srsoftware.oidc.datastore.encrypted/src/main/java/de/srsoftware/oidc/datastore/encrypted/EncryptedUserService.java +++ b/de.srsoftware.oidc.datastore.encrypted/src/main/java/de/srsoftware/oidc/datastore/encrypted/EncryptedUserService.java @@ -8,9 +8,9 @@ import static java.util.Optional.empty; import de.srsoftware.oidc.api.UserService; import de.srsoftware.oidc.api.data.AccessToken; import de.srsoftware.oidc.api.data.User; -import de.srsoftware.tools.Content; import de.srsoftware.tools.Error; import de.srsoftware.tools.PasswordHasher; +import de.srsoftware.tools.Payload; import de.srsoftware.tools.Result; import java.util.*; @@ -110,7 +110,7 @@ public class EncryptedUserService extends EncryptedConfig implements UserService var match = List.of(decryptedUser.username(), decryptedUser.realName(), decryptedUser.email()).contains(username); if (match && hasher.matches(password, decryptedUser.hashedPassword())) { this.unlock(username); - return Content.of(decryptedUser); + return Payload.of(decryptedUser); } } diff --git a/de.srsoftware.oidc.datastore.encrypted/src/test/java/de/srsoftware/oidc/datastore/encrypted/EncryptedUserServiceTest.java b/de.srsoftware.oidc.datastore.encrypted/src/test/java/de/srsoftware/oidc/datastore/encrypted/EncryptedUserServiceTest.java index fe68158..8a5a29c 100644 --- a/de.srsoftware.oidc.datastore.encrypted/src/test/java/de/srsoftware/oidc/datastore/encrypted/EncryptedUserServiceTest.java +++ b/de.srsoftware.oidc.datastore.encrypted/src/test/java/de/srsoftware/oidc/datastore/encrypted/EncryptedUserServiceTest.java @@ -8,9 +8,9 @@ import static java.lang.System.Logger.Level.WARNING; import de.srsoftware.oidc.api.*; import de.srsoftware.oidc.api.data.AccessToken; import de.srsoftware.oidc.api.data.User; -import de.srsoftware.tools.Content; import de.srsoftware.tools.Error; import de.srsoftware.tools.PasswordHasher; +import de.srsoftware.tools.Payload; import de.srsoftware.tools.Result; import java.io.File; import java.util.*; @@ -83,7 +83,7 @@ public class EncryptedUserServiceTest extends UserServiceTest { var user = entry.getValue(); if (user.username().equals(username) && passwordMatches(password, user)) { unlock(username); - return Content.of(user); + return Payload.of(user); } } var lock = lock(username); diff --git a/de.srsoftware.oidc.datastore.file/build.gradle.kts b/de.srsoftware.oidc.datastore.file/build.gradle.kts index c1cad1b..14b625e 100644 --- a/de.srsoftware.oidc.datastore.file/build.gradle.kts +++ b/de.srsoftware.oidc.datastore.file/build.gradle.kts @@ -3,7 +3,7 @@ description = "SRSoftware OIDC: file datastore module" dependencies{ implementation("com.sun.mail:jakarta.mail:2.0.1") implementation("de.srsoftware:tools.optionals:1.0.0") - implementation("de.srsoftware:tools.util:1.0.3") + implementation("de.srsoftware:tools.util:1.1.0") implementation("org.json:json:20240303") implementation(project(":de.srsoftware.oidc.api")) diff --git a/de.srsoftware.oidc.datastore.file/src/main/java/de/srsoftware/oidc/datastore/file/FileStore.java b/de.srsoftware.oidc.datastore.file/src/main/java/de/srsoftware/oidc/datastore/file/FileStore.java index 8571c14..1cd0334 100644 --- a/de.srsoftware.oidc.datastore.file/src/main/java/de/srsoftware/oidc/datastore/file/FileStore.java +++ b/de.srsoftware.oidc.datastore.file/src/main/java/de/srsoftware/oidc/datastore/file/FileStore.java @@ -10,9 +10,9 @@ import static java.util.Optional.empty; import de.srsoftware.oidc.api.*; import de.srsoftware.oidc.api.data.*; -import de.srsoftware.tools.Content; import de.srsoftware.tools.Error; import de.srsoftware.tools.PasswordHasher; +import de.srsoftware.tools.Payload; import de.srsoftware.tools.Result; import jakarta.mail.Authenticator; import jakarta.mail.PasswordAuthentication; @@ -198,7 +198,7 @@ public class FileStore implements AuthorizationService, ClientService, SessionSe var loadedUser = User.of(userData, userId).filter(u -> passwordMatches(password, u)); if (loadedUser.isPresent()) { unlock(username); - return Content.of(loadedUser.get()); + return Payload.of(loadedUser.get()); } } var lock = lock(username);