diff --git a/services/gateway/security/src/main/java/org/eclipse/ditto/services/gateway/security/authentication/jwt/DittoPublicKeyProvider.java b/services/gateway/security/src/main/java/org/eclipse/ditto/services/gateway/security/authentication/jwt/DittoPublicKeyProvider.java index 77691ab00a..0742107439 100644 --- a/services/gateway/security/src/main/java/org/eclipse/ditto/services/gateway/security/authentication/jwt/DittoPublicKeyProvider.java +++ b/services/gateway/security/src/main/java/org/eclipse/ditto/services/gateway/security/authentication/jwt/DittoPublicKeyProvider.java @@ -69,7 +69,6 @@ public final class DittoPublicKeyProvider implements PublicKeyProvider { private static final Logger LOGGER = LoggerFactory.getLogger(DittoPublicKeyProvider.class); - private static final long JWK_REQUEST_TIMEOUT_MILLISECONDS = 5000; private static final String OPENID_CONNECT_DISCOVERY_PATH = "/.well-known/openid-configuration"; private static final JsonFieldDefinition JSON_JWKS_URI = JsonFieldDefinition.ofString("jwks_uri"); diff --git a/services/gateway/security/src/main/java/org/eclipse/ditto/services/gateway/security/authentication/jwt/JwtSubjectIssuerConfig.java b/services/gateway/security/src/main/java/org/eclipse/ditto/services/gateway/security/authentication/jwt/JwtSubjectIssuerConfig.java index 59ca32c7a1..60b99f9bc7 100644 --- a/services/gateway/security/src/main/java/org/eclipse/ditto/services/gateway/security/authentication/jwt/JwtSubjectIssuerConfig.java +++ b/services/gateway/security/src/main/java/org/eclipse/ditto/services/gateway/security/authentication/jwt/JwtSubjectIssuerConfig.java @@ -76,7 +76,7 @@ public int hashCode() { @Override public String toString() { return getClass().getSimpleName() + " [" + - ", issuer=" + issuer + + "issuer=" + issuer + ", subjectIssuer=" + subjectIssuer + "]"; } diff --git a/services/policies/persistence/src/main/java/org/eclipse/ditto/services/policies/persistence/actors/strategies/commands/DeactivateTokenIntegrationStrategy.java b/services/policies/persistence/src/main/java/org/eclipse/ditto/services/policies/persistence/actors/strategies/commands/DeactivateTokenIntegrationStrategy.java index 50018997a7..3fe9599b02 100644 --- a/services/policies/persistence/src/main/java/org/eclipse/ditto/services/policies/persistence/actors/strategies/commands/DeactivateTokenIntegrationStrategy.java +++ b/services/policies/persistence/src/main/java/org/eclipse/ditto/services/policies/persistence/actors/strategies/commands/DeactivateTokenIntegrationStrategy.java @@ -87,7 +87,7 @@ protected Result> doApply(final Context context, SubjectDeleted.of(policyId, label, subjectId, nextRevision, getEventTimestamp(), dittoHeaders); final DeactivateTokenIntegrationResponse rawResponse = - DeactivateTokenIntegrationResponse.of(policyId, label, subjectId, dittoHeaders); + DeactivateTokenIntegrationResponse.of(policyId, label, dittoHeaders); return ResultFactory.newMutationResult(adjustedCommand, event, rawResponse); } } else { diff --git a/services/policies/persistence/src/test/java/org/eclipse/ditto/services/policies/persistence/actors/strategies/commands/DeactivateTokenIntegrationStrategyTest.java b/services/policies/persistence/src/test/java/org/eclipse/ditto/services/policies/persistence/actors/strategies/commands/DeactivateTokenIntegrationStrategyTest.java index d38102d874..caa50fcb24 100644 --- a/services/policies/persistence/src/test/java/org/eclipse/ditto/services/policies/persistence/actors/strategies/commands/DeactivateTokenIntegrationStrategyTest.java +++ b/services/policies/persistence/src/test/java/org/eclipse/ditto/services/policies/persistence/actors/strategies/commands/DeactivateTokenIntegrationStrategyTest.java @@ -65,13 +65,12 @@ public void deactivateTokenIntegration() { final CommandStrategy.Context context = getDefaultContext(); final SubjectId subjectId = SubjectId.newInstance(SubjectIssuer.INTEGRATION, "{{policy-entry:label}}:this-is-me"); - final SubjectId expectedSubjectId = SubjectId.newInstance(SubjectIssuer.INTEGRATION, LABEL + ":this-is-me"); final DittoHeaders dittoHeaders = DittoHeaders.empty(); final DeactivateTokenIntegration command = DeactivateTokenIntegration.of(context.getState(), LABEL, subjectId, dittoHeaders); assertModificationResult(underTest, TestConstants.Policy.POLICY, command, SubjectDeleted.class, - DeactivateTokenIntegrationResponse.of(context.getState(), LABEL, expectedSubjectId, dittoHeaders)); + DeactivateTokenIntegrationResponse.of(context.getState(), LABEL, dittoHeaders)); } @Test diff --git a/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/ActivatePolicyTokenIntegrationResponse.java b/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/ActivatePolicyTokenIntegrationResponse.java index 735b6c09eb..311fc66435 100755 --- a/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/ActivatePolicyTokenIntegrationResponse.java +++ b/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/ActivatePolicyTokenIntegrationResponse.java @@ -51,7 +51,7 @@ public final class ActivatePolicyTokenIntegrationResponse /** * Status code of this response. */ - public static final HttpStatusCode STATUS = HttpStatusCode.OK; + public static final HttpStatusCode STATUS = HttpStatusCode.NO_CONTENT; private final PolicyId policyId; diff --git a/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/ActivateTokenIntegrationResponse.java b/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/ActivateTokenIntegrationResponse.java index 7796ef7798..73206c7a23 100755 --- a/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/ActivateTokenIntegrationResponse.java +++ b/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/ActivateTokenIntegrationResponse.java @@ -58,7 +58,7 @@ public final class ActivateTokenIntegrationResponse /** * Status code of this response. */ - public static final HttpStatusCode STATUS = HttpStatusCode.OK; + public static final HttpStatusCode STATUS = HttpStatusCode.NO_CONTENT; static final JsonFieldDefinition JSON_LABEL = JsonFactory.newStringFieldDefinition("label", FieldType.REGULAR, JsonSchemaVersion.V_2); diff --git a/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/DeactivatePolicyTokenIntegrationResponse.java b/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/DeactivatePolicyTokenIntegrationResponse.java index 45c89b7422..fe40ff0299 100755 --- a/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/DeactivatePolicyTokenIntegrationResponse.java +++ b/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/DeactivatePolicyTokenIntegrationResponse.java @@ -51,7 +51,7 @@ public final class DeactivatePolicyTokenIntegrationResponse /** * Status code of this response. */ - public static final HttpStatusCode STATUS = HttpStatusCode.OK; + public static final HttpStatusCode STATUS = HttpStatusCode.NO_CONTENT; private final PolicyId policyId; diff --git a/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/DeactivateTokenIntegrationResponse.java b/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/DeactivateTokenIntegrationResponse.java index 78e7047405..9fb37cd6cf 100755 --- a/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/DeactivateTokenIntegrationResponse.java +++ b/signals/commands/policies/src/main/java/org/eclipse/ditto/signals/commands/policies/actions/DeactivateTokenIntegrationResponse.java @@ -35,7 +35,6 @@ import org.eclipse.ditto.model.policies.Label; import org.eclipse.ditto.model.policies.Policy; import org.eclipse.ditto.model.policies.PolicyId; -import org.eclipse.ditto.model.policies.SubjectId; import org.eclipse.ditto.signals.commands.base.AbstractCommandResponse; import org.eclipse.ditto.signals.commands.policies.PolicyCommandResponse; @@ -58,25 +57,21 @@ public final class DeactivateTokenIntegrationResponse /** * Status code of this response. */ - public static final HttpStatusCode STATUS = HttpStatusCode.OK; + public static final HttpStatusCode STATUS = HttpStatusCode.NO_CONTENT; static final JsonFieldDefinition JSON_LABEL = JsonFactory.newStringFieldDefinition("label", FieldType.REGULAR, JsonSchemaVersion.V_2); - static final JsonFieldDefinition JSON_SUBJECT_ID = - JsonFactory.newStringFieldDefinition("subjectId", FieldType.REGULAR, JsonSchemaVersion.V_2); private final PolicyId policyId; private final Label label; - private final SubjectId subjectId; - private DeactivateTokenIntegrationResponse(final PolicyId policyId, final Label label, final SubjectId subjectId, + private DeactivateTokenIntegrationResponse(final PolicyId policyId, final Label label, final DittoHeaders dittoHeaders) { super(TYPE, STATUS, dittoHeaders); this.policyId = checkNotNull(policyId, "policyId"); this.label = checkNotNull(label, "label"); - this.subjectId = checkNotNull(subjectId, "subjectId"); } /** @@ -84,14 +79,13 @@ private DeactivateTokenIntegrationResponse(final PolicyId policyId, final Label * * @param policyId the policy ID. * @param label the policy entry label. - * @param subjectId the added subject ID. * @param dittoHeaders the headers of the preceding command. * @return the response. * @throws NullPointerException if any argument is {@code null}. */ - public static DeactivateTokenIntegrationResponse of(final PolicyId policyId, final Label label, final SubjectId subjectId, + public static DeactivateTokenIntegrationResponse of(final PolicyId policyId, final Label label, final DittoHeaders dittoHeaders) { - return new DeactivateTokenIntegrationResponse(policyId, label, subjectId, dittoHeaders); + return new DeactivateTokenIntegrationResponse(policyId, label, dittoHeaders); } /** @@ -109,8 +103,7 @@ public static DeactivateTokenIntegrationResponse fromJson(final JsonObject jsonO final PolicyId policyId = PolicyId.of(jsonObject.getValueOrThrow(PolicyCommandResponse.JsonFields.JSON_POLICY_ID)); final Label label = Label.of(jsonObject.getValueOrThrow(JSON_LABEL)); - final SubjectId subjectId = SubjectId.newInstance(jsonObject.getValueOrThrow(JSON_SUBJECT_ID)); - return new DeactivateTokenIntegrationResponse(policyId, label, subjectId, dittoHeaders); + return new DeactivateTokenIntegrationResponse(policyId, label, dittoHeaders); } @Override @@ -133,12 +126,11 @@ protected void appendPayload(final JsonObjectBuilder jsonObjectBuilder, final Js final Predicate predicate = schemaVersion.and(thePredicate); jsonObjectBuilder.set(PolicyCommandResponse.JsonFields.JSON_POLICY_ID, policyId.toString(), predicate); jsonObjectBuilder.set(JSON_LABEL, label.toString(), predicate); - jsonObjectBuilder.set(JSON_SUBJECT_ID, subjectId.toString(), predicate); } @Override public DeactivateTokenIntegrationResponse setDittoHeaders(final DittoHeaders dittoHeaders) { - return new DeactivateTokenIntegrationResponse(policyId, label, subjectId, dittoHeaders); + return new DeactivateTokenIntegrationResponse(policyId, label, dittoHeaders); } @Override @@ -157,13 +149,12 @@ public boolean equals(@Nullable final Object o) { final DeactivateTokenIntegrationResponse that = (DeactivateTokenIntegrationResponse) o; return Objects.equals(policyId, that.policyId) && Objects.equals(label, that.label) && - Objects.equals(subjectId, that.subjectId) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), policyId, label, subjectId); + return Objects.hash(super.hashCode(), policyId, label); } @Override @@ -172,7 +163,6 @@ public String toString() { " [" + super.toString() + ", policyId=" + policyId + ", label=" + label + - ", subjectId=" + subjectId + "]"; } diff --git a/signals/commands/policies/src/test/java/org/eclipse/ditto/signals/commands/policies/actions/DeactivateTokenIntegrationResponseTest.java b/signals/commands/policies/src/test/java/org/eclipse/ditto/signals/commands/policies/actions/DeactivateTokenIntegrationResponseTest.java index f7a07a6d7b..7567f7368d 100755 --- a/signals/commands/policies/src/test/java/org/eclipse/ditto/signals/commands/policies/actions/DeactivateTokenIntegrationResponseTest.java +++ b/signals/commands/policies/src/test/java/org/eclipse/ditto/signals/commands/policies/actions/DeactivateTokenIntegrationResponseTest.java @@ -39,7 +39,6 @@ public final class DeactivateTokenIntegrationResponseTest { .set(PolicyCommandResponse.JsonFields.STATUS, DeactivateTokenIntegrationResponse.STATUS.toInt()) .set(PolicyCommandResponse.JsonFields.JSON_POLICY_ID, TestConstants.Policy.POLICY_ID.toString()) .set(DeactivateTokenIntegrationResponse.JSON_LABEL, TestConstants.Policy.LABEL.toString()) - .set(DeactivateTokenIntegrationResponse.JSON_SUBJECT_ID, TestConstants.Policy.SUBJECT_ID.toString()) .build(); @Test @@ -59,27 +58,21 @@ public void testHashCodeAndEquals() { @Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullPolicyId() { DeactivateTokenIntegrationResponse.of(null, TestConstants.Policy.LABEL, - TestConstants.Policy.SUBJECT_ID, TestConstants.EMPTY_DITTO_HEADERS); + TestConstants.EMPTY_DITTO_HEADERS); } @Test(expected = NullPointerException.class) public void tryToCreateInstanceWithNullLabel() { DeactivateTokenIntegrationResponse.of(TestConstants.Policy.POLICY_ID, null, - TestConstants.Policy.SUBJECT_ID, TestConstants.EMPTY_DITTO_HEADERS); + TestConstants.EMPTY_DITTO_HEADERS); } - @Test(expected = NullPointerException.class) - public void tryToCreateInstanceWithNullSubject() { - DeactivateTokenIntegrationResponse.of(TestConstants.Policy.POLICY_ID, - TestConstants.Policy.LABEL, null, TestConstants.EMPTY_DITTO_HEADERS); - } - @Test public void toJsonReturnsExpected() { final DeactivateTokenIntegrationResponse underTest = DeactivateTokenIntegrationResponse.of(TestConstants.Policy.POLICY_ID, TestConstants.Policy.LABEL, - TestConstants.Policy.SUBJECT_ID, TestConstants.EMPTY_DITTO_HEADERS); + TestConstants.EMPTY_DITTO_HEADERS); final JsonObject actualJson = underTest.toJson(FieldType.regularOrSpecial()); assertThat(actualJson).isEqualTo(KNOWN_JSON); @@ -92,7 +85,7 @@ public void createInstanceFromValidJson() { final DeactivateTokenIntegrationResponse expectedCommand = DeactivateTokenIntegrationResponse.of(TestConstants.Policy.POLICY_ID, TestConstants.Policy.LABEL, - TestConstants.Policy.SUBJECT_ID, TestConstants.EMPTY_DITTO_HEADERS); + TestConstants.EMPTY_DITTO_HEADERS); assertThat(underTest).isEqualTo(expectedCommand); }