Skip to content
Open
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
4 changes: 3 additions & 1 deletion shapes-app/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ android {
compileSdkVersion 31
defaultConfig {
applicationId "io.approov.shapes"
minSdkVersion 21
minSdkVersion 23
targetSdkVersion 31
versionCode 3
versionName "3.0"
Expand Down Expand Up @@ -32,6 +32,8 @@ android {
}

dependencies {
// implementation 'androidx.annotation:annotation:1.8.2'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation project(':approov-service')
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ public void run() {
URL url = new URL(getResources().getString(R.string.shapes_url));
connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
// Keep the originally signed request target unchanged (redirects can invalidate signatures).
connection.setInstanceFollowRedirects(false);
connection.addRequestProperty("Api-Key", getResources().getString(R.string.shapes_api_key));
Comment on lines +208 to 210

// *** UNCOMMENT THE LINE BELOW FOR APPROOV USING SECRETS PROTECTION ***
Expand All @@ -214,6 +216,7 @@ public void run() {
//ApproovService.addApproov(connection);

connection.connect();

msg = "Http status code " + connection.getResponseCode();
if (connection.getResponseCode() == 200)
imgId = readShapesResponse(connection);
Expand Down
12 changes: 11 additions & 1 deletion shapes-app/app/src/main/java/io/approov/shapes/ShapesApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,23 @@
// *** UNCOMMENT THE LINE BELOW FOR APPROOV ***
//import io.approov.service.httpsurlconn.ApproovService;

// *** UNCOMMENT THE LINE BELOW FOR APPROOV WITH INSTALLATION MESSAGE SIGNING ***
//import io.approov.service.httpsurlconn.ApproovDefaultMessageSigning;


public class ShapesApp extends Application {
@Override
public void onCreate() {
super.onCreate();

// *** UNCOMMENT THE LINE BELOW FOR APPROOV ***
//ApproovService.initialize(getApplicationContext(), "<enter-your-config-string-here>");
//ApproovService.initialize(getApplicationContext(), "#199896#cjjyY5WNuuhkdzTDYV49eGZfXOYbnQrL16nzxoYqWbc=");

// *** UNCOMMENT THE LINES BELOW FOR APPROOV WITH INSTALLATION MESSAGE SIGNING ***
// ApproovService.setServiceMutator(
// new ApproovDefaultMessageSigning()
// .setDefaultFactory(ApproovDefaultMessageSigning.generateDefaultSignatureParametersFactory())
// );

}
}
4 changes: 3 additions & 1 deletion shapes-app/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
include ':approov-sdk'
//include ':approov-sdk'
include ':app'
include ':approov-service'
project(':approov-service').projectDir = new File('/Users/charlesoj/Developer/Quickstarts/approov-service-httpsurlconn/approov-service')