Httpsurlconn imsinteg prod#5
Conversation
…line with updates to HttpsURLConn service layer. V5 endpoint tested successfully. Instructional files within quickstart require further updates. Reverted quickstart to original V1 state with installation message signing changes commented out.
There was a problem hiding this comment.
Pull request overview
Updates the Android Java HttpsURLConnection quickstart and Shapes demo to use the newer Approov service integration pattern (returned/wrapped connection), adds guidance for installation message signing, and aligns documentation/configuration with the updated integration.
Changes:
- Switch Shapes demo to treat
ApproovService.addApproov(...)as returning anHttpsURLConnectionto continue using. - Add documentation and sample setup hooks for installation message signing.
- Update Android minSdk to 23 and adjust project wiring to reference an
approov-servicemodule.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| shapes-app/settings.gradle | Adds :approov-service include and maps it to a local filesystem path. |
| shapes-app/app/src/main/java/io/approov/shapes/ShapesApp.java | Adds commented wiring for installation message signing mutator. |
| shapes-app/app/src/main/java/io/approov/shapes/MainActivity.java | Updates sample to use returned connection from addApproov and reformats handler block. |
| shapes-app/app/build.gradle | Raises minSdk to 23 and adds dependency on :approov-service. |
| shapes-app/app/.project | Eclipse resource filter tweak (regex escaping) and regenerated filter id. |
| shapes-app/app/.classpath | Updates Eclipse JRE container from Java 11 to Java 17. |
| shapes-app/.settings/org.eclipse.buildship.core.prefs | Updates Buildship args/java.home to machine-specific paths. |
| shapes-app/.project | Eclipse resource filter tweak (regex escaping) and regenerated filter id. |
| SHAPES-EXAMPLE.md | Updates guidance for returned connection usage; adds installation message signing section. |
| SECRETS-PROTECTION.md | Updates sample imports to the httpsurlconn package. |
| REFERENCE.md | Updates addApproov signature to return HttpsURLConnection and documents wrapper behavior. |
| README.md | Updates minSdk note to 23 and documents assigning the returned connection from addApproov. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| dependencies { | ||
| // implementation 'androidx.annotation:annotation:1.8.2' |
There was a problem hiding this comment.
There is a commented-out dependency left in the dependencies block. Since it has no effect and can be confusing when troubleshooting dependency resolution, consider removing it or adding a brief comment explaining when it is needed.
| // implementation 'androidx.annotation:annotation:1.8.2' |
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <classpath> | ||
| <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/> | ||
| <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/> |
There was a problem hiding this comment.
The Eclipse classpath is being switched to JavaSE-17. This repo’s Gradle wrapper is gradle-7.2, which typically requires running on an older JDK (and AGP 7.1.x is commonly run on JDK 11). Unless the wrapper/AGP are also being upgraded, keeping the project JRE at 11 avoids IDE/Buildship build failures.
| <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/> | |
| <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/> |
| //include ':approov-sdk' | ||
| include ':app' | ||
| include ':approov-service' | ||
| project(':approov-service').projectDir = new File('/Users/charlesoj/Developer/Quickstarts/approov-service-httpsurlconn/approov-service') |
There was a problem hiding this comment.
project(':approov-service').projectDir is set to an absolute path under /Users/..., which will break builds for anyone else (CI, other dev machines, different OS). Prefer a repository-relative path (e.g., based on settingsDir) or, better, consume the service via a published Maven dependency instead of a local project reference.
| project(':approov-service').projectDir = new File('/Users/charlesoj/Developer/Quickstarts/approov-service-httpsurlconn/approov-service') | |
| project(':approov-service').projectDir = new File(settingsDir, '../approov-service-httpsurlconn/approov-service') |
| // implementation 'androidx.annotation:annotation:1.8.2' | ||
| implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
| implementation 'androidx.appcompat:appcompat:1.4.1' | ||
| implementation project(':approov-service') |
There was a problem hiding this comment.
implementation project(':approov-service') makes the app depend on a Gradle module that is not present in this repository (and is currently mapped via an absolute path in settings.gradle). This will fail for fresh checkouts and CI; switch back to the documented Maven dependency or vendor the module into the repo with a relative path.
| implementation project(':approov-service') | |
| implementation 'io.approov:service:+' |
| arguments=--init-script /var/folders/d1/7dc4qrgd51v_5zzdcgsm3k0m0000gn/T/db3b08fc4a9ef609cb16b96b200fa13e563f396e9bb1ed0905fdab7bc3bc513b.gradle --init-script /var/folders/d1/7dc4qrgd51v_5zzdcgsm3k0m0000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle --init-script /var/folders/d1/7dc4qrgd51v_5zzdcgsm3k0m0000gn/T/861a75667e10803d304a058d833cb7404195ca44013d0d61d3b653eb084379b8.gradle --init-script /var/folders/d1/7dc4qrgd51v_5zzdcgsm3k0m0000gn/T/68eb1b6516fe21c6fbba58e63c99c3207ccfc918360613709367eecde56fa77f.gradle --init-script /var/folders/d1/7dc4qrgd51v_5zzdcgsm3k0m0000gn/T/da64152279c70a8b4f3de4ca9ea66fd3b3405b7aca4e1f20f2d08e5593aa1ce1.gradle | ||
| auto.sync=false | ||
| build.scans.enabled=false | ||
| connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) | ||
| connection.project.dir= | ||
| eclipse.preferences.version=1 | ||
| gradle.user.home= | ||
| java.home=/usr/lib/jvm/java-11-openjdk-amd64 | ||
| java.home=/Users/charlesoj/Library/Java/JavaVirtualMachines/jbr-17.0.14/Contents/Home | ||
| jvm.arguments= |
There was a problem hiding this comment.
This Buildship prefs file now embeds machine-specific temporary --init-script paths and a user-specific java.home. Committing these values makes the Eclipse/Buildship configuration non-portable and likely to break for other developers. Consider removing these entries (or the whole file) from version control and relying on workspace-local settings instead.
| We pass the `HttpsUrlConnection` to the `ApproovService.addApproov` method and continue with the returned `HttpsURLConnection`. This automatically fetches an Approov token and adds it as a header to the request. It also pins the connection to the endpoint to ensure that no Man-in-the-Middle can eavesdrop on any communication being made. | ||
|
|
There was a problem hiding this comment.
The documentation refers to HttpsUrlConnection, but the actual Java type is HttpsURLConnection (as linked). Using the correct class name here will avoid confusion for readers trying to follow the sample code.
Quickstart is now prod ready with IMS integrated into the shapes app demo.