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

Merge upstream push platforms #150

Merged
merged 13 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions docs/Migration-Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This page contains PowerAuth Enrollment Server migration instructions.

- [PowerAuth Enrollment Server 1.10.0](./PowerAuth-Enrollment-Server-1.10.0.md)
- [PowerAuth Enrollment Server 1.9.0](./PowerAuth-Enrollment-Server-1.9.0.md)
- [PowerAuth Enrollment Server 1.8.0](./PowerAuth-Enrollment-Server-1.8.0.md)
- [PowerAuth Enrollment Server 1.7.0](./PowerAuth-Enrollment-Server-1.7.0.md)
- [PowerAuth Enrollment Server 1.6.0](./PowerAuth-Enrollment-Server-1.6.0.md)
Expand Down
14 changes: 8 additions & 6 deletions docs/Mobile-Token-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -790,15 +790,16 @@ Registers a device to push notifications. Authorization is done using PowerAuth
```json
{
"requestObject": {
"platform": "ios",
"platform": "apns",
"token": "10de0b9c-791f-4e9f-93c4-e2203951c307"
}
}
```

Supported platforms:
- `ios`
- `android`
- `apns`
- `fcm`
- `hms`

#### Response 200

Expand Down Expand Up @@ -869,15 +870,16 @@ Registers a device to push notifications. Authorization is done using PowerAuth
```json
{
"requestObject": {
"platform": "ios",
"platform": "apns",
"token": "10de0b9c-791f-4e9f-93c4-e2203951c307"
}
}
```

Supported platforms:
- `ios`
- `android`
- `aps`
- `fcm`
- `hms`

#### Response 200

Expand Down
10 changes: 10 additions & 0 deletions docs/PowerAuth-Enrollment-Server-1.10.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Migration from 1.9.x to 1.10.x

This guide contains instructions for migration from PowerAuth Enrollment Server version `1.9.x` to version `1.10.0`.

## REST API

### Platform Validation during Registration for Push Messages

The endpoints `POST /api/push/device/register` and `POST /api/push/device/register/token` now use updated platform `platform` values `apns`, `fcm`, and `hms`.
The original values `ios`, `android`, and `huawei` are still supported, but will be removed in a future release.
2 changes: 1 addition & 1 deletion docs/PowerAuth-Enrollment-Server-1.7.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ This guide contains instructions for migration from PowerAuth Enrollment Server

### Register for Push Messages (Token)

The endpoint `POST /api/push/device/register/token` now strictly validates `platform` against values `ios`, `android` or `huawei`.
The endpoints `POST /api/push/device/register` and `POST /api/push/device/register/token` now strictly validate `platform` against values `ios`, `android`, or `huawei`.
If you use the PowerAuth SDK, you should not be affected.
5 changes: 5 additions & 0 deletions docs/PowerAuth-Enrollment-Server-1.9.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Migration from 1.8.x to 1.9.x

This guide contains instructions for migration from PowerAuth Enrollment Server version `1.8.x` to version `1.9.0`.

No migration steps nor database changes are required.
1 change: 1 addition & 0 deletions docs/onboarding/Migration-Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

This page contains PowerAuth Enrollment Onboarding Server migration instructions.

- [PowerAuth Enrollment Onboarding Server 1.9.0](./PowerAuth-Enrollment-Onboarding-Server-1.9.0.md)
- [PowerAuth Enrollment Onboarding Server 1.8.0](./PowerAuth-Enrollment-Onboarding-Server-1.8.0.md)
- [PowerAuth Enrollment Onboarding Server 1.7.0](./PowerAuth-Enrollment-Onboarding-Server-1.7.0.md)
- [PowerAuth Enrollment Onboarding Server 1.6.0](./PowerAuth-Enrollment-Onboarding-Server-1.6.0.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Migration from 1.8.x to 1.9.x

This guide contains instructions for migration from PowerAuth Enrollment Onboarding Server version `1.8.x` to version `1.9.0`.

No migration steps nor database changes are required.
2 changes: 1 addition & 1 deletion enrollment-server-api-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<parent>
<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.10.0-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,33 @@ public class PushRegisterRequest {
private Platform platform;

/**
* The push token is the value received from APNS, FCM, or HMS services without any modification.
* The push token is the value received from APNs, FCM, or HMS services without any modification.
*/
@NotBlank
@ToString.Exclude
@Schema(description = "The push token is the value received from APNS, FCM, or HMS services without any modification.")
@Schema(description = "The push token is the value received from APNs, FCM, or HMS services without any modification.")
private String token;

public enum Platform {
@JsonProperty("apns")
APNS,

@JsonProperty("fcm")
FCM,

@JsonProperty("hms")
HMS,

@JsonProperty("ios")
@Deprecated
IOS,

@JsonProperty("android")
@Deprecated
ANDROID,

@JsonProperty("huawei")
@Deprecated
HUAWEI
}

Expand Down
2 changes: 1 addition & 1 deletion enrollment-server-onboarding-adapter-mock/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.10.0-SNAPSHOT</version>
</parent>

<artifactId>enrollment-server-onboarding-adapter-mock</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion enrollment-server-onboarding-api-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.10.0-SNAPSHOT</version>
</parent>

<artifactId>enrollment-server-onboarding-api-model</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion enrollment-server-onboarding-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.10.0-SNAPSHOT</version>
</parent>

<groupId>com.wultra.security</groupId>
Expand Down
2 changes: 1 addition & 1 deletion enrollment-server-onboarding-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.10.0-SNAPSHOT</version>
</parent>

<artifactId>enrollment-server-onboarding-common</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion enrollment-server-onboarding-domain-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<parent>
<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.10.0-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion enrollment-server-onboarding-provider-innovatrics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.10.0-SNAPSHOT</version>
</parent>

<groupId>com.wultra.security</groupId>
Expand Down
2 changes: 1 addition & 1 deletion enrollment-server-onboarding-provider-iproov/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.10.0-SNAPSHOT</version>
</parent>

<groupId>com.wultra.security</groupId>
Expand Down
2 changes: 1 addition & 1 deletion enrollment-server-onboarding-provider-zenid/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.10.0-SNAPSHOT</version>
</parent>

<groupId>com.wultra.security</groupId>
Expand Down
2 changes: 1 addition & 1 deletion enrollment-server-onboarding/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<parent>
<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.10.0-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion enrollment-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<parent>
<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.10.0-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ public ObjectResponse<OperationListResponse> operationList(@Parameter(hidden = t
PowerAuthSignatureTypes.POSSESSION_KNOWLEDGE,
PowerAuthSignatureTypes.POSSESSION_KNOWLEDGE_BIOMETRY
})
public ObjectResponse<Operation> getOperationDetail(@RequestBody ObjectRequest<OperationDetailRequest> request,
@Parameter(hidden = true) PowerAuthApiAuthentication auth,
@Parameter(hidden = true) Locale locale) throws MobileTokenException, MobileTokenConfigurationException, RemoteCommunicationException {
public ObjectResponse<Operation> fetchOperationDetail(@RequestBody ObjectRequest<OperationDetailRequest> request,
@Parameter(hidden = true) PowerAuthApiAuthentication auth,
@Parameter(hidden = true) Locale locale) throws MobileTokenException, MobileTokenConfigurationException, RemoteCommunicationException {
try {
if (auth != null) {
final String operationId = request.getRequestObject().getId();
final String language = locale.getLanguage();
final String userId = auth.getUserId();
final Operation response = mobileTokenService.getOperationDetail(operationId, language, userId);
final Operation response = mobileTokenService.fetchOperationDetail(operationId, language, userId);
final Date currentTimestamp = new Date();
return new MobileTokenResponse<>(response, currentTimestamp);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public OperationListResponse operationListForUser(
*/
public Response operationApprove(@NotNull final OperationApproveParameterObject request) throws MobileTokenException, PowerAuthClientException {

final OperationDetailResponse operationDetail = claimOperationInternal(request.getOperationId(), null);
final OperationDetailResponse operationDetail = fetchOperationDetailInternal(request.getOperationId());

final String activationFlag = operationDetail.getActivationFlag();
if (activationFlag != null && !request.getActivationFlags().contains(activationFlag)) { // allow approval if there is no flag, or if flag matches flags of activation
Expand Down Expand Up @@ -231,7 +231,7 @@ public Response operationReject(
@NotNull RequestContext requestContext,
List<String> activationFlags,
String rejectReason) throws MobileTokenException, PowerAuthClientException {
final OperationDetailResponse operationDetail = getOperationDetailInternal(operationId);
final OperationDetailResponse operationDetail = fetchOperationDetailInternal(operationId);

final String activationFlag = operationDetail.getActivationFlag();
if (activationFlag != null && !activationFlags.contains(activationFlag)) { // allow approval if there is no flag, or if flag matches flags of activation
Expand Down Expand Up @@ -266,7 +266,7 @@ public Response operationReject(
}

/**
* Get operation detail.
* Fetch operation detail.
*
* @param operationId Operation ID.
* @param language Language.
Expand All @@ -276,8 +276,8 @@ public Response operationReject(
* @throws MobileTokenException In case the operation is in incorrect state.
* @throws MobileTokenConfigurationException In case operation template is not configured correctly.
*/
public Operation getOperationDetail(String operationId, String language, String userId) throws MobileTokenException, PowerAuthClientException, MobileTokenConfigurationException {
final OperationDetailResponse operationDetail = getOperationDetailInternal(operationId);
public Operation fetchOperationDetail(String operationId, String language, String userId) throws MobileTokenException, PowerAuthClientException, MobileTokenConfigurationException {
final OperationDetailResponse operationDetail = fetchOperationDetailInternal(operationId);
// Check user ID against authenticated user, however skip the check in case operation is not claimed yet
if (operationDetail.getUserId() != null && !userId.equals(operationDetail.getUserId())) {
logger.warn("User ID from operation does not match authenticated user ID.");
Expand All @@ -297,22 +297,22 @@ public Operation getOperationDetail(String operationId, String language, String
* @throws MobileTokenException In case the operation is in incorrect state.
* @throws MobileTokenConfigurationException In case operation template is not configured correctly.
*/
public Operation claimOperation(String operationId, String language, String userId) throws MobileTokenException, PowerAuthClientException, MobileTokenConfigurationException {
public Operation claimOperation(@NotNull String operationId, @NotNull String language, @NotNull String userId) throws MobileTokenException, PowerAuthClientException, MobileTokenConfigurationException {
final OperationDetailResponse operationDetail = claimOperationInternal(operationId, userId);
return convertOperation(language, operationDetail);
}

// Private methods

/**
* Get operation detail by calling PowerAuth Server.
* Fetch operation detail by calling PowerAuth Server.
*
* @param operationId Operation ID.
* @return Operation detail.
* @throws PowerAuthClientException In case communication with PowerAuth Server fails.
* @throws MobileTokenException When the operation is in incorrect state.
*/
private OperationDetailResponse getOperationDetailInternal(String operationId) throws PowerAuthClientException, MobileTokenException {
private OperationDetailResponse fetchOperationDetailInternal(@NotNull String operationId) throws PowerAuthClientException, MobileTokenException {
final OperationDetailRequest operationDetailRequest = new OperationDetailRequest();
operationDetailRequest.setOperationId(operationId);
final OperationDetailResponse operationDetail = powerAuthClient.operationDetail(
Expand All @@ -325,15 +325,15 @@ private OperationDetailResponse getOperationDetailInternal(String operationId) t
}

/**
* Get operation detail by calling PowerAuth Server.
* Claim the operation by calling operation detail on PowerAuth Server.
*
* @param operationId Operation ID.
* @param userId Optional user ID for operation claim.
* @param userId User ID for operation claim.
* @return Operation detail.
* @throws PowerAuthClientException In case communication with PowerAuth Server fails.
* @throws MobileTokenException When the operation is in incorrect state.
*/
private OperationDetailResponse claimOperationInternal(String operationId, String userId) throws PowerAuthClientException, MobileTokenException {
private OperationDetailResponse claimOperationInternal(@NotNull String operationId, @NotNull String userId) throws PowerAuthClientException, MobileTokenException {
final OperationDetailRequest operationDetailRequest = new OperationDetailRequest();
operationDetailRequest.setOperationId(operationId);
operationDetailRequest.setUserId(userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ public Response registerDevice(

private static MobilePlatform convert(final PushRegisterRequest.Platform source) {
return switch (source) {
case APNS -> MobilePlatform.APNS;
case FCM -> MobilePlatform.FCM;
case HMS -> MobilePlatform.HMS;
case IOS -> MobilePlatform.IOS;
case ANDROID -> MobilePlatform.ANDROID;
case HUAWEI -> MobilePlatform.HUAWEI;
Expand Down
2 changes: 1 addition & 1 deletion mtoken-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<parent>
<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.10.0-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@

<groupId>com.wultra.security</groupId>
<artifactId>enrollment-server-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
<version>1.10.0-SNAPSHOT</version>
<packaging>pom</packaging>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.4</version>
<version>3.3.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand Down Expand Up @@ -96,10 +96,10 @@
<springdoc-openapi-starter-webmvc-ui.version>2.6.0</springdoc-openapi-starter-webmvc-ui.version>
<moneta.version>1.4.4</moneta.version>

<wultra-core.version>1.11.0</wultra-core.version>
<powerauth-crypto.version>1.9.0</powerauth-crypto.version>
<powerauth-restful-integration.version>1.9.0-SNAPSHOT</powerauth-restful-integration.version>
<powerauth-push.version>1.9.0-SNAPSHOT</powerauth-push.version>
<wultra-core.version>1.12.0-SNAPSHOT</wultra-core.version>
<powerauth-crypto.version>1.10.0-SNAPSHOT</powerauth-crypto.version>
<powerauth-restful-integration.version>1.10.0-SNAPSHOT</powerauth-restful-integration.version>
<powerauth-push.version>1.10.0-SNAPSHOT</powerauth-push.version>

<logstash.version>8.0</logstash.version>
</properties>
Expand Down