-
Notifications
You must be signed in to change notification settings - Fork 23
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 #379 from ForgeRock/develop
ForgeRock Android SDK 4.3.0 Release
- Loading branch information
Showing
100 changed files
with
3,902 additions
and
1,169 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
name: Run Mend CLS Scan | ||
on: | ||
workflow_call: | ||
secrets: | ||
MEND_EMAIL: | ||
description: Mend email | ||
required: true | ||
MEND_USER_KEY: | ||
description: Mend user key | ||
required: true | ||
SLACK_WEBHOOK: | ||
description: Slack Notifier Incoming Webhook | ||
required: true | ||
|
||
jobs: | ||
mend-cli-scan: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Clone the repo | ||
- name: Clone the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{github.event.pull_request.head.repo.full_name}} | ||
fetch-depth: 0 | ||
|
||
# Setup JDK and cache and restore dependencies. | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
cache: 'gradle' | ||
|
||
# Setup Mend CLI | ||
- name: Download and cache the Mend CLI executable | ||
id: cache-mend | ||
uses: actions/cache@v3 | ||
env: | ||
mend-cache-name: cache-mend-executable | ||
with: | ||
path: /usr/local/bin/mend | ||
key: ${{ runner.os }}-${{ env.mend-cache-name }}-${{ hashFiles('/usr/local/bin/mend') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ env.mend-cache-name }}- | ||
# Download Mend CLI if it's not cached... | ||
- if: ${{ steps.cache-mend.outputs.cache-hit != 'true' }} | ||
name: Download Mend CLI executable (cache miss...) | ||
continue-on-error: true | ||
run: | | ||
echo "Download Mend CLI executable (cache miss...)" | ||
curl https://downloads.mend.io/cli/linux_amd64/mend -o /usr/local/bin/mend && chmod +x /usr/local/bin/mend | ||
# Execute the Mend CLI scan | ||
- name: Mend CLI Scan | ||
env: | ||
MEND_EMAIL: ${{secrets.MEND_EMAIL}} | ||
MEND_USER_KEY: ${{secrets.MEND_USER_KEY}} | ||
MEND_URL: ${{ vars.MEND_SERVER_URL }} | ||
run: | | ||
mend dep --no-color -s ${{ vars.MEND_PRODUCT_NAME }}//${{ vars.MEND_PROJECT_NAME }} -u > mend-scan-result.txt | ||
echo "MEND_SCAN_URL=$(cat mend-scan-result.txt | grep -Eo '(http|https)://[a-zA-Z0-9./?!=_%:-\#]*')" >> $GITHUB_ENV | ||
echo "MEND_SCAN_SUMMARY=$(cat mend-scan-result.txt | grep -Eoiw '(Detected [0-9]* vulnerabilities.*)')" >> $GITHUB_ENV | ||
echo "MEND_CRITICAL_COUNT=$(cat mend-scan-result.txt | grep -Eoiw '(Detected [0-9]* vulnerabilities.*)' | grep -oi '[0-9]* Critical' | grep -o [0-9]*)" >> $GITHUB_ENV | ||
echo "MEND_HIGH_COUNT=$(cat mend-scan-result.txt | grep -Eoiw '(Detected [0-9]* vulnerabilities.*)' | grep -oi '[0-9]* High' | grep -o [0-9]*)" >> $GITHUB_ENV | ||
# Check for failures and set the outcome of the workflow | ||
- name: Parse the result and set job status | ||
if: always() | ||
run: | | ||
if [ '${{ env.MEND_CRITICAL_COUNT }}' -gt '0' ] || [ '${{ env.MEND_HIGH_COUNT }}' -gt '0' ]; then | ||
exit 1 | ||
else | ||
exit 0 | ||
fi | ||
# Publish the result | ||
- name: Mend Scan Result | ||
uses: LouisBrunner/[email protected] | ||
if: always() | ||
with: | ||
name: "Mend Scan Result" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
conclusion: ${{ job.status }} | ||
output_text_description_file: mend-scan-result.txt | ||
output: | | ||
{"title":"Mend Scan Result", "summary":"${{ job.status }}"} | ||
# Send slack notification with result status | ||
- name: Send slack notification | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: custom | ||
fields: all | ||
custom_payload: | | ||
{ | ||
attachments: [{ | ||
title: 'ForgeRock Android SDK Mend Scan', | ||
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning', | ||
text: `\nStatus: ${{ job.status }}\nWorkflow: ${process.env.AS_WORKFLOW} -> ${process.env.AS_JOB}\nSummary: ${{ env.MEND_SCAN_SUMMARY }}\nScan URL: ${{ env.MEND_SCAN_URL }}`, | ||
}] | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
if: always() |
This file was deleted.
Oops, something went wrong.
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
88 changes: 88 additions & 0 deletions
88
...ui/src/main/java/org/forgerock/android/auth/ui/callback/AppIntegrityCallbackFragment.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,88 @@ | ||
/* | ||
* Copyright (c) 2023 ForgeRock. All rights reserved. | ||
* | ||
* This software may be modified and distributed under the terms | ||
* of the MIT license. See the LICENSE file for details. | ||
*/ | ||
|
||
package org.forgerock.android.auth.ui.callback; | ||
|
||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ProgressBar; | ||
import android.widget.TextView; | ||
|
||
import androidx.fragment.app.Fragment; | ||
|
||
import org.forgerock.android.auth.FRListener; | ||
import org.forgerock.android.auth.Logger; | ||
import org.forgerock.android.auth.callback.AppIntegrityCallback; | ||
import org.forgerock.android.auth.ui.R; | ||
|
||
import static android.view.View.GONE; | ||
|
||
/** | ||
* A simple {@link Fragment} subclass. | ||
*/ | ||
public class AppIntegrityCallbackFragment extends CallbackFragment<AppIntegrityCallback> { | ||
|
||
private TextView message; | ||
private ProgressBar progressBar; | ||
|
||
public AppIntegrityCallbackFragment() { | ||
// Required empty public constructor | ||
} | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
Bundle savedInstanceState) { | ||
|
||
|
||
// Inflate the layout for this fragment | ||
View view = inflater.inflate(R.layout.fragment_app_integrity_callback, container, false); | ||
message = view.findViewById(R.id.message); | ||
progressBar = view.findViewById(R.id.appIntegrityApiCallProgress); | ||
|
||
if (node.getCallbacks().size() == 1) { //auto submit if there is one node | ||
progressBar.setVisibility(View.VISIBLE); | ||
message.setText("Performing " + callback.getRequestType() + " call..."); | ||
} else { | ||
progressBar.setVisibility(GONE); | ||
message.setVisibility(GONE); | ||
} | ||
|
||
proceed(); | ||
return view; | ||
} | ||
|
||
private void proceed() { | ||
final Activity thisActivity = (Activity) this.getActivity(); | ||
callback.requestIntegrityToken(this.getContext(), new FRListener<Void>() { | ||
@Override | ||
public void onSuccess(Void result) { | ||
thisActivity.runOnUiThread(new Runnable() { | ||
@Override | ||
public void run() { | ||
message.setVisibility(GONE); | ||
progressBar.setVisibility(GONE); | ||
if (node.getCallbacks().size() == 1) { //auto submit if there is one node | ||
next(); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public void onException(Exception e) { | ||
message.setVisibility(GONE); | ||
progressBar.setVisibility(GONE); | ||
Logger.error("AppIntegrityCallback", e.toString()); | ||
cancel(e); | ||
} | ||
}); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
forgerock-auth-ui/src/main/res/layout/fragment_app_integrity_callback.xml
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 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
~ Copyright (c) 2019 - 2023 ForgeRock. All rights reserved. | ||
~ | ||
~ This software may be modified and distributed under the terms | ||
~ of the MIT license. See the LICENSE file for details. | ||
--> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".callback.AppIntegrityCallbackFragment" android:id="@+id/frameLayout"> | ||
|
||
<TextView | ||
android:id="@+id/message" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"/> | ||
|
||
<ProgressBar | ||
android:id="@+id/appIntegrityApiCallProgress" | ||
style="?android:attr/progressBarStyle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginBottom="8dp" | ||
app:layout_constraintBottom_toTopOf="@+id/message" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
Oops, something went wrong.