File tree Expand file tree Collapse file tree
src/main/java/io/approov/shapes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ android {
44 compileSdkVersion 31
55 defaultConfig {
66 applicationId " io.approov.shapes"
7- minSdkVersion 21
7+ minSdkVersion 23
88 targetSdkVersion 31
99 versionCode 3
1010 versionName " 3.0"
@@ -32,6 +32,8 @@ android {
3232}
3333
3434dependencies {
35+ // implementation 'androidx.annotation:annotation:1.8.2'
3536 implementation fileTree(dir : ' libs' , include : [' *.jar' ])
3637 implementation ' androidx.appcompat:appcompat:1.4.1'
38+ implementation project(' :approov-service' )
3739}
Original file line number Diff line number Diff line change @@ -205,6 +205,8 @@ public void run() {
205205 URL url = new URL (getResources ().getString (R .string .shapes_url ));
206206 connection = (HttpsURLConnection ) url .openConnection ();
207207 connection .setRequestMethod ("GET" );
208+ // Keep the originally signed request target unchanged (redirects can invalidate signatures).
209+ connection .setInstanceFollowRedirects (false );
208210 connection .addRequestProperty ("Api-Key" , getResources ().getString (R .string .shapes_api_key ));
209211
210212 // *** UNCOMMENT THE LINE BELOW FOR APPROOV USING SECRETS PROTECTION ***
@@ -214,6 +216,7 @@ public void run() {
214216 //ApproovService.addApproov(connection);
215217
216218 connection .connect ();
219+
217220 msg = "Http status code " + connection .getResponseCode ();
218221 if (connection .getResponseCode () == 200 )
219222 imgId = readShapesResponse (connection );
Original file line number Diff line number Diff line change 2222// *** UNCOMMENT THE LINE BELOW FOR APPROOV ***
2323//import io.approov.service.httpsurlconn.ApproovService;
2424
25+ // *** UNCOMMENT THE LINE BELOW FOR APPROOV WITH INSTALLATION MESSAGE SIGNING ***
26+ //import io.approov.service.httpsurlconn.ApproovDefaultMessageSigning;
27+
2528
2629public class ShapesApp extends Application {
2730 @ Override
2831 public void onCreate () {
2932 super .onCreate ();
3033
3134 // *** UNCOMMENT THE LINE BELOW FOR APPROOV ***
32- //ApproovService.initialize(getApplicationContext(), "<enter-your-config-string-here>");
35+ //ApproovService.initialize(getApplicationContext(), "#199896#cjjyY5WNuuhkdzTDYV49eGZfXOYbnQrL16nzxoYqWbc=");
36+
37+ // *** UNCOMMENT THE LINES BELOW FOR APPROOV WITH INSTALLATION MESSAGE SIGNING ***
38+ // ApproovService.setServiceMutator(
39+ // new ApproovDefaultMessageSigning()
40+ // .setDefaultFactory(ApproovDefaultMessageSigning.generateDefaultSignatureParametersFactory())
41+ // );
42+
3343 }
3444}
Original file line number Diff line number Diff line change 1- include ' :approov-sdk'
1+ // include ':approov-sdk'
22include ' :app'
3+ include ' :approov-service'
4+ project(' :approov-service' ). projectDir = new File (' /Users/charlesoj/Developer/Quickstarts/approov-service-httpsurlconn/approov-service' )
You can’t perform that action at this time.
0 commit comments