Skip to content

feat: Implement BasicAuthManager to support basic authentication#564

Merged
wgtmac merged 2 commits intoapache:mainfrom
lishuxu:feature/auth3
Feb 26, 2026
Merged

feat: Implement BasicAuthManager to support basic authentication#564
wgtmac merged 2 commits intoapache:mainfrom
lishuxu:feature/auth3

Conversation

@lishuxu
Copy link
Contributor

@lishuxu lishuxu commented Feb 13, 2026

feat: Implement BasicAuthManager to support basic authentication

@lishuxu lishuxu changed the title feat: Implement BasicAuthManager to suppoert basic authentication feat: Implement BasicAuthManager to support basic authentication Feb 13, 2026
Copy link
Member

@wgtmac wgtmac left a comment

Choose a reason for hiding this comment

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

Review Report: PR #564

📄 File: src/iceberg/catalog/rest/auth/auth_managers.cc

Java Counterpart: core/src/main/java/org/apache/iceberg/rest/auth/AuthManagers.java and BasicAuthManager.java

  • Parity Check: ✅ The C++ logic faithfully implements the Java behavior. It correctly enforces the requirement for basic-username and basic-password properties and properly concatenates them to form the Basic base64-encoded authorization header. The case-insensitive auth-type handling is correctly preserved.
  • Style Check: ✅ Uses modern C++ paradigms, including std::string_view, standard containers, and [[maybe_unused]] for ignored parameters. The formatting aligns well with the project's style.
  • Logic Check: ✅ Clean logic mapping to Result<T> error handling. No memory leaks or unsafe behaviors detected. Returns an InvalidArgument on missing credentials gracefully rather than throwing raw exceptions.
  • Design & Conciseness:BasicAuthManager is neatly encapsulated within the .cc implementation file, avoiding unnecessary exposure in headers. Reuses existing TransformUtil::Base64Encode rather than rolling a custom base64 encoder.

📄 File: src/iceberg/test/auth_manager_test.cc

Java Counterpart: Not found (Assumed standard test parity)

  • Parity Check: ✅ Comprehensive test coverage corresponding to Java's testing expectations, covering happy paths, case insensitivity, missing properties, and special character edge cases.
  • Style Check: ✅ Excellent use of the GTest framework and existing custom matchers (IsOk, IsError, HasErrorMessage).
  • Logic Check: ✅ Test logic and base64 assertions are mathematically sound and verifiable.
  • Design & Conciseness: ✅ Clean and focused test cases.

Summary & Recommendation

  • Approve. The PR is exceptionally clean, mirrors the Java implementation faithfully, respects C++ conventions, and brings good unit test coverage. No blocking issues found.

Copy link
Member

@wgtmac wgtmac left a comment

Choose a reason for hiding this comment

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

Mostly LGTM. I've left some inline comments. Previous comment was posted by my custom review agent which accidentally approved it.

};

/// \brief Authentication manager that performs basic authentication.
class BasicAuthManager : public AuthManager {
Copy link
Member

Choose a reason for hiding this comment

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

It looks a little bit weird that BasicAuthManager and other AuthManager implementations are declared in auth_managers.h/cc not auth_manager.h/cc. It would be better to move them to the latter and make auth_managers.h/cc simply a factory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point!
Moved NoopAuthManager and BasicAuthManager implementations to auth_manager.cc, and added auth_manager_internal.h to expose their factory functions (MakeNoopAuthManager/MakeBasicAuthManager) only to auth_managers.cc.

@wgtmac wgtmac merged commit f955a55 into apache:main Feb 26, 2026
12 checks passed
@lishuxu lishuxu deleted the feature/auth3 branch February 26, 2026 09:18
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.

2 participants