-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #720 from wultra/develop
Merge develop to master
- Loading branch information
Showing
24 changed files
with
382 additions
and
98 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Run SCP deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
scp-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: 'temurin' | ||
server-id: jfrog-central | ||
server-username: INTERNAL_USERNAME | ||
server-password: INTERNAL_PASSWORD | ||
cache: maven | ||
- name: Run Maven Package Step | ||
run: | | ||
mvn -B -U package -Dmaven.test.skip=true | ||
env: | ||
INTERNAL_USERNAME: ${{ secrets.JFROG_USERNAME }} | ||
INTERNAL_PASSWORD: ${{ secrets.JFROG_PASSWORD }} | ||
- name: Set up SSH key | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "${{ secrets.SCP_CERTIFICATE }}" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
ssh-keyscan -t rsa ${{ secrets.SCP_HOST }} >> ~/.ssh/known_hosts | ||
- name: Deploy powerauth-push-server.war | ||
shell: bash | ||
run: | | ||
scp -i ~/.ssh/id_rsa **/target/powerauth-push-server-*.war ${{ secrets.SCP_USERNAME }}@${{ secrets.SCP_HOST }}:/opt/apache-tomcat/webapps/powerauth-push-server.war |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Migration from 1.5.x to 1.6.x | ||
|
||
This guide contains instructions for migration from PowerAuth Push Server version `1.5.x` to version `1.6.x`. | ||
|
||
No migration steps nor database changes are required. |
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
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
75 changes: 75 additions & 0 deletions
75
powerauth-push-server/src/main/java/io/getlime/push/service/PayloadBuilder.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,75 @@ | ||
/* | ||
* Copyright 2023 Wultra s.r.o. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.getlime.push.service; | ||
|
||
import com.eatthepath.pushy.apns.util.ApnsPayloadBuilder; | ||
import com.eatthepath.pushy.apns.util.SimpleApnsPayloadBuilder; | ||
import io.getlime.push.model.entity.PushMessageBody; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Convert {@link PushMessageBody} to platform dependant payload. | ||
* | ||
* @author Lubos Racansky, [email protected] | ||
*/ | ||
@Slf4j | ||
final class PayloadBuilder { | ||
|
||
private PayloadBuilder() { | ||
throw new IllegalStateException("Should not be instantiated."); | ||
} | ||
|
||
/** | ||
* Method to build APNs message payload. | ||
* | ||
* @param push Push message object with APNs data. | ||
* @param isSilent Indicates if the message is silent or not. | ||
* @return String with APNs JSON payload. | ||
*/ | ||
static String buildApnsPayload(final PushMessageBody push, final boolean isSilent) { | ||
final ApnsPayloadBuilder payloadBuilder = new SimpleApnsPayloadBuilder(); | ||
if (!isSilent) { // include alert, body, sound and category only in case push message is not silent. | ||
payloadBuilder | ||
.setAlertTitle(push.getTitle()) | ||
.setLocalizedAlertTitle(push.getTitleLocKey(), push.getTitleLocArgs()) | ||
.setAlertBody(push.getBody()) | ||
.setLocalizedAlertMessage(push.getBodyLocKey(), push.getBodyLocArgs()) | ||
.setSound(push.getSound()) | ||
.setCategoryName(push.getCategory()); | ||
} | ||
|
||
payloadBuilder | ||
.setBadgeNumber(push.getBadge()) | ||
.setContentAvailable(isSilent) | ||
.setThreadId(push.getCollapseKey()); | ||
|
||
final Map<String, Object> extras = push.getExtras(); | ||
if (extras != null) { | ||
for (Map.Entry<String, Object> entry : extras.entrySet()) { | ||
if (entry.getValue() != null) { | ||
payloadBuilder.addCustomProperty(entry.getKey(), entry.getValue()); | ||
} else { | ||
// Workaround for a known Apple issue, the JSON is valid but APNS would not send the push message. | ||
logger.debug("Skipping extras key: {} because of null value.", entry.getKey()); | ||
} | ||
} | ||
} | ||
|
||
return payloadBuilder.build(); | ||
} | ||
} |
Oops, something went wrong.