diff --git a/wls-common/exception/src/main/java/de/muenchen/oss/wahllokalsystem/wls/common/exception/errorhandler/WlsResponseErrorHandler.java b/wls-common/exception/src/main/java/de/muenchen/oss/wahllokalsystem/wls/common/exception/errorhandler/WlsResponseErrorHandler.java index a18a35f5f..0532ed8f7 100644 --- a/wls-common/exception/src/main/java/de/muenchen/oss/wahllokalsystem/wls/common/exception/errorhandler/WlsResponseErrorHandler.java +++ b/wls-common/exception/src/main/java/de/muenchen/oss/wahllokalsystem/wls/common/exception/errorhandler/WlsResponseErrorHandler.java @@ -43,7 +43,7 @@ public void handleError(@NonNull final ClientHttpResponse response) throws WlsEx throw createdException; } - public TechnischeWlsException createFalseObjectReferenceException (String Id,final Throwable cause){ + public TechnischeWlsException createFalseObjectReferenceException(String Id, final Throwable cause) { return TechnischeWlsException .withCode(ExceptionKonstanten.CODE_ALLGEMEIN_UNBEKANNT) .inService(Id).withCause(cause) diff --git a/wls-common/security/src/main/java/de/muenchen/wls/common/security/BezirkIDPermissionEvaluatorImpl.java b/wls-common/security/src/main/java/de/muenchen/wls/common/security/BezirkIDPermissionEvaluatorImpl.java index 87bf5b05b..1f2a95d04 100644 --- a/wls-common/security/src/main/java/de/muenchen/wls/common/security/BezirkIDPermissionEvaluatorImpl.java +++ b/wls-common/security/src/main/java/de/muenchen/wls/common/security/BezirkIDPermissionEvaluatorImpl.java @@ -42,6 +42,7 @@ public boolean tokenUserBezirkIdMatches(String bezirkId, Authentication auth) { return false; } } + private String getBezirkID(final Authentication auth) { val details = (Map) auth.getDetails(); return (String) details.get(WAHLBEZIRK_ID); diff --git a/wls-common/security/src/main/java/de/muenchen/wls/common/security/domain/BezirkUndWahlID.java b/wls-common/security/src/main/java/de/muenchen/wls/common/security/domain/BezirkUndWahlID.java index 7b7194438..1e3bd6770 100644 --- a/wls-common/security/src/main/java/de/muenchen/wls/common/security/domain/BezirkUndWahlID.java +++ b/wls-common/security/src/main/java/de/muenchen/wls/common/security/domain/BezirkUndWahlID.java @@ -1,4 +1,5 @@ package de.muenchen.wls.common.security.domain; + import lombok.AllArgsConstructor; import lombok.Data; import lombok.Getter; @@ -7,6 +8,7 @@ import java.io.Serializable; import java.util.Objects; + @Data @NoArgsConstructor @AllArgsConstructor diff --git a/wls-common/security/src/test/java/de/muenchen/wls/common/security/BezirkIDPermissionEvaluatorImplTest.java b/wls-common/security/src/test/java/de/muenchen/wls/common/security/BezirkIDPermissionEvaluatorImplTest.java index d9b02ba19..b3c45f1e4 100644 --- a/wls-common/security/src/test/java/de/muenchen/wls/common/security/BezirkIDPermissionEvaluatorImplTest.java +++ b/wls-common/security/src/test/java/de/muenchen/wls/common/security/BezirkIDPermissionEvaluatorImplTest.java @@ -16,18 +16,17 @@ class BezirkIDPermissionEvaluatorImplTest { - private final BezirkIDPermissionEvaluatorImpl unitUnderTest= new BezirkIDPermissionEvaluatorImpl(); + private final BezirkIDPermissionEvaluatorImpl unitUnderTest = new BezirkIDPermissionEvaluatorImpl(); @Nested class TestTokenUserBezirkIdMatches { - @RegisterExtension public LoggerExtension loggerExtension = new LoggerExtension(); @Test void warnOnAuthenticationIsNull() { - unitUnderTest.tokenUserBezirkIdMatches("1234",null); + unitUnderTest.tokenUserBezirkIdMatches("1234", null); Assertions.assertThat(loggerExtension.getFormattedMessages().contains("No authentication object for bezirkId=1234")).isTrue(); } diff --git a/wls-common/security/src/test/java/de/muenchen/wls/common/security/BezirkIDUndWaehlerverzeichnisNummerTest.java b/wls-common/security/src/test/java/de/muenchen/wls/common/security/BezirkIDUndWaehlerverzeichnisNummerTest.java index 7f9ab9192..c59418157 100644 --- a/wls-common/security/src/test/java/de/muenchen/wls/common/security/BezirkIDUndWaehlerverzeichnisNummerTest.java +++ b/wls-common/security/src/test/java/de/muenchen/wls/common/security/BezirkIDUndWaehlerverzeichnisNummerTest.java @@ -20,7 +20,8 @@ void returnsString() { val unitUnderTest = new BezirkIDUndWaehlerverzeichnisNummer(); unitUnderTest.setWaehlerverzeichnisNummer(Long.valueOf("1")); unitUnderTest.setWahlbezirkID("2"); - Assertions.assertThat(unitUnderTest.toString()).isEqualTo("BezirkIDUndWaehlerverzeichnisNummer{" + "wahlbezirkID='" + 2 + '\'' +", waehlerverzeichnisNummer=" + 1 +'}'); + Assertions.assertThat(unitUnderTest.toString()) + .isEqualTo("BezirkIDUndWaehlerverzeichnisNummer{" + "wahlbezirkID='" + 2 + '\'' + ", waehlerverzeichnisNummer=" + 1 + '}'); } @Test diff --git a/wls-common/security/src/test/java/de/muenchen/wls/common/security/BezirkUndWahlIDTest.java b/wls-common/security/src/test/java/de/muenchen/wls/common/security/BezirkUndWahlIDTest.java index f591ae242..f69c45b53 100644 --- a/wls-common/security/src/test/java/de/muenchen/wls/common/security/BezirkUndWahlIDTest.java +++ b/wls-common/security/src/test/java/de/muenchen/wls/common/security/BezirkUndWahlIDTest.java @@ -20,7 +20,8 @@ void returnsString() { val unitUnderTest = new BezirkUndWahlID(); unitUnderTest.setWahlID("1"); unitUnderTest.setWahlbezirkID("2"); - Assertions.assertThat(unitUnderTest.toString()).isEqualTo("de.muenchen.wls.common.security.domain.BezirkUndWahlID{" + "wahlID='" + 1 + '\'' +", wahlbezirkID='" + 2 + '\'' +'}'); + Assertions.assertThat(unitUnderTest.toString()) + .isEqualTo("de.muenchen.wls.common.security.domain.BezirkUndWahlID{" + "wahlID='" + 1 + '\'' + ", wahlbezirkID='" + 2 + '\'' + '}'); } @Test diff --git a/wls-common/security/src/test/java/de/muenchen/wls/common/security/DummyBezirkIdPermissionEvaluatorImplTest.java b/wls-common/security/src/test/java/de/muenchen/wls/common/security/DummyBezirkIdPermissionEvaluatorImplTest.java index 1dd3166e7..71a200636 100644 --- a/wls-common/security/src/test/java/de/muenchen/wls/common/security/DummyBezirkIdPermissionEvaluatorImplTest.java +++ b/wls-common/security/src/test/java/de/muenchen/wls/common/security/DummyBezirkIdPermissionEvaluatorImplTest.java @@ -1,4 +1,5 @@ package de.muenchen.wls.common.security; + import de.muenchen.wls.common.security.testultils.LoggerExtension; import lombok.val; import org.assertj.core.api.Assertions; @@ -15,7 +16,7 @@ class DummyBezirkIdPermissionEvaluatorImplTest { - private final DummyBezirkIdPermissionEvaluatorImpl unitUnderTest= new DummyBezirkIdPermissionEvaluatorImpl(); + private final DummyBezirkIdPermissionEvaluatorImpl unitUnderTest = new DummyBezirkIdPermissionEvaluatorImpl(); @Nested class TestLoggingEvents { diff --git a/wls-common/security/src/test/java/de/muenchen/wls/common/security/EncryptionBuilderTest.java b/wls-common/security/src/test/java/de/muenchen/wls/common/security/EncryptionBuilderTest.java index 77b416690..6cd51a529 100644 --- a/wls-common/security/src/test/java/de/muenchen/wls/common/security/EncryptionBuilderTest.java +++ b/wls-common/security/src/test/java/de/muenchen/wls/common/security/EncryptionBuilderTest.java @@ -12,7 +12,6 @@ import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; - class EncryptionBuilderTest { @RegisterExtension @@ -60,11 +59,11 @@ void throwBadPadding() throws NoSuchPaddingException, NoSuchAlgorithmException, random.nextBytes(aByte); val unitUnderTest = new EncryptionBuilder(aByte); try { - unitUnderTest.encryptValue("376526723AFDAB3D"); + unitUnderTest.encryptValue("376526723AFDAB3D"); } catch (Exception e) { Assertions.assertThat(loggerExtension.getFormattedMessages().size()).isEqualTo(1); } - } + } } }