FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Add Keycloak authentication helpers by kaziiza · Pull Request #470 · parse-community/Parse-Swift · GitHub

feat: Add Keycloak authentication helpers - #470

Open
kaziiza wants to merge 3 commits into
parse-community:mainfrom
kaziiza:codex/parse-keycloak-auth
Open

kaziiza wants to merge 3 commits into
parse-community:mainfrom
kaziiza:codex/parse-keycloak-auth

Conversation

kaziiza commented May 12, 2026
edited
Loading

Copy link
Copy Markdown

New Pull Request Checklist

Issue Description

Refs #55

Approach

Adds ParseKeycloak helper APIs for Parse Server's Keycloak auth adapter.

  • adds ParseKeycloak authData construction and validation for the required string fields id and access_token
  • adds callback, async/await, and Combine login/link helpers
  • adds tests for authData generation, required-key validation, login/link flows, invalid authData, unlink, and Combine helpers
  • registers the new source and test files in the Xcode project

This PR intentionally supports only the string authData fields that Parse-Swift's current authentication APIs can represent. Parse Server's Keycloak adapter also documents optional roles and groups arrays, but those are not exposed here because existing Parse-Swift authData is modeled as [String: String] / [String: [String: String]?].

If a Keycloak access token contains roles or groups claims that Parse Server validates, this helper cannot include those array-valued fields. Supporting that case would require a broader SDK authData model change and is out of scope for this small helper slice.

TODOs before merging

None.

Testing

  • git diff --check
  • verified no ParseVKontakte / vkontakte leftovers in Sources, Tests, or project.pbxproj
  • verified no >120 character lines in new ParseKeycloak source/test files
  • verified project.pbxproj includes the ParseKeycloak group, source/test file refs, source build entries, test build entries, and no duplicate PBX object definitions
  • swift build
  • swift test --enable-code-coverage --filter ParseKeycloak passed: 14 tests, 0 failures.

parse-github-assistant Bot commented May 12, 2026
edited
Loading

Copy link
Copy Markdown

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

Tip

  • Keep pull requests small. Large PRs will be rejected. Break complex features into smaller, incremental PRs.
  • Use Test Driven Development. Write failing tests before implementing functionality. Ensure tests pass.
  • Group code into logical blocks. Add a short comment before each block to explain its purpose.
  • We offer conceptual guidance. Coding is up to you. PRs must be merge-ready for human review.
  • Our review focuses on concept, not quality. PRs with code issues will be rejected. Use an AI agent.
  • Human review time is precious. Avoid review ping-pong. Inspect and test your AI-generated code.

Note

Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect.

Caution

Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code.

coderabbitai Bot commented May 12, 2026
edited
Loading

Copy link
Copy Markdown

Warning

Rate limit exceeded

@kaziiza has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 55 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info ⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ef51f7f9-5de3-422d-aaa6-0ba066315fc9

📥 Commits

Reviewing files that changed from the base of the PR and between b65018b and 23277a1.

📒 Files selected for processing (3)
  • Sources/ParseSwift/Authentication/3rd Party/ParseKeycloak/ParseKeycloak.swift
  • Tests/ParseSwiftTests/ParseKeycloakCombineTests.swift
  • Tests/ParseSwiftTests/ParseKeycloakTests.swift
📝 Walkthrough

Walkthrough

This PR adds complete Keycloak authentication support to ParseSwift. It introduces a ParseKeycloak<AuthenticatedUser> authentication type with callback-based login and link operations, alongside async/await and Combine publisher variants. Comprehensive test coverage validates all three concurrency models and authentication flows. Xcode project configuration wires the new sources and tests across all framework targets.

Changes

ParseKeycloak Authentication Integration

Layer / File(s) Summary
Core ParseKeycloak authentication type
Sources/ParseSwift/Authentication/3rd Party/ParseKeycloak/ParseKeycloak.swift
Defines ParseKeycloak<AuthenticatedUser> generic type conforming to ParseAuthentication. Models required Keycloak authData keys (id, access_token), validates mandatory keys, implements callback-based login and link methods, and adds ParseUser convenience accessors (static keycloak, instance keycloak).
Async/await concurrency API
Sources/ParseSwift/Authentication/3rd Party/ParseKeycloak/ParseKeycloak+async.swift
Provides four public async functions (login(id:accessToken:), login(authData:), link(id:accessToken:), link(authData:)) wrapping callback-based methods via withCheckedThrowingContinuation, returning AuthenticatedUser.
Combine publisher API
Sources/ParseSwift/Authentication/3rd Party/ParseKeycloak/ParseKeycloak+combine.swift
Exposes Future-based publisher methods: loginPublisher(id:accessToken:), loginPublisher(authData:), linkPublisher(id:accessToken:), linkPublisher(authData:) that bridge to callback-based core implementation.
Core functionality tests
Tests/ParseSwiftTests/ParseKeycloakTests.swift
Tests callback and async login/link/unlink flows including authData key validation, mandatory-key verification, error handling, and user state transitions (isLinked, anonymous.isLinked, updatedAt, password).
Combine publisher tests
Tests/ParseSwiftTests/ParseKeycloakCombineTests.swift
Tests Combine publisher variants with mock server responses and subscriptions, validating publisher completion, user state consistency, and linking state transitions across login, authData, link, and unlink operations.
Xcode project build configuration
ParseSwift.xcodeproj/project.pbxproj
Adds ParseKeycloak sources and tests to Xcode project: file references, build files, group hierarchy, and PBXSourcesBuildPhase entries across all ParseSwift framework and test targets.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Engage In Review Feedback ⚠️ Warning The instance accessor remains unchanged despite review feedback requesting removal. No discussion or engagement with the feedback occurred. Author must either implement the proposed fix to remove the instance accessor, or engage to discuss why it should remain.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'feat: Add Keycloak authentication helpers' correctly uses the 'feat:' prefix and clearly describes the main change—adding Keycloak authentication support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Check ✅ Passed No security vulnerabilities detected. Credentials are handled securely without persistent storage, logging, or exposure in error messages. Async and Combine patterns follow established practices.
Description check ✅ Passed The PR description follows the required template structure with all main sections completed: checklist items marked, issue reference (Refs #55), clear approach explanation, implementation details, scope limitations, and testing verification.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches 🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai Bot previously approved these changes May 12, 2026

coderabbitai Bot 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Sources/ParseSwift/Authentication/3rd`
Party/ParseKeycloak/ParseKeycloak.swift:
- Around line 171-179: The instance property `var keycloak: ParseKeycloak<Self>`
currently just forwards to the static `static var keycloak: ParseKeycloak<Self>`
(declared as ParseKeycloak<Self>()), causing `someUser.keycloak` to ignore the
receiver and risk linking the wrong account; either remove the instance accessor
entirely or change it to return an instance-bound helper that captures `self`
(so methods like `link(...)` operate on the receiver), updating the
implementation for `var keycloak` (and related usages of
`keycloak`/`ParseKeycloak<Self>`) accordingly to ensure `link(...)` targets the
instance rather than the static/contextual user.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info ⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 17e707f3-c96c-4100-9a65-bf06e07560f5

📥 Commits

Reviewing files that changed from the base of the PR and between bf6e878 and b65018b.

📒 Files selected for processing (5)
  • Sources/ParseSwift/Authentication/3rd Party/ParseKeycloak/ParseKeycloak+async.swift
  • Sources/ParseSwift/Authentication/3rd Party/ParseKeycloak/ParseKeycloak+combine.swift
  • Sources/ParseSwift/Authentication/3rd Party/ParseKeycloak/ParseKeycloak.swift
  • Tests/ParseSwiftTests/ParseKeycloakCombineTests.swift
  • Tests/ParseSwiftTests/ParseKeycloakTests.swift
🚧 Files skipped from review as they are similar to previous changes (4)
  • Sources/ParseSwift/Authentication/3rd Party/ParseKeycloak/ParseKeycloak+async.swift
  • Sources/ParseSwift/Authentication/3rd Party/ParseKeycloak/ParseKeycloak+combine.swift
  • Tests/ParseSwiftTests/ParseKeycloakCombineTests.swift
  • Tests/ParseSwiftTests/ParseKeycloakTests.swift

kaziiza commented May 13, 2026

Copy link
Copy Markdown
Author

@coderabbitai review

The misleading ParseUser.keycloak accessor was removed in the current head, and swift test --enable-code-coverage --filter ParseKeycloak passed: 14 tests, 0 failures.

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown

@kaziiza Thanks for the update! It's great to hear that the misleading ParseUser.keycloak accessor has been removed and all 14 tests are passing with zero failures. I'll kick off a fresh review of the current head now.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

This branch has not been deployed

No deployments
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL