Skip to content

feat: MAUI scaffold + Keycloak auth (#120)#131

Open
fboucher wants to merge 1 commit intov-nextfrom
squad/120-maui-scaffold-keycloak
Open

feat: MAUI scaffold + Keycloak auth (#120)#131
fboucher wants to merge 1 commit intov-nextfrom
squad/120-maui-scaffold-keycloak

Conversation

@fboucher
Copy link
Copy Markdown
Owner

@fboucher fboucher commented Apr 4, 2026

Summary

Implements the NoteBookmark.MauiApp MAUI Blazor Hybrid project with Keycloak OIDC authentication.

What's in this PR

  • NoteBookmark.MauiApp projectnet10.0-android, added to solution
  • NoteBookmark.SharedUI + NoteBookmark.Domain referenced
  • IAuthService — contract: Login, Logout, GetAccessToken (silent refresh), IsAuthenticated, Initialize
  • KeycloakAuthService — OIDC via WebAuthenticator + PKCE (RFC 7636), token exchange via HttpClient, SecureStorage persistence
  • Startup logic in App.xaml.cs: loads tokens on start, silent refresh if expired and online
  • Offline handling: expired token + offline → user sees "Session expired — go online to re-authenticate"
  • Login.razor — sign-in page, surfaces offline/expired message
  • Home.razor — post-login placeholder: "Hello, {username}" + Sign out button
  • Routes.razor — includes NoteBookmark.SharedUI.PostNoteClient.Assembly in additional assemblies
  • Android intent filternotebookmark://auth/callback for WebAuthenticator redirect
  • Placeholder Keycloak config in wwwroot/appsettings.json (Frank to fill in real values)

Key implementation notes

  • PKCE code verifier/challenge generated with SHA256 + base64url (no extra NuGet dep)
  • SecureStorage keys: auth_access_token, auth_refresh_token, auth_token_expiry
  • MSBuild target RemoveAspNetCoreFrameworkReferenceForAndroid strips the transitive Microsoft.AspNetCore.App FrameworkReference on Android targets (NETSDK1082 workaround; see csproj comment)
  • Build verified: dotnet build ... -f net10.0-android -r android-arm64 → 0 errors, 2 pre-existing NU1510 warnings

Closes #120

- Add NoteBookmark.MauiApp project targeting net10.0-android
- Implement IAuthService with OIDC login via WebAuthenticator + PKCE
- KeycloakAuthService: token exchange, SecureStorage persistence,
  silent refresh, offline/expired detection
- Login.razor page with session-expired-offline message
- Home.razor post-login page: Hello {username} + Sign out button
- Routes.razor wires in NoteBookmark.SharedUI.PostNoteClient assembly
- Android intent filter for notebookmark://auth/callback redirect
- MSBuild target strips Microsoft.AspNetCore.App transitive
  FrameworkReference on Android (NETSDK1082 workaround)
- Placeholder Keycloak config in wwwroot/appsettings.json
- Added to NoteBookmark.sln and Directory.Packages.props

Co-authored-by: Copilot <[email protected]>
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