Skip to main content

Shared Casdoor authentication client for Blade ecosystem services.

Project description

blade-auth-client

blade-auth-client 是 Blade 生态的共享 Casdoor 认证客户端包。它抽离了统一的 token 校验、FastAPI 装配和 Socket.IO 握手接口,供各个服务复用。

安装

pip install blade-auth-client[fastapi,socketio]

Casdoor 配置要求

Casdoor 的 application、scope 和 redirect URI 约束见 docs/casdoor-setup.md

快速上手

from fastapi import FastAPI

from blade_auth_client import (
    AuthConfig,
    OidcClient,
    TokenVerifier,
    create_auth_router,
    make_current_user_dep,
)

app = FastAPI()
config = AuthConfig()
oidc_client = OidcClient(config)
verifier = TokenVerifier(config)
current_user = make_current_user_dep(config, verifier=verifier, provisioner=...)

app.include_router(
    create_auth_router(config, verifier=verifier, provisioner=..., oidc_client=oidc_client)
)

版本策略

0.0.x 版本仅用于占位发布和联调验证,不承诺可用性。0.2.0 起采用仅校验 iss + 签名 + exp 的简化策略。

发布

仓库已经预留了 GitHub Actions 发布流水线:

  • PR 校验:.github/workflows/python-sdk-ci.yml
  • PyPI 发布:.github/workflows/python-sdk-publish.yml

首次配置 Trusted Publishing 时,在 PyPI 项目的 Publishing 页面添加 GitHub publisher,填写:

  • Owner: blade-hq
  • Repository name: blade-oauth
  • Workflow name: python-sdk-publish.yml

日常发版流程:

# 1. 修改 sdk/python/pyproject.toml 里的 version

# 2. 推送代码到默认分支后,创建并推送同版本 tag
git tag blade-auth-client-vX.Y.Z
git push origin blade-auth-client-vX.Y.Z

发布 workflow 会校验 tag 版本与 pyproject.toml 一致,然后自动构建并发布到 PyPI。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blade_auth_client-0.2.1.tar.gz (51.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blade_auth_client-0.2.1-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file blade_auth_client-0.2.1.tar.gz.

File metadata

  • Download URL: blade_auth_client-0.2.1.tar.gz
  • Upload date:
  • Size: 51.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for blade_auth_client-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f7ce2d30410d76573a006f8ba8978f93853c07bad75321536d9831ce63abe7a3
MD5 e3acc36166418454906d08cb5fe5879a
BLAKE2b-256 af8f1d837d79bc60f4f7bea6c4330b06a7ef7a570ea88a10ae054274bb406d43

See more details on using hashes here.

Provenance

The following attestation bundles were made for blade_auth_client-0.2.1.tar.gz:

Publisher: python-sdk-publish.yml on blade-hq/blade-oauth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blade_auth_client-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for blade_auth_client-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 07524ad4cd97bef5a60c0d775e8978d679e62f5695bf61f99c144dbd0a2b911b
MD5 8d4ce16ff1101f0d087fae83c117df78
BLAKE2b-256 b10d2cb7e1901e64ee3d2f4a502178613f304ac6681da6d22d05fdab8e14ac78

See more details on using hashes here.

Provenance

The following attestation bundles were made for blade_auth_client-0.2.1-py3-none-any.whl:

Publisher: python-sdk-publish.yml on blade-hq/blade-oauth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page