Skip to content

Commit

Permalink
Logging, validations and REST API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
romanstrobl committed Dec 11, 2024
1 parent cf9be61 commit 453e133
Show file tree
Hide file tree
Showing 42 changed files with 306 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.wultra.security.powerauth.client.model.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
Expand All @@ -28,6 +29,7 @@
@Data
public class GetErrorCodeListRequest {

@Schema(description = "ISO 639 language code")
private String language;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<String, Object> parameters = new HashMap<>();

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

}
Loading

0 comments on commit 453e133

Please sign in to comment.