diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/CommitUpgradeRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/CommitUpgradeRequest.java index b8a3061c5..784f672fd 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/CommitUpgradeRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/CommitUpgradeRequest.java @@ -18,6 +18,8 @@ package com.wultra.security.powerauth.client.model.request; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; import lombok.Data; /** @@ -28,7 +30,12 @@ @Data public class CommitUpgradeRequest { + @Schema(description = "Activation identifier") + @NotEmpty(message = "Activation ID must not be empty when commiting upgrade") private String activationId; + + @Schema(description = "Application key") + @NotEmpty(message = "Application key must not be empty when commiting upgrade") private String applicationKey; } diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/CreateIntegrationRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/CreateIntegrationRequest.java index e61d0e786..33575218b 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/CreateIntegrationRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/CreateIntegrationRequest.java @@ -31,7 +31,7 @@ public class CreateIntegrationRequest { @Schema(description = "Integration name") - @NotBlank(message = "Integration name must not be empty when creating integration") + @NotBlank(message = "Integration name must not be empty when creating an integration") private String name; } diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/CreateTokenRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/CreateTokenRequest.java index d4268dd79..ccbc77d11 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/CreateTokenRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/CreateTokenRequest.java @@ -19,6 +19,9 @@ package com.wultra.security.powerauth.client.model.request; import com.wultra.security.powerauth.client.model.enumeration.SignatureType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.ToString; @@ -30,16 +33,42 @@ @Data public class CreateTokenRequest { + @Schema(description = "Activation identifier") + @NotBlank(message = "Activation ID must not be empty when creating token") private String activationId; + + @Schema(description = "Application key") + @NotBlank(message = "Application key must not be empty when creating token") private String applicationKey; + + @Schema(description = "Identifier of the temporary key for encryption") private String temporaryKeyId; + + @Schema(description = "Ephemeral public key used in encryption") + @NotBlank(message = "Ephemeral public key must not be empty when creating token") private String ephemeralPublicKey; + + @Schema(description = "Encrypted data used in encryption") + @NotBlank(message = "Encrypted data must not be empty when creating token") private String encryptedData; + + @Schema(description = "Value of MAC used in encryption") + @NotBlank(message = "Value of MAC must not be empty when creating token") private String mac; + + @Schema(description = "Activation nonce value") @ToString.Exclude private String nonce; + + @Schema(description = "Signature type") + @NotNull(message = "Signature type must not be null when creating token") private SignatureType signatureType; + + @Schema(description = "Cryptography protocol version") + @NotBlank(message = "Protocol must not be empty when creating token") private String protocolVersion; + + @Schema(description = "Timestamp value used in encryption") private Long timestamp; } diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/GetCallbackUrlListRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/GetCallbackUrlListRequest.java index 94e64a148..d90bc3ecf 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/GetCallbackUrlListRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/GetCallbackUrlListRequest.java @@ -31,7 +31,7 @@ public class GetCallbackUrlListRequest { @Schema(description = "The identifier of the application") - @NotBlank(message = "Application ID must not be empty when creating a callback") + @NotBlank(message = "Application ID must not be empty when fetching callback list") private String applicationId; } diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/GetErrorCodeListRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/GetErrorCodeListRequest.java index d2d118d98..2a5915c3f 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/GetErrorCodeListRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/GetErrorCodeListRequest.java @@ -18,6 +18,7 @@ package com.wultra.security.powerauth.client.model.request; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; /** @@ -28,6 +29,7 @@ @Data public class GetErrorCodeListRequest { + @Schema(description = "ISO 639 language code") private String language; } diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/OperationApproveRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/OperationApproveRequest.java index 3ea28d2de..c529af58d 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/OperationApproveRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/OperationApproveRequest.java @@ -53,7 +53,7 @@ public class OperationApproveRequest { @NotBlank(message = "Data must not be empty when approving operation") private String data; - @Schema(description = "PowerAuth signature type") + @Schema(description = "Signature type") @NotNull(message = "Signature type must not be null when approving operation") private SignatureType signatureType; diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RecoveryCodeActivationRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RecoveryCodeActivationRequest.java index 545a6679d..56a794abf 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RecoveryCodeActivationRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RecoveryCodeActivationRequest.java @@ -77,7 +77,7 @@ public class RecoveryCodeActivationRequest { private String activationOtp; @Schema(description = "Cryptography protocol version") - @NotBlank(message = "Protocol version must not be empty when preparing activation") + @NotBlank(message = "Protocol version must not be empty when creating activation using recovery code") private String protocolVersion; @Schema(description = "Timestamp value used in encryption") diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RemoveIntegrationRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RemoveIntegrationRequest.java index afe984dd2..a6f5c6e17 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RemoveIntegrationRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RemoveIntegrationRequest.java @@ -31,7 +31,7 @@ public class RemoveIntegrationRequest { @Schema(description = "Integration identifier") - @NotBlank(message = "Integration identifier must not be empty when removing integration") + @NotBlank(message = "Integration identifier must not be empty when removing an integration") private String id; } diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RemoveTemporaryPublicKeyRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RemoveTemporaryPublicKeyRequest.java index b06b20d43..5646dbb5f 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RemoveTemporaryPublicKeyRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RemoveTemporaryPublicKeyRequest.java @@ -18,6 +18,8 @@ package com.wultra.security.powerauth.client.model.request; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; import lombok.Data; /** @@ -28,6 +30,8 @@ @Data public class RemoveTemporaryPublicKeyRequest { + @Schema(description = "Temporary public key identifier") + @NotBlank(message = "Temporary public key identifier must not be empty when removing a temporary public key") private String id; } diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RemoveTokenRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RemoveTokenRequest.java index 08385a828..ea92c1ff4 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RemoveTokenRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/RemoveTokenRequest.java @@ -18,6 +18,8 @@ package com.wultra.security.powerauth.client.model.request; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; import lombok.Data; /** @@ -28,7 +30,12 @@ @Data public class RemoveTokenRequest { + @Schema(description = "Token identifier") + @NotBlank(message = "Token ID must not be empty when removing token") private String tokenId; + + @Schema(description = "Activation identifier") + @NotBlank(message = "Activation ID must not be empty when removing token") private String activationId; } diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/StartUpgradeRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/StartUpgradeRequest.java index b7a8ee8af..03dcec239 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/StartUpgradeRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/StartUpgradeRequest.java @@ -18,6 +18,10 @@ package com.wultra.security.powerauth.client.model.request; +import com.wultra.security.powerauth.client.model.enumeration.SignatureType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.ToString; @@ -29,15 +33,42 @@ @Data public class StartUpgradeRequest { + @Schema(description = "Activation identifier") + @NotBlank(message = "Activation ID must not be empty when starting upgrade") private String activationId; + + @Schema(description = "Application key") + @NotBlank(message = "Application key must not be empty when starting upgrade") private String applicationKey; + + @Schema(description = "Identifier of the temporary key for encryption") private String temporaryKeyId; + + @Schema(description = "Ephemeral public key used in encryption") + @NotBlank(message = "Ephemeral public key must not be empty when starting upgrade") private String ephemeralPublicKey; + + @Schema(description = "Encrypted data used in encryption") + @NotBlank(message = "Encrypted data must not be empty when starting upgrade") private String encryptedData; + + @Schema(description = "Value of MAC used in encryption") + @NotBlank(message = "Value of MAC must not be empty when starting upgrade") private String mac; + + @Schema(description = "Activation nonce value") @ToString.Exclude private String nonce; + + @Schema(description = "Signature type") + @NotNull(message = "Signature type must not be null when starting upgrade") + private SignatureType signatureType; + + @Schema(description = "Cryptography protocol version") + @NotBlank(message = "Protocol must not be empty when starting upgrade") private String protocolVersion; + + @Schema(description = "Timestamp value used in encryption") private Long timestamp; } diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/TelemetryReportRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/TelemetryReportRequest.java index 963267090..a241abbd8 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/TelemetryReportRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/TelemetryReportRequest.java @@ -18,6 +18,7 @@ package com.wultra.security.powerauth.client.model.request; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; @@ -32,8 +33,11 @@ @Data public class TelemetryReportRequest { - @NotBlank + @Schema(description = "Telemetry report name") + @NotBlank(message = "Telemetry report name must not be empty when requesting telemetry report") private String name; + + @Schema(description = "Telemetry report parameters") private Map parameters = new HashMap<>(); } diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/TemporaryPublicKeyRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/TemporaryPublicKeyRequest.java index 9947478f6..aea418d3b 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/TemporaryPublicKeyRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/TemporaryPublicKeyRequest.java @@ -18,6 +18,8 @@ package com.wultra.security.powerauth.client.model.request; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; import lombok.Data; /** @@ -28,6 +30,8 @@ @Data public class TemporaryPublicKeyRequest { + @Schema(description = "JWT claims for the temporary public key request") + @NotBlank(message = "Parameter jwt must not be empty when requesting temporary public key") private String jwt; } diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/UpdateCallbackUrlRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/UpdateCallbackUrlRequest.java index 8e5266a3e..09e75050a 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/UpdateCallbackUrlRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/UpdateCallbackUrlRequest.java @@ -56,7 +56,7 @@ public class UpdateCallbackUrlRequest { private CallbackUrlType type; @Schema(description = "Callback URL") - @NotBlank(message = "Callback URL must not be empty when creating a callback") + @NotBlank(message = "Callback URL must not be empty when updating a callback") private String callbackUrl; @Schema(description = "Callback attributes") diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/ValidateTokenRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/ValidateTokenRequest.java index 0a03d998a..01566ef43 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/ValidateTokenRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/ValidateTokenRequest.java @@ -18,7 +18,10 @@ package com.wultra.security.powerauth.client.model.request; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; import lombok.Data; import lombok.ToString; @@ -30,21 +33,27 @@ @Data public class ValidateTokenRequest { - @NotNull + @Schema(description = "Token identifier") + @NotBlank(message = "Token ID must not be empty when validating token") private String tokenId; @ToString.Exclude - @NotNull + @Schema(description = "Token digest") + @NotBlank(message = "Token digest must not be empty when validating token") private String tokenDigest; - @NotNull + @Schema(description = "Nonce") + @NotBlank(message = "Parameter nonce must not be empty when validating token") @ToString.Exclude private String nonce; - @NotNull + @Schema(description = "Cryptography protocol version") + @NotBlank(message = "Protocol version must not be empty when validating token") private String protocolVersion; - @NotNull + @Schema(description = "Timestamp") + @NotNull(message = "Timestamp must not be null when validating token") + @Positive(message = "Invalid timestamp value when validating token") private long timestamp; } diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/VaultUnlockRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/VaultUnlockRequest.java index 425de42b8..df2c968f5 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/VaultUnlockRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/VaultUnlockRequest.java @@ -19,6 +19,9 @@ package com.wultra.security.powerauth.client.model.request; import com.wultra.security.powerauth.client.model.enumeration.SignatureType; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import lombok.Data; import lombok.ToString; @@ -30,19 +33,59 @@ @Data public class VaultUnlockRequest { + @Schema(description = "Activation identifier") + @NotBlank(message = "Activation ID must not be empty when unlocking vault") private String activationId; + + @Schema(description = "Application key") + @NotBlank(message = "Application key must not be empty when unlocking vault") private String applicationKey; + + @Schema(description = "Signed data") + @NotBlank(message = "Signed data must not be empty when unlocking vault") private String signedData; + + @Schema(description = "Signature") + @NotBlank(message = "Signature must not be empty when unlocking vault") @ToString.Exclude private String signature; + + @Schema(description = "Signature type") + @NotNull(message = "Signature type must not be empty when unlocking vault") private SignatureType signatureType; + + @Schema(description = "Signature version") + @NotNull(message = "Signature version must not be empty when unlocking vault") private String signatureVersion; + + @Schema(description = "Identifier of the temporary key for encryption") private String temporaryKeyId; + + @Schema(description = "Ephemeral public key used in encryption") + @NotBlank(message = "Ephemeral public key must not be empty when unlocking vault") private String ephemeralPublicKey; + + @Schema(description = "Encrypted data used in encryption") + @NotBlank(message = "Encrypted data must not be empty when unlocking vault") private String encryptedData; + + @Schema(description = "Value of MAC used in encryption") + @NotBlank(message = "Value of MAC must not be empty when unlocking vault") private String mac; + + @Schema(description = "Activation nonce value") @ToString.Exclude private String nonce; + + @Schema(description = "Activation OTP value") + @ToString.Exclude + private String activationOtp; + + @Schema(description = "Cryptography protocol version") + @NotBlank(message = "Protocol must not be empty when unlocking vault") + private String protocolVersion; + + @Schema(description = "Timestamp value used in encryption") private Long timestamp; } diff --git a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/VerifySignatureRequest.java b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/VerifySignatureRequest.java index 6d48631bc..6ab16226b 100644 --- a/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/VerifySignatureRequest.java +++ b/powerauth-client-model/src/main/java/com/wultra/security/powerauth/client/model/request/VerifySignatureRequest.java @@ -50,7 +50,7 @@ public class VerifySignatureRequest { @ToString.Exclude private String signature; - @Schema(description = "Signature") + @Schema(description = "Signature type") @NotNull(message = "Signature type must not be null when verifying signature") private SignatureType signatureType; diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ActivationController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ActivationController.java index 7fc424d89..ac2eba44e 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ActivationController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ActivationController.java @@ -64,7 +64,7 @@ public ObjectResponse initActivation(@Valid @RequestBody final InitActivationRequest req = request.getRequestObject(); logger.info("action: initActivation, state: initiated, userId: {}, application: {}", req.getUserId(), req.getApplicationId()); logger.debug("action: initActivation, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.initActivation(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.initActivation(req)); logger.info("action: initActivation, state: succeeded"); logger.debug("action: initActivation, state: succeeded, response: {}", response); return response; @@ -82,7 +82,7 @@ public ObjectResponse prepareActivation(@Valid @Reque final PrepareActivationRequest req = request.getRequestObject(); logger.info("action: prepareActivation, state: initiated, applicationKey: {}", req.getApplicationKey()); logger.debug("action: prepareActivation, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.prepareActivation(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.prepareActivation(req)); logger.info("action: prepareActivation, state: succeeded"); logger.debug("action: prepareActivation, state: succeeded, response: {}", response); return response; @@ -100,7 +100,7 @@ public ObjectResponse createActivation(@Valid @Request final CreateActivationRequest req = request.getRequestObject(); logger.info("action: createActivation, state: initiated, userId: {}, applicationKey: {}", req.getUserId(), req.getApplicationKey()); logger.debug("action: createActivation, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.createActivation(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.createActivation(req)); logger.info("action: createActivation, state: succeeded"); logger.debug("action: createActivation, state: succeeded, response: {}", response); return response; @@ -118,7 +118,7 @@ public ObjectResponse createActivationUsingRecov final RecoveryCodeActivationRequest req = request.getRequestObject(); logger.info("action: createActivationUsingRecoveryCode, state: initiated, applicationKey: {}", req.getApplicationKey()); logger.debug("action: createActivationUsingRecoveryCode, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.createActivationUsingRecoveryCode(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.createActivationUsingRecoveryCode(req)); logger.info("action: createActivationUsingRecoveryCode, state: succeeded"); logger.debug("action: createActivationUsingRecoveryCode, state: succeeded, response: {}", response); return response; @@ -136,7 +136,7 @@ public ObjectResponse updateActivationOtp(@Valid @R final UpdateActivationOtpRequest req = request.getRequestObject(); logger.info("action: updateActivationOtp, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: updateActivationOtp, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.updateActivationOtp(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.updateActivationOtp(req)); logger.info("action: updateActivationOtp, state: succeeded"); logger.debug("action: updateActivationOtp, state: succeeded, response: {}", response); return response; @@ -154,7 +154,7 @@ public ObjectResponse commitActivation(@Valid @Request final CommitActivationRequest req = request.getRequestObject(); logger.info("action: commitActivation, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: commitActivation, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.commitActivation(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.commitActivation(req)); logger.info("action: commitActivation, state: succeeded"); logger.debug("action: commitActivation, state: succeeded, response: {}", response); return response; @@ -172,7 +172,7 @@ public ObjectResponse getActivationStatus(@Valid @R final GetActivationStatusRequest req = request.getRequestObject(); logger.info("action: getActivationStatus, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: getActivationStatus, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.getActivationStatus(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.getActivationStatus(req)); logger.info("action: getActivationStatus, state: succeeded"); logger.debug("action: getActivationStatus, state: succeeded, response: {}", response); return response; @@ -190,7 +190,7 @@ public ObjectResponse blockActivation(@Valid @RequestBo final BlockActivationRequest req = request.getRequestObject(); logger.info("action: blockActivation, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: blockActivation, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.blockActivation(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.blockActivation(req)); logger.info("action: blockActivation, state: succeeded"); logger.debug("action: blockActivation, state: succeeded, response: {}", response); return response; @@ -208,7 +208,7 @@ public ObjectResponse unblockActivation(@Valid @Reque final UnblockActivationRequest req = request.getRequestObject(); logger.info("action: unblockActivation, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: unblockActivation, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.unblockActivation(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.unblockActivation(req)); logger.info("action: unblockActivation, state: succeeded"); logger.debug("action: unblockActivation, state: succeeded, response: {}", response); return response; @@ -226,7 +226,7 @@ public ObjectResponse removeActivation(@Valid @Request final RemoveActivationRequest req = request.getRequestObject(); logger.info("action: removeActivation, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: removeActivation, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.removeActivation(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.removeActivation(req)); logger.info("action: removeActivation, state: succeeded"); logger.debug("action: removeActivation, state: succeeded, response: {}", response); return response; @@ -246,7 +246,7 @@ public ObjectResponse getActivationListForUser final GetActivationListForUserRequest req = request.getRequestObject(); logger.info("action: getActivationListForUser, state: initiated, userId: {}", req.getUserId()); logger.debug("action: getActivationListForUser, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.getActivationList(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.getActivationList(req)); logger.info("action: getActivationListForUser, state: succeeded"); logger.debug("action: getActivationListForUser, state: succeeded, response: {}", response); return response; @@ -264,7 +264,7 @@ public ObjectResponse updateActivation(@Valid @Req final UpdateActivationNameRequest req = request.getRequestObject(); logger.info("action: updateActivation, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: updateActivation, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.updateActivationName(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.updateActivationName(req)); logger.info("action: updateActivation, state: succeeded"); logger.debug("action: updateActivation, state: succeeded, response: {}", response); return response; @@ -279,9 +279,10 @@ public ObjectResponse updateActivation(@Valid @Req */ @PostMapping("/lookup") public ObjectResponse lookupActivations(@Valid @RequestBody ObjectRequest request) throws Exception { + final LookupActivationsRequest req = request.getRequestObject(); logger.info("action: lookupActivations, state: initiated"); logger.debug("action: lookupActivations, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.lookupActivations(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.lookupActivations(req)); logger.info("action: lookupActivations, state: succeeded"); logger.debug("action: lookupActivations, state: succeeded, response: {}", response); return response; @@ -296,9 +297,10 @@ public ObjectResponse lookupActivations(@Valid @Reque */ @PostMapping("/status/update") public ObjectResponse updateStatusForActivations(@Valid @RequestBody ObjectRequest request) throws Exception { + final UpdateStatusForActivationsRequest req = request.getRequestObject(); logger.info("action: updateStatusForActivations, state: initiated"); logger.debug("action: updateStatusForActivations, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.updateStatusForActivation(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(activationServiceBehavior.updateStatusForActivation(req)); logger.info("action: updateStatusForActivations, state: succeeded"); logger.debug("action: updateStatusForActivations, state: succeeded, response: {}", response); return response; diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ActivationFlagsController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ActivationFlagsController.java index 887ca72e5..ac93c18db 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ActivationFlagsController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ActivationFlagsController.java @@ -67,7 +67,7 @@ public ObjectResponse listActivationFlags(@Valid @R final ListActivationFlagsRequest req = request.getRequestObject(); logger.info("action: listActivationFlags, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: listActivationFlags, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.listActivationFlags(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.listActivationFlags(req)); logger.info("action: listActivationFlags, state: succeeded"); logger.debug("action: listActivationFlags, state: succeeded, response: {}", response); return response; @@ -85,7 +85,7 @@ public ObjectResponse addActivationFlags(@Valid @Req final AddActivationFlagsRequest req = request.getRequestObject(); logger.info("action: addActivationFlags, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: addActivationFlags, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.addActivationFlags(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.addActivationFlags(req)); logger.info("action: addActivationFlags, state: succeeded"); logger.debug("action: addActivationFlags, state: succeeded, response: {}", response); return response; @@ -103,7 +103,7 @@ public ObjectResponse updateActivationFlags(@Vali final UpdateActivationFlagsRequest req = request.getRequestObject(); logger.info("action: updateActivationFlags, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: updateActivationFlags, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.updateActivationFlags(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.updateActivationFlags(req)); logger.info("action: updateActivationFlags, state: succeeded"); logger.debug("action: updateActivationFlags, state: succeeded, response: {}", response); return response; @@ -121,7 +121,7 @@ public ObjectResponse removeActivationFlags(@Vali final RemoveActivationFlagsRequest req = request.getRequestObject(); logger.info("action: removeActivationFlags, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: removeActivationFlags, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.removeActivationFlags(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.removeActivationFlags(req)); logger.info("action: removeActivationFlags, state: succeeded"); logger.debug("action: removeActivationFlags, state: succeeded, response: {}", response); return response; diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ActivationHistoryController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ActivationHistoryController.java index 434f5239b..c7acd4005 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ActivationHistoryController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ActivationHistoryController.java @@ -64,7 +64,7 @@ public ObjectResponse getActivationHistory(@Valid @Re final ActivationHistoryRequest req = request.getRequestObject(); logger.info("action: getActivationHistory, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: getActivationHistory, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.getActivationHistory(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.getActivationHistory(req)); logger.info("action: getActivationHistory, state: succeeded"); logger.debug("action: getActivationHistory, state: succeeded, response: {}", response); return response; diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationCallbackController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationCallbackController.java index 759809091..6973a3b19 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationCallbackController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationCallbackController.java @@ -67,7 +67,7 @@ public ObjectResponse createCallbackUrl(@Valid @Reque final CreateCallbackUrlRequest req = request.getRequestObject(); logger.info("action: createCallbackUrl, state: initiated, applicationId: {}", req.getApplicationId()); logger.debug("action: createCallbackUrl, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.createCallbackUrl(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.createCallbackUrl(req)); logger.info("action: createCallbackUrl, state: succeeded"); logger.debug("action: createCallbackUrl, state: succeeded, response: {}", response); return response; @@ -85,7 +85,7 @@ public ObjectResponse updateCallbackUrl(@Valid @Reque final UpdateCallbackUrlRequest req = request.getRequestObject(); logger.info("action: updateCallbackUrl, state: initiated, callbackId: {}", req.getId()); logger.debug("action: updateCallbackUrl, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.updateCallbackUrl(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.updateCallbackUrl(req)); logger.info("action: updateCallbackUrl, state: succeeded"); logger.debug("action: updateCallbackUrl, state: succeeded, response: {}", response); return response; @@ -103,7 +103,7 @@ public ObjectResponse getCallbackUrlList(@Valid @Req final GetCallbackUrlListRequest req = request.getRequestObject(); logger.info("action: getCallbackUrlList, state: initiated, applicationId: {}", req.getApplicationId()); logger.debug("action: getCallbackUrlList, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.getCallbackUrlList(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.getCallbackUrlList(req)); logger.info("action: getCallbackUrlList, state: succeeded"); logger.debug("action: getCallbackUrlList, state: succeeded, response: {}", response); return response; @@ -121,7 +121,7 @@ public ObjectResponse removeCallbackUrl(@Valid @Reque final RemoveCallbackUrlRequest req = request.getRequestObject(); logger.info("action: removeCallbackUrl, state: initiated, callbackId: {}", req.getId()); logger.debug("action: removeCallbackUrl, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.removeCallbackUrl(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.removeCallbackUrl(req)); logger.info("action: removeCallbackUrl, state: succeeded"); logger.debug("action: removeCallbackUrl, state: succeeded, response: {}", response); return response; diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationConfigController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationConfigController.java index 6cfbbb902..150a2830b 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationConfigController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationConfigController.java @@ -68,7 +68,7 @@ public ObjectResponse getApplicationConfig(@Valid final GetApplicationConfigRequest req = request.getRequestObject(); logger.info("action: getApplicationConfig, state: initiated, applicationId: {}", req.getApplicationId()); logger.debug("action: getApplicationConfig, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.getApplicationConfig(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.getApplicationConfig(req)); logger.info("action: getApplicationConfig, state: succeeded"); logger.debug("action: getApplicationConfig, state: succeeded, response: {}", response); return response; @@ -86,7 +86,7 @@ public ObjectResponse createApplicationConfig(@ final CreateApplicationConfigRequest req = request.getRequestObject(); logger.info("action: createApplicationConfig, state: initiated, applicationId: {}, key: {}", req.getApplicationId(), req.getKey()); logger.debug("action: createApplicationConfig, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.createApplicationConfig(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.createApplicationConfig(req)); logger.info("action: createApplicationConfig, state: succeeded"); logger.debug("action: createApplicationConfig, state: succeeded, response: {}", response); return response; @@ -104,7 +104,7 @@ public Response removeApplicationConfig(@Valid @RequestBody ObjectRequest createApplication(@Valid @Requ final CreateApplicationRequest req = request.getRequestObject(); logger.info("action: createApplication, state: initiated, applicationId: {}", req.getApplicationId()); logger.debug("action: createApplication, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(applicationService.createApplication(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(applicationService.createApplication(req)); logger.info("action: createApplication, state: succeeded"); logger.debug("action: createApplication, state: succeeded, response: {}", response); return response; @@ -103,7 +103,7 @@ public ObjectResponse getApplicationDetail(@Valid final GetApplicationDetailRequest req = request.getRequestObject(); logger.info("action: getApplicationDetail, state: initiated, applicationId: {}", req.getApplicationId()); logger.debug("action: getApplicationDetail, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(applicationService.getApplicationDetail(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(applicationService.getApplicationDetail(req)); logger.info("action: getApplicationDetail, state: succeeded"); logger.debug("action: getApplicationDetail, state: succeeded, response: {}", response); return response; @@ -121,7 +121,7 @@ public ObjectResponse lookupApplicationByAppK final LookupApplicationByAppKeyRequest req = request.getRequestObject(); logger.info("action: lookupApplicationByAppKey, state: initiated, applicationKey: {}", req.getApplicationKey()); logger.debug("action: lookupApplicationByAppKey, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(applicationService.lookupApplicationByAppKey(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(applicationService.lookupApplicationByAppKey(req)); logger.info("action: lookupApplicationByAppKey, state: succeeded"); logger.debug("action: lookupApplicationByAppKey, state: succeeded, response: {}", response); return response; diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationRolesController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationRolesController.java index e442c5ad0..76148a406 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationRolesController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationRolesController.java @@ -70,7 +70,7 @@ public ObjectResponse listApplicationRoles(@Valid final ListApplicationRolesRequest req = request.getRequestObject(); logger.info("action: listApplicationRoles, state: initiated, applicationId: {}", req.getApplicationId()); logger.debug("action: listApplicationRoles, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.listApplicationRoles(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.listApplicationRoles(req)); logger.info("action: listApplicationRoles, state: succeeded"); logger.debug("action: listApplicationRoles, state: succeeded, response: {}", response); return response; @@ -88,7 +88,7 @@ public ObjectResponse addApplicationRoles(@Valid @R final AddApplicationRolesRequest req = request.getRequestObject(); logger.info("action: addApplicationRoles, state: initiated, applicationId: {}", req.getApplicationId()); logger.debug("action: addApplicationRoles, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.addApplicationRoles(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.addApplicationRoles(req)); logger.info("action: addApplicationRoles, state: succeeded"); logger.debug("action: addApplicationRoles, state: succeeded, response: {}", response); return response; @@ -106,7 +106,7 @@ public ObjectResponse updateApplicationRoles(@Va final UpdateApplicationRolesRequest req = request.getRequestObject(); logger.info("action: updateApplicationRoles, state: initiated, applicationId: {}", req.getApplicationId()); logger.debug("action: updateApplicationRoles, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.updateApplicationRoles(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.updateApplicationRoles(req)); logger.info("action: updateApplicationRoles, state: succeeded"); logger.debug("action: updateApplicationRoles, state: succeeded, response: {}", response); return response; @@ -124,7 +124,7 @@ public ObjectResponse removeApplicationRoles(@Va final RemoveApplicationRolesRequest req = request.getRequestObject(); logger.info("action: removeApplicationRoles, state: initiated, applicationId: {}", req.getApplicationId()); logger.debug("action: removeApplicationRoles, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.removeApplicationRoles(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.removeApplicationRoles(req)); logger.info("action: removeApplicationRoles, state: succeeded"); logger.debug("action: removeApplicationRoles, state: succeeded, response: {}", response); return response; diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationVersionsController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationVersionsController.java index 1d2270ccc..6de976299 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationVersionsController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/ApplicationVersionsController.java @@ -68,7 +68,7 @@ public ObjectResponse createApplicationVersion final CreateApplicationVersionRequest req = request.getRequestObject(); logger.info("action: createApplicationVersion, state: initiated, applicationId: {}, versionId: {}", req.getApplicationId(), req.getApplicationVersionId()); logger.debug("action: createApplicationVersion, state: initiated, request: {}", request); - final CreateApplicationVersionResponse response = applicationServiceBehavior.createApplicationVersion(request.getRequestObject()); + final CreateApplicationVersionResponse response = applicationServiceBehavior.createApplicationVersion(req); logger.info("action: createApplicationVersion, state: succeeded"); logger.debug("action: createApplicationVersion, state: succeeded, response: {}", response); return new ObjectResponse<>(response); @@ -86,7 +86,7 @@ public ObjectResponse unsupportApplicationV final UnsupportApplicationVersionRequest req = request.getRequestObject(); logger.info("action: unsupportApplicationVersion, state: initiated, applicationId: {}, versionId: {}", req.getApplicationId(), req.getApplicationVersionId()); logger.debug("action: unsupportApplicationVersion, state: initiated, request: {}", request); - final UnsupportApplicationVersionResponse response = applicationServiceBehavior.unsupportApplicationVersion(request.getRequestObject()); + final UnsupportApplicationVersionResponse response = applicationServiceBehavior.unsupportApplicationVersion(req); logger.info("action: unsupportApplicationVersion, state: succeeded"); logger.debug("action: unsupportApplicationVersion, state: succeeded, response: {}", response); return new ObjectResponse<>(response); @@ -104,7 +104,7 @@ public ObjectResponse supportApplicationVersi final SupportApplicationVersionRequest req = request.getRequestObject(); logger.info("action: supportApplicationVersion, state: initiated, applicationId: {}, versionId: {}", req.getApplicationId(), req.getApplicationVersionId()); logger.debug("action: supportApplicationVersion, state: initiated, request: {}", request); - final SupportApplicationVersionResponse response = applicationServiceBehavior.supportApplicationVersion(request.getRequestObject()); + final SupportApplicationVersionResponse response = applicationServiceBehavior.supportApplicationVersion(req); logger.info("action: supportApplicationVersion, state: succeeded"); logger.debug("action: supportApplicationVersion, state: succeeded, response: {}", response); return new ObjectResponse<>(response); diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/EcdsaSignatureController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/EcdsaSignatureController.java index 8fc63dda8..0a6894e0d 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/EcdsaSignatureController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/EcdsaSignatureController.java @@ -64,7 +64,7 @@ public ObjectResponse signDataWithECDSA(@Valid @RequestBody O final SignECDSARequest req = request.getRequestObject(); logger.info("action: signDataWithECDSA, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: signDataWithECDSA, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>("OK", asymmetricSignatureService.signDataWithECDSA(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>("OK", asymmetricSignatureService.signDataWithECDSA(req)); logger.info("action: signDataWithECDSA, state: succeeded"); logger.debug("action: signDataWithECDSA, state: succeeded, response: {}", response); return response; @@ -82,7 +82,7 @@ public ObjectResponse verifyECDSASignature(@Valid final VerifyECDSASignatureRequest req = request.getRequestObject(); logger.info("action: verifyECDSASignature, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: verifyECDSASignature, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>("OK", asymmetricSignatureService.verifyECDSASignature(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>("OK", asymmetricSignatureService.verifyECDSASignature(req)); logger.info("action: verifyECDSASignature, state: succeeded"); logger.debug("action: verifyECDSASignature, state: succeeded, response: {}", response); return response; diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/EciesController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/EciesController.java index f9ca1cad5..d172be51a 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/EciesController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/EciesController.java @@ -64,7 +64,7 @@ public ObjectResponse getEciesDecryptor(@Valid @Reque final GetEciesDecryptorRequest req = request.getRequestObject(); logger.info("action: getEciesDecryptor, state: initiated, applicationKey: {}", req.getApplicationKey()); logger.debug("action: getEciesDecryptor, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.getEciesDecryptor(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.getEciesDecryptor(req)); logger.info("action: getEciesDecryptor, state: succeeded"); logger.debug("action: getEciesDecryptor, state: succeeded, response: {}", response); return response; diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/IntegrationController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/IntegrationController.java index bd17c9070..ca8caf873 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/IntegrationController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/IntegrationController.java @@ -67,7 +67,7 @@ public ObjectResponse createIntegration(@Valid @Reque final CreateIntegrationRequest req = request.getRequestObject(); logger.info("action: createIntegration, state: initiated, name: {}", req.getName()); logger.debug("action: createIntegration, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.createIntegration(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.createIntegration(req)); logger.info("action: createIntegration, state: succeeded"); logger.debug("action: createIntegration, state: succeeded, response: {}", response); return response; @@ -101,7 +101,7 @@ public ObjectResponse removeIntegration(@Valid @Reque final RemoveIntegrationRequest req = request.getRequestObject(); logger.info("action: removeIntegration, state: initiated, id: {}", req.getId()); logger.debug("action: removeIntegration, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.removeIntegration(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.removeIntegration(req)); logger.info("action: removeIntegration, state: succeeded"); logger.debug("action: removeIntegration, state: succeeded, response: {}", response); return response; diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/OperationTemplatesController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/OperationTemplatesController.java index e3b5448ed..f48ba2190 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/OperationTemplatesController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/OperationTemplatesController.java @@ -85,7 +85,7 @@ public ObjectResponse getOperationTemplateDetai final OperationTemplateDetailRequest req = request.getRequestObject(); logger.info("action: getOperationTemplateDetail, state: initiated, id: {}", req.getId()); logger.debug("action: getOperationTemplateDetail, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.getTemplateDetail(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.getTemplateDetail(req)); logger.info("action: getOperationTemplateDetail, state: succeeded"); logger.debug("action: getOperationTemplateDetail, state: succeeded, response: {}", response); return response; @@ -103,7 +103,7 @@ public ObjectResponse createOperationTemplate(@ final OperationTemplateCreateRequest req = request.getRequestObject(); logger.info("action: createOperationTemplate, state: initiated, templateName: {}, operationType: {}", req.getTemplateName(), req.getOperationType()); logger.debug("action: createOperationTemplate, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.createOperationTemplate(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.createOperationTemplate(req)); logger.info("action: createOperationTemplate, state: succeeded"); logger.debug("action: createOperationTemplate, state: succeeded, response: {}", response); return response; @@ -121,7 +121,7 @@ public ObjectResponse updateOperationTemplate(@ final OperationTemplateUpdateRequest req = request.getRequestObject(); logger.info("action: updateOperationTemplate, state: initiated, id: {}, operationType: {}", req.getId(), req.getOperationType()); logger.debug("action: updateOperationTemplate, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.updateOperationTemplate(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.updateOperationTemplate(req)); logger.info("action: updateOperationTemplate, state: succeeded"); logger.debug("action: updateOperationTemplate, state: succeeded, response: {}", response); return response; @@ -139,7 +139,7 @@ public Response removeOperationTemplate(@Valid @RequestBody ObjectRequest createOperation(@Valid @RequestBo final OperationCreateRequest req = request.getRequestObject(); logger.info("action: createOperation, state: initiated, userId: {}, applications: {}, templateName: {}", req.getUserId(), req.getApplications(), req.getTemplateName()); logger.debug("action: createOperation, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.createOperation(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.createOperation(req)); logger.info("action: createOperation, state: succeeded"); logger.debug("action: createOperation, state: succeeded, response: {}", response); return response; @@ -85,7 +85,7 @@ public ObjectResponse operationDetail(@Valid @RequestBo final OperationDetailRequest req = request.getRequestObject(); logger.info("action: operationDetail, state: initiated, operationId: {}", req.getOperationId()); logger.debug("action: operationDetail, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.operationDetail(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.operationDetail(req)); logger.info("action: operationDetail, state: succeeded"); logger.debug("action: operationDetail, state: succeeded, response: {}", response); return response; @@ -103,7 +103,7 @@ public ObjectResponse operationClaim(@Valid @RequestBod final OperationClaimRequest req = request.getRequestObject(); logger.info("action: operationClaim, state: initiated, operationId: {}, userId: {}", req.getOperationId(), req.getUserId()); logger.debug("action: operationClaim, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.operationClaim(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.operationClaim(req)); logger.info("action: operationClaim, state: succeeded"); logger.debug("action: operationClaim, state: succeeded, response: {}", response); return response; @@ -121,7 +121,7 @@ public ObjectResponse operationList(@Valid @RequestBody O final OperationListForUserRequest req = request.getRequestObject(); logger.info("action: operationList, state: initiated, userId: {}, applications: {}", req.getUserId(), req.getApplications()); logger.debug("action: operationList, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.findAllOperationsForUser(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.findAllOperationsForUser(req)); logger.info("action: operationList, state: succeeded"); logger.debug("action: operationList, state: succeeded, response: {}", response); return response; @@ -139,7 +139,7 @@ public ObjectResponse pendingOperationList(@Valid @Reques final OperationListForUserRequest req = request.getRequestObject(); logger.info("action: pendingOperationList, state: initiated, userId: {}, applications: {}", req.getUserId(), req.getApplications()); logger.debug("action: pendingOperationList, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.findPendingOperationsForUser(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.findPendingOperationsForUser(req)); logger.info("action: pendingOperationList, state: succeeded"); logger.debug("action: pendingOperationList, state: succeeded, response: {}", response); return response; @@ -157,7 +157,7 @@ public ObjectResponse findAllOperationsByExternalId(@Vali final OperationExtIdRequest req = request.getRequestObject(); logger.info("action: findAllOperationsByExternalId, state: initiated, externalId: {}, applications: {}", req.getExternalId(), req.getApplications()); logger.debug("action: findAllOperationsByExternalId, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.findOperationsByExternalId(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.findOperationsByExternalId(req)); logger.info("action: findAllOperationsByExternalId, state: succeeded"); logger.debug("action: findAllOperationsByExternalId, state: succeeded, response: {}", response); return response; @@ -175,7 +175,7 @@ public ObjectResponse cancelOperation(@Valid @RequestBo final OperationCancelRequest req = request.getRequestObject(); logger.info("action: cancelOperation, state: initiated, operationId: {}", req.getOperationId()); logger.debug("action: cancelOperation, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.cancelOperation(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.cancelOperation(req)); logger.info("action: cancelOperation, state: succeeded"); logger.debug("action: cancelOperation, state: succeeded, response: {}", response); return response; @@ -193,7 +193,7 @@ public ObjectResponse approveOperation(@Valid @Requ final OperationApproveRequest req = request.getRequestObject(); logger.info("action: approveOperation, state: initiated, operationId: {}, userId: {}, applicationId: {}", req.getOperationId(), req.getUserId(), req.getApplicationId()); logger.debug("action: approveOperation, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.attemptApproveOperation(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.attemptApproveOperation(req)); logger.info("action: approveOperation, state: succeeded"); logger.debug("action: approveOperation, state: succeeded, response: {}", response); return response; @@ -211,7 +211,7 @@ public ObjectResponse failApprovalOperation(@Valid final OperationFailApprovalRequest req = request.getRequestObject(); logger.info("action: failApprovalOperation, state: initiated, operationId: {}", req.getOperationId()); logger.debug("action: failApprovalOperation, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.failApprovalOperation(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.failApprovalOperation(req)); logger.info("action: failApprovalOperation, state: succeeded"); logger.debug("action: failApprovalOperation, state: succeeded, response: {}", response); return response; @@ -229,7 +229,7 @@ public ObjectResponse rejectOperation(@Valid @Reque final OperationRejectRequest req = request.getRequestObject(); logger.info("action: rejectOperation, state: initiated, operationId: {}, userId: {}, applicationId: {}", req.getOperationId(), req.getUserId(), req.getApplicationId()); logger.debug("action: rejectOperation, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.rejectOperation(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.rejectOperation(req)); logger.info("action: rejectOperation, state: succeeded"); logger.debug("action: rejectOperation, state: succeeded, response: {}", response); return response; diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/RecoveryController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/RecoveryController.java index 14562af63..75e0c3069 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/RecoveryController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/RecoveryController.java @@ -63,7 +63,7 @@ public ObjectResponse createRecoveryCodeForUser(@Val final CreateRecoveryCodeRequest req = request.getRequestObject(); logger.info("action: createRecoveryCodeForUser, state: initiated, applicationId: {}, userId: {}", req.getApplicationId(), req.getUserId()); logger.debug("action: createRecoveryCodeForUser, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.createRecoveryCode(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.createRecoveryCode(req)); logger.info("action: createRecoveryCodeForUser, state: succeeded"); logger.debug("action: createRecoveryCodeForUser, state: succeeded, response: {}", response); return response; @@ -81,7 +81,7 @@ public ObjectResponse confirmRecoveryCode(@Valid @R final ConfirmRecoveryCodeRequest req = request.getRequestObject(); logger.info("action: confirmRecoveryCode, state: initiated, activationId: {}, applicationKey: {}", req.getActivationId(), req.getApplicationKey()); logger.debug("action: confirmRecoveryCode, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.confirmRecoveryCode(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.confirmRecoveryCode(req)); logger.info("action: confirmRecoveryCode, state: succeeded"); logger.debug("action: confirmRecoveryCode, state: succeeded, response: {}", response); return response; @@ -99,7 +99,7 @@ public ObjectResponse lookupRecoveryCodesRequest(@V final LookupRecoveryCodesRequest req = request.getRequestObject(); logger.info("action: lookupRecoveryCodesRequest, state: initiated, userId: {}, activationId: {}", req.getUserId(), req.getActivationId()); logger.debug("action: lookupRecoveryCodesRequest, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.lookupRecoveryCodes(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.lookupRecoveryCodes(req)); logger.info("action: lookupRecoveryCodesRequest, state: succeeded"); logger.debug("action: lookupRecoveryCodesRequest, state: succeeded, response: {}", response); return response; @@ -117,7 +117,7 @@ public ObjectResponse revokeRecoveryCodesRequest(@V final RevokeRecoveryCodesRequest req = request.getRequestObject(); logger.info("action: revokeRecoveryCodesRequest, state: initiated, recoveryCodeIds: {}", req.getRecoveryCodeIds()); logger.debug("action: revokeRecoveryCodesRequest, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.revokeRecoveryCodes(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.revokeRecoveryCodes(req)); logger.info("action: revokeRecoveryCodesRequest, state: succeeded"); logger.debug("action: revokeRecoveryCodesRequest, state: succeeded, response: {}", response); return response; @@ -135,7 +135,7 @@ public ObjectResponse getRecoveryConfig(@Valid @Reque final GetRecoveryConfigRequest req = request.getRequestObject(); logger.info("action: getRecoveryConfig, state: initiated, applicationId: {}", req.getApplicationId()); logger.debug("action: getRecoveryConfig, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.getRecoveryConfig(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.getRecoveryConfig(req)); logger.info("action: getRecoveryConfig, state: succeeded"); logger.debug("action: getRecoveryConfig, state: succeeded, response: {}", response); return response; @@ -153,7 +153,7 @@ public ObjectResponse updateRecoveryConfig(@Valid final UpdateRecoveryConfigRequest req = request.getRequestObject(); logger.info("action: updateRecoveryConfig, state: initiated, applicationId: {}", req.getApplicationId()); logger.debug("action: updateRecoveryConfig, state: initiated, request: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.updateRecoveryConfig(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(service.updateRecoveryConfig(req)); logger.info("action: updateRecoveryConfig, state: succeeded"); logger.debug("action: updateRecoveryConfig, state: succeeded, response: {}", response); return response; diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/SignatureController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/SignatureController.java index da6bcfc48..e89c3d958 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/SignatureController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/SignatureController.java @@ -126,7 +126,7 @@ public ObjectResponse verifyOfflineSignature(@Va final VerifyOfflineSignatureRequest req = request.getRequestObject(); logger.info("action: verifyOfflineSignature, state: initiated, activationId: {}", req.getActivationId()); logger.debug("action: verifyOfflineSignature, state: initiated, {}", request); - final ObjectResponse response = new ObjectResponse<>(offlineSignatureService.verifyOfflineSignature(request.getRequestObject())); + final ObjectResponse response = new ObjectResponse<>(offlineSignatureService.verifyOfflineSignature(req)); logger.info("action: verifyOfflineSignature, state: succeeded"); logger.debug("action: verifyOfflineSignature, state: succeeded, {}", response); return response; @@ -141,9 +141,12 @@ public ObjectResponse verifyOfflineSignature(@Va */ @PostMapping("/list") public ObjectResponse getSignatureAuditLog(@Valid @RequestBody ObjectRequest request) throws Exception { - logger.info("SignatureAuditRequest received: {}", request); - final ObjectResponse response = new ObjectResponse<>(auditingService.getSignatureAuditLog(request.getRequestObject())); - logger.info("SignatureAuditRequest succeeded: {}", response); + final SignatureAuditRequest req = request.getRequestObject(); + logger.info("action: getSignatureAuditLog, state: initiated, userId: {}, applicationId: {}", req.getUserId(), req.getApplicationId()); + logger.debug("action: getSignatureAuditLog, state: initiated, {}", request); + final ObjectResponse response = new ObjectResponse<>(auditingService.getSignatureAuditLog(req)); + logger.info("action: getSignatureAuditLog, state: succeeded"); + logger.debug("action: getSignatureAuditLog, state: succeeded, {}", response); return response; } diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/SystemStatusController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/SystemStatusController.java index 4700a089a..e86da3af8 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/SystemStatusController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/SystemStatusController.java @@ -24,6 +24,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -36,6 +37,7 @@ @RestController("systemStatusController") @RequestMapping("/rest/v3/status") @Tag(name = "PowerAuth System Status Controller (V3)") +@Validated @Slf4j public class SystemStatusController { @@ -53,9 +55,11 @@ public SystemStatusController(SystemStatusBehavior service) { */ @PostMapping public ObjectResponse getSystemStatus() { - logger.info("GetSystemStatusRequest received"); + logger.info("action: getSystemStatus, state: initiated"); + logger.debug("action: getSystemStatus, state: initiated, empty request"); final ObjectResponse response = new ObjectResponse<>(service.getSystemStatus()); - logger.info("GetSystemStatusRequest succeeded: {}", response); + logger.info("action: getSystemStatus, state: succeeded"); + logger.debug("action: getSystemStatus, state: succeeded, response: {}", response); return response; } diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/TelemetryController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/TelemetryController.java index 324c08fcd..980f6e67d 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/TelemetryController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/TelemetryController.java @@ -26,6 +26,7 @@ import io.getlime.security.powerauth.app.server.service.exceptions.TelemetryReportException; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; @@ -42,8 +43,9 @@ */ @RestController @RequestMapping("/rest/v3/telemetry") -@Validated @Tag(name = "PowerAuth Telemetry Controller V3") +@Validated +@Slf4j public class TelemetryController { private final TelemetryServiceBehavior telemetryServiceBehavior; @@ -55,11 +57,17 @@ public TelemetryController(TelemetryServiceBehavior telemetryServiceBehavior) { @PostMapping("report") public ObjectResponse report(@Valid @RequestBody ObjectRequest request) throws TelemetryReportException { + final TelemetryReportRequest req = request.getRequestObject(); + logger.info("action: report, state: initiated, name: {}", req.getName()); + logger.debug("action: report, state: initiated, request: {}", request); final TelemetryReportRequest requestObject = request.getRequestObject(); final String reportName = requestObject.getName(); final Map parameters = requestObject.getParameters(); final TelemetryReportResponse responseObject = telemetryServiceBehavior.report(reportName, parameters); - return new ObjectResponse<>(responseObject); + final ObjectResponse response = new ObjectResponse<>(responseObject); + logger.info("action: report, state: succeeded"); + logger.debug("action: report, state: succeeded, response: {}", response); + return response; } diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/TemporaryKeyController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/TemporaryKeyController.java index 5cfb941dd..64fd55ed7 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/TemporaryKeyController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/TemporaryKeyController.java @@ -26,8 +26,10 @@ import io.getlime.core.rest.model.base.response.ObjectResponse; import io.getlime.security.powerauth.app.server.service.behavior.tasks.TemporaryKeyBehavior; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -41,6 +43,7 @@ @RestController("temporaryKeyController") @RequestMapping("/rest/v3/keystore") @Tag(name = "PowerAuth ECIES Temporary Key Controller (V3)") +@Validated @Slf4j public class TemporaryKeyController { @@ -59,10 +62,13 @@ public TemporaryKeyController(TemporaryKeyBehavior service) { * @throws Exception In case the service throws exception. */ @PostMapping("/create") - public ObjectResponse createTemporaryKey(@RequestBody ObjectRequest request) throws Exception { - logger.info("TemporaryPublicKeyRequest received: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.requestTemporaryKey(request.getRequestObject())); - logger.info("TemporaryPublicKeyRequest succeeded: {}", response); + public ObjectResponse createTemporaryKey(@Valid @RequestBody ObjectRequest request) throws Exception { + final TemporaryPublicKeyRequest req = request.getRequestObject(); + logger.info("action: createTemporaryKey, state: initiated"); + logger.debug("action: createTemporaryKey, state: initiated, request: {}", request); + final ObjectResponse response = new ObjectResponse<>(service.requestTemporaryKey(req)); + logger.info("action: createTemporaryKey, state: succeeded"); + logger.debug("action: createTemporaryKey, state: succeeded, response: {}", response); return response; } @@ -73,10 +79,13 @@ public ObjectResponse createTemporaryKey(@RequestBod * @return Response with deletion result. */ @PostMapping("/remove") - public ObjectResponse deleteTemporaryKey(@RequestBody ObjectRequest request) { - logger.info("RemoveTemporaryPublicKeyRequest received: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.removeTemporaryKey(request.getRequestObject())); - logger.info("RemoveTemporaryPublicKeyRequest succeeded: {}", response); + public ObjectResponse deleteTemporaryKey(@Valid @RequestBody ObjectRequest request) { + final RemoveTemporaryPublicKeyRequest req = request.getRequestObject(); + logger.info("action: deleteTemporaryKey, state: initiated, id: {}", req.getId()); + logger.debug("action: deleteTemporaryKey, state: initiated, request: {}", request); + final ObjectResponse response = new ObjectResponse<>(service.removeTemporaryKey(req)); + logger.info("action: deleteTemporaryKey, state: succeeded"); + logger.debug("action: deleteTemporaryKey, state: succeeded, response: {}", response); return response; } diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/TokenController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/TokenController.java index b1041bd6a..50c82b059 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/TokenController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/TokenController.java @@ -28,8 +28,10 @@ import io.getlime.core.rest.model.base.response.ObjectResponse; import io.getlime.security.powerauth.app.server.service.behavior.tasks.TokenBehavior; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -43,6 +45,7 @@ @RestController("tokenController") @RequestMapping("/rest/v3/token") @Tag(name = "PowerAuth Token Controller (V3)") +@Validated @Slf4j public class TokenController { @@ -61,10 +64,13 @@ public TokenController(TokenBehavior service) { * @throws Exception In case the service throws exception. */ @PostMapping("/create") - public ObjectResponse createToken(@RequestBody ObjectRequest request) throws Exception { - logger.info("CreateTokenRequest received: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.createToken(request.getRequestObject())); - logger.info("CreateTokenRequest succeeded: {}", response); + public ObjectResponse createToken(@Valid @RequestBody ObjectRequest request) throws Exception { + final CreateTokenRequest req = request.getRequestObject(); + logger.info("action: createToken, state: initiated, activationId: {}", req.getActivationId()); + logger.debug("action: createToken, state: initiated, request: {}", request); + final ObjectResponse response = new ObjectResponse<>(service.createToken(req)); + logger.info("action: createToken, state: succeeded"); + logger.debug("action: createToken, state: succeeded, response: {}", response); return response; } @@ -76,10 +82,13 @@ public ObjectResponse createToken(@RequestBody ObjectReques * @throws Exception In case the service throws exception. */ @PostMapping("/validate") - public ObjectResponse validateToken(@RequestBody ObjectRequest request) throws Exception { - logger.info("ValidateTokenRequest received: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.validateToken(request.getRequestObject())); - logger.info("ValidateTokenRequest succeeded: {}", response); + public ObjectResponse validateToken(@Valid @RequestBody ObjectRequest request) throws Exception { + final ValidateTokenRequest req = request.getRequestObject(); + logger.info("action: validateToken, state: initiated, tokenId: {}", req.getTokenId()); + logger.debug("action: validateToken, state: initiated, request: {}", request); + final ObjectResponse response = new ObjectResponse<>(service.validateToken(req)); + logger.info("action: validateToken, state: succeeded"); + logger.debug("action: validateToken, state: succeeded, response: {}", response); return response; } @@ -91,10 +100,13 @@ public ObjectResponse validateToken(@RequestBody ObjectRe * @throws Exception In case the service throws exception. */ @PostMapping("/remove") - public ObjectResponse removeToken(@RequestBody ObjectRequest request) throws Exception { - logger.info("RemoveTokenRequest received: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.removeToken(request.getRequestObject())); - logger.info("RemoveTokenRequest succeeded: {}", response); + public ObjectResponse removeToken(@Valid @RequestBody ObjectRequest request) throws Exception { + final RemoveTokenRequest req = request.getRequestObject(); + logger.info("action: removeToken, state: initiated, tokenId: {}", req.getTokenId()); + logger.debug("action: removeToken, state: initiated, request: {}", request); + final ObjectResponse response = new ObjectResponse<>(service.removeToken(req)); + logger.info("action: removeToken, state: succeeded"); + logger.debug("action: removeToken, state: succeeded, response: {}", response); return response; } diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/UpgradeController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/UpgradeController.java index 226ac82cd..f8188b33b 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/UpgradeController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/UpgradeController.java @@ -26,8 +26,10 @@ import io.getlime.core.rest.model.base.response.ObjectResponse; import io.getlime.security.powerauth.app.server.service.behavior.tasks.UpgradeServiceBehavior; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -41,6 +43,7 @@ @RestController("updateController") @RequestMapping("/rest/v3/upgrade") @Tag(name = "PowerAuth Upgrade Protocol Controller (V3)") +@Validated @Slf4j public class UpgradeController { @@ -60,9 +63,12 @@ public UpgradeController(UpgradeServiceBehavior service) { */ @PostMapping("/start") public ObjectResponse startUpgrade(@RequestBody ObjectRequest request) throws Exception { - logger.info("StartUpgradeRequest received: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.startUpgrade(request.getRequestObject())); - logger.info("StartUpgradeRequest succeeded: {}", response); + final StartUpgradeRequest req = request.getRequestObject(); + logger.info("action: startUpgrade, state: initiated"); + logger.debug("action: startUpgrade, state: initiated, request: {}", request); + final ObjectResponse response = new ObjectResponse<>(service.startUpgrade(req)); + logger.info("action: startUpgrade, state: succeeded"); + logger.debug("action: startUpgrade, state: succeeded, response: {}", response); return response; } @@ -74,10 +80,13 @@ public ObjectResponse startUpgrade(@RequestBody ObjectRequ * @throws Exception In case the service throws exception. */ @PostMapping("/commit") - public ObjectResponse commitUpgrade(@RequestBody ObjectRequest request) throws Exception { - logger.info("CommitUpgradeRequest received: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.commitUpgrade(request.getRequestObject())); - logger.info("CommitUpgradeRequest succeeded: {}", response); + public ObjectResponse commitUpgrade(@Valid @RequestBody ObjectRequest request) throws Exception { + final CommitUpgradeRequest req = request.getRequestObject(); + logger.info("action: commitUpgrade, state: initiated"); + logger.debug("action: commitUpgrade, state: initiated, request: {}", request); + final ObjectResponse response = new ObjectResponse<>(service.commitUpgrade(req)); + logger.info("action: commitUpgrade, state: succeeded"); + logger.debug("action: commitUpgrade, state: succeeded, response: {}", response); return response; } diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/VaultController.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/VaultController.java index 809c3c766..e06214090 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/VaultController.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/controller/api/VaultController.java @@ -24,8 +24,10 @@ import io.getlime.core.rest.model.base.response.ObjectResponse; import io.getlime.security.powerauth.app.server.service.behavior.tasks.VaultUnlockServiceBehavior; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -39,6 +41,7 @@ @RestController("vaultController") @RequestMapping("/rest/v3/vault") @Tag(name = "PowerAuth Vault Controller (V3)") +@Validated @Slf4j public class VaultController { @@ -57,10 +60,13 @@ public VaultController(VaultUnlockServiceBehavior service) { * @throws Exception In case the service throws exception. */ @PostMapping("/unlock") - public ObjectResponse unlockVault(@RequestBody ObjectRequest request) throws Exception { - logger.info("VaultUnlockRequest received: {}", request); - final ObjectResponse response = new ObjectResponse<>(service.unlockVault(request.getRequestObject())); - logger.info("VaultUnlockRequest succeeded: {}", response); + public ObjectResponse unlockVault(@Valid @RequestBody ObjectRequest request) throws Exception { + final VaultUnlockRequest req = request.getRequestObject(); + logger.info("action: unlockVault, state: initiated"); + logger.debug("action: unlockVault, state: initiated, request: {}", request); + final ObjectResponse response = new ObjectResponse<>(service.unlockVault(req)); + logger.info("action: unlockVault, state: succeeded"); + logger.debug("action: unlockVault, state: succeeded, response: {}", response); return response; } diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/TemporaryKeyBehavior.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/TemporaryKeyBehavior.java index 27331bdcd..53b6a8ae0 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/TemporaryKeyBehavior.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/TemporaryKeyBehavior.java @@ -113,10 +113,6 @@ public TemporaryKeyBehavior(PowerAuthServiceConfiguration powerAuthServiceConfig @Transactional public TemporaryPublicKeyResponse requestTemporaryKey(TemporaryPublicKeyRequest request) throws GenericServiceException, InvalidKeySpecException, CryptoProviderException, GenericCryptoException, InvalidKeyException { - if (request == null) { - throw localizationProvider.buildExceptionForCode(ServiceError.INVALID_REQUEST); - } - // Get claims from JWT try { final SignedJWT decodedJWT = SignedJWT.parse(request.getJwt()); diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/TokenBehavior.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/TokenBehavior.java index bce35d9e3..5c6d80398 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/TokenBehavior.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/TokenBehavior.java @@ -122,12 +122,6 @@ public class TokenBehavior { @Transactional public CreateTokenResponse createToken(CreateTokenRequest request) throws GenericServiceException { try { - if (request.getActivationId() == null || request.getApplicationKey() == null) { - logger.warn("Invalid request parameters in method createToken"); - // Rollback is not required, error occurs before writing to database - throw localizationProvider.buildExceptionForCode(ServiceError.INVALID_REQUEST); - } - final String activationId = request.getActivationId(); final String applicationKey = request.getApplicationKey(); final String version = request.getProtocolVersion(); @@ -171,12 +165,6 @@ public CreateTokenResponse createToken(CreateTokenRequest request) throws Generi @Transactional public ValidateTokenResponse validateToken(ValidateTokenRequest request) throws GenericServiceException { try { - if (request.getTokenId() == null || request.getNonce() == null || request.getTokenDigest() == null || request.getProtocolVersion() == null) { - logger.warn("Invalid request parameters in method validateToken"); - // Rollback is not required, database is not used for writing - throw localizationProvider.buildExceptionForCode(ServiceError.INVALID_REQUEST); - } - // Verify the token timestamp validity final long currentTimeMillis = System.currentTimeMillis(); final long requestTimestamp = request.getTimestamp(); @@ -267,12 +255,6 @@ public ValidateTokenResponse validateToken(ValidateTokenRequest request) throws @Transactional public RemoveTokenResponse removeToken(RemoveTokenRequest request) throws GenericServiceException { try { - if (request.getTokenId() == null) { - logger.warn("Invalid request parameter tokenId in method removeToken"); - // Rollback is not required, error occurs before writing to database - throw localizationProvider.buildExceptionForCode(ServiceError.INVALID_REQUEST); - } - final String tokenId = request.getTokenId(); boolean removed = false; diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/UpgradeServiceBehavior.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/UpgradeServiceBehavior.java index 9fe2e7c17..6abb6454c 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/UpgradeServiceBehavior.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/UpgradeServiceBehavior.java @@ -104,12 +104,6 @@ public StartUpgradeResponse startUpgrade(StartUpgradeRequest request) throws Gen final String protocolVersion = request.getProtocolVersion(); final String temporaryKeyId = request.getTemporaryKeyId(); - if (activationId == null || applicationKey == null) { - logger.warn("Invalid request parameters in method startUpgrade"); - // Rollback is not required, error occurs before writing to database - throw localizationProvider.buildExceptionForCode(ServiceError.INVALID_REQUEST); - } - // Build and validate encrypted request final EncryptedRequest encryptedRequest = new EncryptedRequest( request.getTemporaryKeyId(), @@ -269,14 +263,6 @@ public StartUpgradeResponse startUpgrade(StartUpgradeRequest request) throws Gen public CommitUpgradeResponse commitUpgrade(CommitUpgradeRequest request) throws GenericServiceException { try { final String activationId = request.getActivationId(); - final String applicationKey = request.getApplicationKey(); - - // Verify input data - if (activationId == null || applicationKey == null) { - logger.warn("Invalid commit upgrade request"); - // Rollback is not required, error occurs before writing to database - throw localizationProvider.buildExceptionForCode(ServiceError.DECRYPTION_FAILED); - } // Lookup the activation final ActivationRecordEntity activation = activationQueryService.findActivationForUpdate(activationId).orElseThrow(() -> { diff --git a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/VaultUnlockServiceBehavior.java b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/VaultUnlockServiceBehavior.java index 5df974ffd..ca1bd1da1 100644 --- a/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/VaultUnlockServiceBehavior.java +++ b/powerauth-java-server/src/main/java/io/getlime/security/powerauth/app/server/service/behavior/tasks/VaultUnlockServiceBehavior.java @@ -114,13 +114,6 @@ public class VaultUnlockServiceBehavior { @Transactional public VaultUnlockResponse unlockVault(VaultUnlockRequest request) throws GenericServiceException { try { - if (request.getActivationId() == null || request.getApplicationKey() == null || request.getSignature() == null - || request.getSignatureType() == null || request.getSignatureVersion() == null || request.getSignedData() == null) { - logger.warn("Invalid request parameters in method vaultUnlock"); - // Rollback is not required, error occurs before writing to database - throw localizationProvider.buildExceptionForCode(ServiceError.INVALID_REQUEST); - } - // Get request data final String activationId = request.getActivationId(); final String applicationKey = request.getApplicationKey();