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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file blade_auth_client-0.3.0.tar.gz.
File metadata
- Download URL: blade_auth_client-0.3.0.tar.gz
- Upload date:
- Size: 74.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
225b546754dc57e855c0ff4bf1beb8685acdbc295d3df29e6b269de6656b6057
|
|
| MD5 |
abf3520b18d77a870a20fef5623a3230
|
|
| BLAKE2b-256 |
0f554aa00a8aee614601952ae093652d29abf50e91d086f780a7ecac8d5e64f0
|
Provenance
The following attestation bundles were made for blade_auth_client-0.3.0.tar.gz:
Publisher:
python-sdk-publish.yml on blade-hq/blade-oauth
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
blade_auth_client-0.3.0.tar.gz -
Subject digest:
225b546754dc57e855c0ff4bf1beb8685acdbc295d3df29e6b269de6656b6057 - Sigstore transparency entry: 1363227039
- Sigstore integration time:
-
Permalink:
blade-hq/blade-oauth@63c0b5453abd9091ca7ecc2830f5f6bfe584d669 -
Branch / Tag:
refs/tags/blade-auth-client-v0.3.0 - Owner: https://github.com/blade-hq
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-sdk-publish.yml@63c0b5453abd9091ca7ecc2830f5f6bfe584d669 -
Trigger Event:
push
-
Statement type:
File details
Details for the file blade_auth_client-0.3.0-py3-none-any.whl.
File metadata
- Download URL: blade_auth_client-0.3.0-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bfd66bacfed0d001c65df0ac40e357b09be53eb577bcb0a1a0dd097f610eb51
|
|
| MD5 |
12c68dd087226201383a43fa7cef0a65
|
|
| BLAKE2b-256 |
5f08c853b6548f87ec50a6d4bed094d77cced71cd2fd450d148ea8811203000a
|
Provenance
The following attestation bundles were made for blade_auth_client-0.3.0-py3-none-any.whl:
Publisher:
python-sdk-publish.yml on blade-hq/blade-oauth
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
blade_auth_client-0.3.0-py3-none-any.whl -
Subject digest:
4bfd66bacfed0d001c65df0ac40e357b09be53eb577bcb0a1a0dd097f610eb51 - Sigstore transparency entry: 1363227120
- Sigstore integration time:
-
Permalink:
blade-hq/blade-oauth@63c0b5453abd9091ca7ecc2830f5f6bfe584d669 -
Branch / Tag:
refs/tags/blade-auth-client-v0.3.0 - Owner: https://github.com/blade-hq
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-sdk-publish.yml@63c0b5453abd9091ca7ecc2830f5f6bfe584d669 -
Trigger Event:
push
-
Statement type: