Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve logging, validations and documentation for operations controller #1794

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
3682aa8
Improve logging, validations and documentation for operations controller
romanstrobl Nov 27, 2024
26506c2
Remove redundant parameters
romanstrobl Nov 28, 2024
ccc424a
Update logging, validations and documentation for activations controller
romanstrobl Dec 3, 2024
4bb8f1c
Add missing copyright
romanstrobl Dec 3, 2024
15293f4
Logging, validations and REST API documentation
romanstrobl Dec 5, 2024
2c2e28c
Logging, validations and REST API documentation
romanstrobl Dec 6, 2024
3a2c04d
Logging, validations and REST API documentation
romanstrobl Dec 6, 2024
b932248
Logging, validations and REST API documentation
romanstrobl Dec 9, 2024
308eff1
Logging, validations and REST API documentation
romanstrobl Dec 10, 2024
cf9be61
Logging, validations and REST API documentation
romanstrobl Dec 11, 2024
453e133
Logging, validations and REST API documentation
romanstrobl Dec 11, 2024
a8fa190
Add results for important endpoints
romanstrobl Dec 12, 2024
d1ea13d
Fix typo
romanstrobl Dec 12, 2024
4e18138
Fix typo
romanstrobl Dec 12, 2024
5645125
Use format attribute
romanstrobl Dec 12, 2024
9e57234
Add deprecation
romanstrobl Dec 12, 2024
2b59d9e
Add validations for lists
romanstrobl Dec 20, 2024
85882f2
Fix tests
romanstrobl Dec 20, 2024
fe9f0ae
Update list annotations
romanstrobl Dec 20, 2024
cfe754a
Remove extra validations for ECIES decryptor
romanstrobl Dec 20, 2024
b0a64ab
Remove extra parameters
romanstrobl Dec 20, 2024
d2a2ead
Revert invalid test change
romanstrobl Dec 23, 2024
17cbfbc
Remove unnecessary parameters
romanstrobl Dec 23, 2024
6ad886f
Remove invalid parameter
romanstrobl Dec 23, 2024
3202dca
Improve logging
romanstrobl Dec 23, 2024
b65470c
Cleanup validations
romanstrobl Dec 23, 2024
765d697
Update documentation for nonce parameter
romanstrobl Dec 23, 2024
a4ea2f7
Use same validations for data
romanstrobl Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;

import java.util.Date;
Expand All @@ -30,8 +32,14 @@
@Data
public class ActivationHistoryRequest {

@Schema(description = "Activation identifier")
@NotBlank(message = "Activation ID must not be empty when requesting activation history")
private String activationId;

@Schema(description = "Timestamp from used for timestamp filter")
private Date timestampFrom;

@Schema(description = "Timestamp to used for timestamp filter")
private Date timestampTo;

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

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.NotEmpty;
import lombok.Data;

import java.util.ArrayList;
Expand All @@ -31,7 +34,12 @@
@Data
public class AddActivationFlagsRequest {

@Schema(description = "Activation identifier")
@NotBlank(message = "Activation ID must not be empty when adding activation flags")
private String activationId;
private List<String> activationFlags = new ArrayList<>();

@Schema(description = "List of activation flags")
@NotEmpty(message = "List of activation flags must not be empty when adding activation flags")
private List<@NotBlank String> activationFlags = new ArrayList<>();

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

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.NotEmpty;
import lombok.Data;

import java.util.ArrayList;
Expand All @@ -31,7 +34,12 @@
@Data
public class AddApplicationRolesRequest {

@Schema(description = "The identifier of the application")
@NotBlank(message = "Application ID must not be empty when adding application roles")
private String applicationId;
private List<String> applicationRoles = new ArrayList<>();

@Schema(description = "Application roles")
@NotEmpty(message = "List of application roles must not be empty when adding application roles")
private List<@NotBlank String> applicationRoles = new ArrayList<>();

}
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,8 +30,14 @@
@Data
public class BlockActivationRequest {

@Schema(description = "Activation identifier")
@NotBlank(message = "Activation ID must not be empty when blocking activation")
private String activationId;

@Schema(description = "Reason why activation was blocked")
private String reason;

@Schema(description = "External user identifier")
private String externalUserId;

}
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;
import lombok.ToString;

Expand All @@ -29,8 +31,14 @@
@Data
public class CommitActivationRequest {

@Schema(description = "Activation identifier")
@NotBlank(message = "Activation ID must not be empty when commiting activation")
private String activationId;

@Schema(description = "External user identifier")
private String externalUserId;

@Schema(description = "Activation OTP value")
@ToString.Exclude
private String activationOtp;

Expand Down
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 CommitUpgradeRequest {

@Schema(description = "Activation identifier")
@NotBlank(message = "Activation ID must not be empty when committing upgrade")
private String activationId;

@Schema(description = "Application key")
@NotBlank(message = "Application key must not be empty when committing upgrade")
private String applicationKey;

}
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;
import lombok.ToString;

Expand All @@ -29,15 +31,38 @@
@Data
public class ConfirmRecoveryCodeRequest {

@Schema(description = "Activation identifier")
@NotBlank(message = "Activation ID must not be empty when confirming recovery code")
private String activationId;

@Schema(description = "Application key")
@NotBlank(message = "Application key must not be empty when confirming recovery code")
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 confirming recovery code")
private String ephemeralPublicKey;

@Schema(description = "Encrypted data used in encryption")
@NotBlank(message = "Encrypted data must not be empty when confirming recovery code")
private String encryptedData;

@Schema(description = "Value of MAC used in encryption")
@NotBlank(message = "Value of MAC must not be empty when confirming recovery code")
private String mac;

@Schema(description = "Nonce value")
@ToString.Exclude
private String nonce;
private Long timestamp;

@Schema(description = "Cryptography protocol version")
@NotBlank(message = "Protocol must not be empty when confirming recovery code")
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,10 @@

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

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Future;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Positive;
import lombok.Data;
import lombok.ToString;

Expand All @@ -31,20 +35,53 @@
@Data
public class CreateActivationRequest {

@Schema(description = "The identifier of the user")
@NotBlank(message = "User ID must not be empty when creating activation")
private String userId;

@Schema(description = "Timestamp of activation expiration")
@Future(message = "The activation expiration timestamp must be in the future when creating activation")
private Date timestampActivationExpire;

@Schema(description = "Whether recovery codes should be generated")
private boolean generateRecoveryCodes = true;

@Schema(description = "Maximum number of failures for the activation")
@Positive(message = "Maximum failure count must be positive when creating activation")
private Long maxFailureCount;

@Schema(description = "Application key")
@NotBlank(message = "Application key must not be empty when creating activation")
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 activation")
private String ephemeralPublicKey;

@Schema(description = "Encrypted data used in encryption")
@NotBlank(message = "Encrypted data must not be empty when creating activation")
private String encryptedData;

@Schema(description = "Value of MAC used in encryption")
@NotBlank(message = "Value of MAC must not be empty when creating activation")
private String mac;

@Schema(description = "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 creating activation")
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.AllArgsConstructor;
import lombok.Data;
Expand All @@ -36,12 +37,15 @@
@NoArgsConstructor
public class CreateApplicationConfigRequest {

@NotBlank
@Schema(description = "The identifier of the application")
@NotBlank(message = "Application ID must not be empty when creating an application configuration")
private String applicationId;

@NotBlank
@Schema(description = "The configuration key")
@NotBlank(message = "The configuration key must not be empty when creating an application configuration")
private String key;

@Schema(description = "The configuration values")
private List<Object> values = new ArrayList<>();

}
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 CreateApplicationRequest {

@Schema(description = "The identifier of the application")
@NotBlank(message = "Application ID must not be empty when creating an application")
private String applicationId;

}
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 CreateApplicationVersionRequest {

@Schema(description = "The identifier of the application")
@NotBlank(message = "Application ID must not be empty when creating application version")
private String applicationId;

@Schema(description = "The identifier of the application version")
@NotBlank(message = "Application version ID must not be empty when creating application version")
private String applicationVersionId;

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,38 @@
@Data
public class CreateCallbackUrlRequest {

@NotBlank
@Schema(description = "The identifier of the application")
@NotBlank(message = "Application ID must not be empty when creating a callback")
private String applicationId;

@NotBlank
@Schema(description = "Callback name")
@NotBlank(message = "Callback name must not be empty when creating a callback")
private String name;

@NotNull
@Schema(description = "Callback type")
@NotNull(message = "Callback type must not be null when creating a callback")
private CallbackUrlType type;

@NotBlank
@Schema(description = "Callback URL")
@NotBlank(message = "Callback URL must not be empty when creating a callback")
private String callbackUrl;

private List<String> attributes = new ArrayList<>();
@Schema(description = "Callback attributes")
private List<@NotBlank String> attributes = new ArrayList<>();

@Schema(description = "Callback authentication")
private HttpAuthenticationPrivate authentication = new HttpAuthenticationPrivate();

@DurationMin(message = "Duration must be positive or zero")
@Schema(type = "string", format = "ISO 8601 Duration", example = "P30D")
@Schema(description = "Callback retention period", type = "string", format = "ISO 8601 Duration", example = "P30D")
private Duration retentionPeriod;

@DurationMin(message = "Duration must be positive or zero")
@Schema(type = "string", format = "ISO 8601 Duration", example = "PT2.5S")
@Schema(description = "Initial backoff time for the callback", type = "string", format = "ISO 8601 Duration", example = "PT2.5S")
private Duration initialBackoff;

@Min(1)
@Schema(type = "integer", example = "1")
@Schema(description = "Maximum attempts for executing the callback", type = "integer", example = "1")
private Integer maxAttempts;

}
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 CreateIntegrationRequest {

@Schema(description = "Integration name")
@NotBlank(message = "Integration name must not be empty when creating an integration")
private String name;

}
Loading
Loading