Skip to content

Connect to LibreDB Studio through Keycloak - #1

Merged
cevheri merged 4 commits into
mainfrom
feat/studio-connection
Oct 22, 2026
Merged

cevheri merged 4 commits into
mainfrom
feat/studio-connection

Conversation

@cevheri

@cevheri cevheri commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

The app now signs in to Keycloak as the public client libredb-mobile and calls LibreDB Studio with the access token as bearer. Needs libredb/libredb-studio#1914; the Platform installer side is libredb/libredb-platform#22.

  • App identity is org.libredb.mobile on Android and iOS, redirect URI org.libredb.mobile:/oauth2redirect.
  • PROD_API_URL define for Studio's /api.
  • First Studio slice: a Connections page from GET /api/connections/managed.
  • tool/studio-dev: Keycloak and Studio behind Caddy TLS, an env file, and a script that trusts the CA on an emulator. Guide in docs/studio.md.

Verified locally: format, analyze, 3129 tests (coverage 93%), Android JVM tests, release APK, web build and placeholder check. End to end on an API 30 emulator against Studio built from #1914 at d8d1b4970: SSO sign-in, the connection list, refresh after the 60 s token expired, and logout ending the Keycloak session.

Not verified: iOS (no macOS here).

Follow-ups: the app title and drawer still say "BLoC Advance", and Studio's 401 AUTH_ERROR/LLM_AUTH must not trigger a refresh once query screens arrive.

The Android application id and namespace, the iOS bundle identifiers and the OIDC redirect scheme still named the template, so a Keycloak client registered for LibreDB would have had to carry the template's scheme.
They are now org.libredb.mobile, the redirect URI is org.libredb.mobile:/oauth2redirect, and the app shows as LibreDB on both platforms.
The Kotlin sources move to the matching package, and the demo realm, the OIDC guide and the tests follow the new scheme.
A build against a Studio instance needs its API address without editing the source, as the repository and docs links already allow.
TemplateConfig.prodApiUrl now reads --dart-define=PROD_API_URL and keeps the placeholder as its default.
The demo values guard skips PROD_API_URL for the compiled defaults too, as its documentation already said, since the mock-only demo never selects the production config.
The app had no screen that called Studio, so a signed-in session never proved that Studio accepted the Keycloak access token.
A new connections feature reads GET /api/connections/managed through ConnectionListBloc and shows the seed or granted connections, without credentials, on a Connections page in the menu.
An unreadable answer fails with a ServerError instead of an empty list, and a failed load offers a retry.
The mock answers the request, and the repository method is in the mock asset coverage table.
tool/studio-dev starts Keycloak with a libredb-mobile public client and Studio with its bearer channel on, both behind Caddy over TLS, since Studio refuses an issuer that is not https.
studio-dev.env builds the app against it, and trust-android-emulator.sh puts the stack's CA into an emulator's system store and forwards the ports.
docs/studio.md describes the Keycloak and Studio settings the app needs and the walkthrough, verified on an API 30 emulator against Studio built from libredb/libredb-studio#1914.
@cevheri
cevheri merged commit 8cb68e5 into main Oct 22, 2026
5 checks passed
@cevheri
cevheri deleted the feat/studio-connection branch October 22, 2026 04:17
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.

1 participant