Skip to content

[python] Refactor signer architecture for REST API authentication#7215

Merged
JingsongLi merged 2 commits intoapache:masterfrom
tonymtu:python-dlf-signer
Feb 6, 2026
Merged

[python] Refactor signer architecture for REST API authentication#7215
JingsongLi merged 2 commits intoapache:masterfrom
tonymtu:python-dlf-signer

Conversation

@tonymtu
Copy link
Contributor

@tonymtu tonymtu commented Feb 5, 2026

Purpose

This PR is the pypaimon implementation of #7100, adding pluggable signer architecture for REST API authentication in the Python client.

Key changes:

  • Refactored the authentication module into a cleaner package structure (pypaimon/api/auth/)
  • Introduced DLFRequestSigner abstract base class to abstract signing behavior
  • Implemented two signing algorithms:
    • DLFDefaultSigner: Original DLF signing algorithm (DLF4-HMAC-SHA256) for VPC endpoints
    • DLFOpenApiSigner: OpenAPI signing algorithm (HMAC-SHA1, ROA v2 style) for AlibabaCloud OpenAPI endpoints (dlfnext)
  • Added automatic signer selection based on URI patterns in DLFAuthProviderFactory
  • Added new configuration option: dlf.signing-algorithm

Benefits:

  • Consistent behavior with Java implementation
  • Better extensibility for future signing algorithms

Tests

  • Added DLFSignerTest with comprehensive test coverage for both signers
  • Verified with real AK and STS credentials against actual DLF endpoints
catalog_options = {
    'metastore': 'rest',
    'warehouse': '${catalog-name}',
    'uri': 'https://dlfnext.${region-id}.aliyuncs.com',
    'token.provider': 'dlf',
    "dlf.access-key-id": "${access-key-id}",
    "dlf.access-key-secret": "${access-key-secret}",
    "dlf.security-token": "${security-token}",
    'dlf.oss-endpoint': 'oss-${region-id}.aliyuncs.com'
}
catalog = CatalogFactory.create(catalog_options)

# table = catalog.get_table('${database-name}.${table-name}')
# read_builder = table.new_read_builder()
# ............

API and Format

N/A

Documentation

N/A - done by #7100

@tonymtu tonymtu marked this pull request as ready for review February 6, 2026 06:37
@JingsongLi
Copy link
Contributor

+1

@JingsongLi JingsongLi merged commit e4a5ce1 into apache:master Feb 6, 2026
6 checks passed
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