Add browser service launchWebAuthentication API#451
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new BrowserService.launchWebAuthentication(...) API to support secure web-based authentication flows, addressing iOS limitations with HTTPS redirect handling by using ASWebAuthenticationSession.
Changes:
- Introduces
launchWebAuthentication(String url, String callbackUrlScheme, Consumer<String> callback)to theBrowserServiceAPI with cross-platform implementations. - Implements iOS web authentication via
ASWebAuthenticationSession(including iOS 17.4+ HTTPS callback support) and JNI callback plumbing back into Java. - Adds iOS Substrate/Graal JNI config entries and links the
AuthenticationServicesframework for native builds.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/browser/src/main/resources/META-INF/substrate/config/jniconfig-x86_64-ios.json | Enables Substrate/Graal JNI access for iOS auth result callback method. |
| modules/browser/src/main/resources/META-INF/substrate/config/jniconfig-arm64-ios.json | Same as above for arm64 iOS builds. |
| modules/browser/src/main/native/ios/Browser.m | Adds ASWebAuthenticationSession-based auth flow and JNI callback into Java. |
| modules/browser/src/main/java/module-info.java | Declares JavaFX dependency needed for Java-side callback dispatch (Platform.runLater). |
| modules/browser/src/main/java/com/gluonhq/attach/browser/impl/IOSBrowserService.java | Adds Java-facing API, stores callback, and receives native results. |
| modules/browser/src/main/java/com/gluonhq/attach/browser/impl/DesktopBrowserService.java | Adds API method (currently delegates to external browser). |
| modules/browser/src/main/java/com/gluonhq/attach/browser/impl/AndroidBrowserService.java | Adds API method (currently delegates to external browser). |
| modules/browser/src/main/java/com/gluonhq/attach/browser/BrowserService.java | Defines new public API + documentation. |
| gradle/native-build.gradle | Links AuthenticationServices framework for iOS builds. |
Comments suppressed due to low confidence (1)
modules/browser/src/main/native/ios/Browser.m:62
JNI_OnLoad_Browsercurrently caches aJNIEnv*globally, butJNIEnv*is only valid on the thread it was obtained on. Save theJavaVM*and useGetEnvonly for the version check.
JNIEXPORT jint JNICALL
JNI_OnLoad_Browser(JavaVM *vm, void *reserved)
{
#ifdef JNI_VERSION_1_8
//min. returned JNI_VERSION required by JDK8 for builtin libraries
if ((*vm)->GetEnv(vm, (void **)&env, JNI_VERSION_1_8) != JNI_OK) {
return JNI_VERSION_1_4;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #450