Skip to content

Add browser service launchWebAuthentication API#451

Merged
jperedadnr merged 1 commit into
gluonhq:masterfrom
jperedadnr:450-webauth
Jun 12, 2026
Merged

Add browser service launchWebAuthentication API#451
jperedadnr merged 1 commit into
gluonhq:masterfrom
jperedadnr:450-webauth

Conversation

@jperedadnr

Copy link
Copy Markdown
Contributor

Fixes #450

Copilot AI review requested due to automatic review settings June 12, 2026 00:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 the BrowserService API 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 AuthenticationServices framework 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_Browser currently caches a JNIEnv* globally, but JNIEnv* is only valid on the thread it was obtained on. Save the JavaVM* and use GetEnv only 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.

Comment thread modules/browser/src/main/native/ios/Browser.m
Comment thread modules/browser/src/main/native/ios/Browser.m
Comment thread modules/browser/src/main/native/ios/Browser.m
Comment thread modules/browser/src/main/native/ios/Browser.m
@jperedadnr
jperedadnr merged commit 0a800e2 into gluonhq:master Jun 12, 2026
1 check passed
@jperedadnr
jperedadnr deleted the 450-webauth branch June 12, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BrowserService] Allow secure authentication

2 participants