Browse Source

replaced Content by Payload due to upstream library changes

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
main
Stephan Richter 2 months ago
parent
commit
5d70e687f6
  1. 2
      de.srsoftware.oidc.api/build.gradle
  2. 4
      de.srsoftware.oidc.app/build.gradle.kts
  3. 4
      de.srsoftware.oidc.app/src/main/java/de/srsoftware/oidc/app/Application.java
  4. 2
      de.srsoftware.oidc.backend/build.gradle.kts
  5. 4
      de.srsoftware.oidc.backend/src/main/java/de/srsoftware/oidc/backend/UserController.java
  6. 2
      de.srsoftware.oidc.datastore.encrypted/build.gradle.kts
  7. 4
      de.srsoftware.oidc.datastore.encrypted/src/main/java/de/srsoftware/oidc/datastore/encrypted/EncryptedUserService.java
  8. 4
      de.srsoftware.oidc.datastore.encrypted/src/test/java/de/srsoftware/oidc/datastore/encrypted/EncryptedUserServiceTest.java
  9. 2
      de.srsoftware.oidc.datastore.file/build.gradle.kts
  10. 4
      de.srsoftware.oidc.datastore.file/src/main/java/de/srsoftware/oidc/datastore/file/FileStore.java

2
de.srsoftware.oidc.api/build.gradle

@ -6,7 +6,7 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter' testImplementation 'org.junit.jupiter:junit-jupiter'
implementation 'de.srsoftware:tools.optionals:1.0.0' 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.bitbucket.b_c:jose4j:0.9.6'
implementation 'org.json:json:20240303' implementation 'org.json:json:20240303'
implementation 'com.sun.mail:jakarta.mail:2.0.1' implementation 'com.sun.mail:jakarta.mail:2.0.1'

4
de.srsoftware.oidc.app/build.gradle.kts

@ -3,9 +3,9 @@ description = "SRSoftware OIDC: app"
dependencies{ dependencies{
implementation("org.json:json:20240303") implementation("org.json:json:20240303")
implementation("de.srsoftware:tools.http:1.0.1") 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.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.api"))
implementation(project(":de.srsoftware.oidc.backend")) implementation(project(":de.srsoftware.oidc.backend"))
implementation(project(":de.srsoftware.oidc.datastore.encrypted")) implementation(project(":de.srsoftware.oidc.datastore.encrypted"))

4
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.Optionals.nullable;
import static de.srsoftware.tools.Paths.configDir; import static de.srsoftware.tools.Paths.configDir;
import static de.srsoftware.tools.Strings.uuid; 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.Logger.Level.ERROR;
import static java.lang.System.getenv; import static java.lang.System.getenv;
import static java.util.Optional.empty; 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.datastore.file.PlaintextKeyStore;
import de.srsoftware.oidc.web.Forward; import de.srsoftware.oidc.web.Forward;
import de.srsoftware.oidc.web.StaticPages; import de.srsoftware.oidc.web.StaticPages;
import de.srsoftware.tools.ColorLogger;
import de.srsoftware.tools.UuidHasher; import de.srsoftware.tools.UuidHasher;
import java.io.File; import java.io.File;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
@ -50,7 +48,7 @@ public class Application {
private static final String FAVICON = "/favicon.ico"; private static final String FAVICON = "/favicon.ico";
private static final String INDEX = STATIC_PATH + "/index.html"; private static final String INDEX = STATIC_PATH + "/index.html";
private static final String WELL_KNOWN = "/.well-known"; 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 { public static void main(String[] args) throws Exception {
var argMap = map(args); var argMap = map(args);

2
de.srsoftware.oidc.backend/build.gradle.kts

@ -4,7 +4,7 @@ dependencies{
implementation("com.sun.mail:jakarta.mail:2.0.1") implementation("com.sun.mail:jakarta.mail:2.0.1")
implementation("de.srsoftware:tools.http:1.0.1") implementation("de.srsoftware:tools.http:1.0.1")
implementation("de.srsoftware:tools.optionals:1.0.0") 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.bitbucket.b_c:jose4j:0.9.6")
implementation("org.json:json:20240303") implementation("org.json:json:20240303")

4
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.Permission;
import de.srsoftware.oidc.api.data.Session; import de.srsoftware.oidc.api.data.Session;
import de.srsoftware.oidc.api.data.User; 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.Result;
import de.srsoftware.tools.SessionToken; import de.srsoftware.tools.SessionToken;
import jakarta.mail.*; import jakarta.mail.*;
@ -198,7 +198,7 @@ public class UserController extends Controller {
var trust = body.has(TRUST) && body.getBoolean(TRUST); var trust = body.has(TRUST) && body.getBoolean(TRUST);
Result<User> result = users.login(username, password); Result<User> result = users.login(username, password);
if (result instanceof Content<User> user) return sendUserAndCookie(ex, sessions.createSession(user.get(), trust), user.get()); if (result instanceof Payload<User> user) return sendUserAndCookie(ex, sessions.createSession(user.get(), trust), user.get());
return sendContent(ex, HTTP_UNAUTHORIZED, result); return sendContent(ex, HTTP_UNAUTHORIZED, result);
} }

2
de.srsoftware.oidc.datastore.encrypted/build.gradle.kts

@ -3,7 +3,7 @@ description = "SRSoftware OIDC: encrypted datastore module"
dependencies{ dependencies{
implementation("com.sun.mail:jakarta.mail:2.0.1") implementation("com.sun.mail:jakarta.mail:2.0.1")
implementation("de.srsoftware:tools.optionals:1.0.0") 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.api"))
testImplementation(project(":de.srsoftware.oidc.api","testBundle")) testImplementation(project(":de.srsoftware.oidc.api","testBundle"))

4
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.UserService;
import de.srsoftware.oidc.api.data.AccessToken; import de.srsoftware.oidc.api.data.AccessToken;
import de.srsoftware.oidc.api.data.User; import de.srsoftware.oidc.api.data.User;
import de.srsoftware.tools.Content;
import de.srsoftware.tools.Error; import de.srsoftware.tools.Error;
import de.srsoftware.tools.PasswordHasher; import de.srsoftware.tools.PasswordHasher;
import de.srsoftware.tools.Payload;
import de.srsoftware.tools.Result; import de.srsoftware.tools.Result;
import java.util.*; 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); var match = List.of(decryptedUser.username(), decryptedUser.realName(), decryptedUser.email()).contains(username);
if (match && hasher.matches(password, decryptedUser.hashedPassword())) { if (match && hasher.matches(password, decryptedUser.hashedPassword())) {
this.unlock(username); this.unlock(username);
return Content.of(decryptedUser); return Payload.of(decryptedUser);
} }
} }

4
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.*;
import de.srsoftware.oidc.api.data.AccessToken; import de.srsoftware.oidc.api.data.AccessToken;
import de.srsoftware.oidc.api.data.User; import de.srsoftware.oidc.api.data.User;
import de.srsoftware.tools.Content;
import de.srsoftware.tools.Error; import de.srsoftware.tools.Error;
import de.srsoftware.tools.PasswordHasher; import de.srsoftware.tools.PasswordHasher;
import de.srsoftware.tools.Payload;
import de.srsoftware.tools.Result; import de.srsoftware.tools.Result;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
@ -83,7 +83,7 @@ public class EncryptedUserServiceTest extends UserServiceTest {
var user = entry.getValue(); var user = entry.getValue();
if (user.username().equals(username) && passwordMatches(password, user)) { if (user.username().equals(username) && passwordMatches(password, user)) {
unlock(username); unlock(username);
return Content.of(user); return Payload.of(user);
} }
} }
var lock = lock(username); var lock = lock(username);

2
de.srsoftware.oidc.datastore.file/build.gradle.kts

@ -3,7 +3,7 @@ description = "SRSoftware OIDC: file datastore module"
dependencies{ dependencies{
implementation("com.sun.mail:jakarta.mail:2.0.1") implementation("com.sun.mail:jakarta.mail:2.0.1")
implementation("de.srsoftware:tools.optionals:1.0.0") 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("org.json:json:20240303")
implementation(project(":de.srsoftware.oidc.api")) implementation(project(":de.srsoftware.oidc.api"))

4
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.*;
import de.srsoftware.oidc.api.data.*; import de.srsoftware.oidc.api.data.*;
import de.srsoftware.tools.Content;
import de.srsoftware.tools.Error; import de.srsoftware.tools.Error;
import de.srsoftware.tools.PasswordHasher; import de.srsoftware.tools.PasswordHasher;
import de.srsoftware.tools.Payload;
import de.srsoftware.tools.Result; import de.srsoftware.tools.Result;
import jakarta.mail.Authenticator; import jakarta.mail.Authenticator;
import jakarta.mail.PasswordAuthentication; 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)); var loadedUser = User.of(userData, userId).filter(u -> passwordMatches(password, u));
if (loadedUser.isPresent()) { if (loadedUser.isPresent()) {
unlock(username); unlock(username);
return Content.of(loadedUser.get()); return Payload.of(loadedUser.get());
} }
} }
var lock = lock(username); var lock = lock(username);

Loading…
Cancel
Save