-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #1771: Enforce presence of user ID before operation approval
- Loading branch information
1 parent
1fc61a9
commit b5c02af
Showing
11 changed files
with
225 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...c/main/java/com/wultra/security/powerauth/client/model/request/OperationClaimRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* PowerAuth Server and related software components | ||
* Copyright (C) 2024 Wultra s.r.o. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.wultra.security.powerauth.client.model.request; | ||
|
||
import lombok.Data; | ||
|
||
/** | ||
* Request for operation claim. | ||
* | ||
* @author Roman Strobl, [email protected] | ||
*/ | ||
@Data | ||
public class OperationClaimRequest { | ||
|
||
/** | ||
* Operation identifier. | ||
*/ | ||
private String operationId; | ||
|
||
/** | ||
* Optional user identifier of the user who is claiming the operation. | ||
*/ | ||
private String userId; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
.../com/wultra/security/powerauth/client/model/validator/OperationClaimRequestValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* PowerAuth Server and related software components | ||
* Copyright (C) 2024 Wultra s.r.o. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.wultra.security.powerauth.client.model.validator; | ||
|
||
import com.wultra.security.powerauth.client.model.request.OperationClaimRequest; | ||
|
||
/** | ||
* Validator for OperationClaimRequest class. | ||
* | ||
* @author Roman Strobl, [email protected] | ||
*/ | ||
public class OperationClaimRequestValidator { | ||
|
||
public static String validate(OperationClaimRequest source) { | ||
if (source == null) { | ||
return "Operation claim request must not be null"; | ||
} | ||
if (source.getOperationId() == null) { | ||
return "Operation ID must not be null when requesting operation claim"; | ||
} | ||
if (source.getOperationId().isEmpty()) { | ||
return "Operation ID must not be empty when requesting operation claim"; | ||
} | ||
if (source.getUserId() == null || source.getUserId().isEmpty()) { | ||
return "User ID must be specified when requesting operation claim"; | ||
} | ||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.