Skip to content

Commit

Permalink
Fix #1134: Add new push platform enums, deprecate old ones
Browse files Browse the repository at this point in the history
  • Loading branch information
romanstrobl committed Nov 6, 2024
1 parent b128ac1 commit 038e2ca
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/Migration-Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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)
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.
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
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

0 comments on commit 038e2ca

Please sign in to comment.