passportd
认证、授权、统一登录 — 基于 Flask 的 SSO 单点登录服务。
核心功能
- 本地账号系统:支持用户名、手机号、邮箱注册与登录
- WebAuthn Passkey:支持指纹/面容/PIN 码免密登录,兼容 Windows Hello、Apple Touch ID、YubiKey、Vaultwarden 等
- OAuth2 第三方登录:内置 GitHub、Gitee、Weibo、QQ、Google等 OAuth2 登录插件
- OpenID Connect Provider:支持 OIDC Server 模式,可作为独立 SSO 服务
- 插件扩展:基于 Flask-PluginKit 的插件架构,方便扩展更多登录方式
- 多数据库支持:SQLite(开发) / MySQL / PostgreSQL(生产)
- JWT 认证:支持 HMAC-SHA256 和 RS256 双算法 JWT 签名
- RESTful API:提供完整的注册、登录、用户信息、OIDC 客户端管理接口
快速开始
pip 安装
# 安装
pip install passportd
# 确保 Redis 已启动
# 开发模式启动
passportd run
# 生产模式启动
passportd start
访问 http://localhost:10030/ 即可看到登录页面。
Docker 运行
# 拉取镜像
docker pull staugur/passportd:latest
# 启动容器(需要先启动 Redis)
docker run -d \
--name passportd \
-p 10030:10030 \
-e PASSPORT_REDIS_URI="redis://:pwd@redis:6379/0" \
-e PASSPORT_DB_URI="sqlite:///app/data/passportd.db" \
-e PASSPORT_ENV="production" \
-v passportd-data:/app/data \
staugur/passportd:latest
也可以通过 docker-compose.yml 一键启动(包含 Redis):
version: "3.8"
services:
redis:
image: redis:7-alpine
restart: unless-stopped
volumes:
- redis-data:/data
passportd:
image: staugur/passportd:latest
restart: unless-stopped
ports:
- "10030:10030"
environment:
- PASSPORT_ENV=production
- PASSPORT_REDIS_URI=redis://redis:6379/0
- PASSPORT_DB_URI=sqlite:///app/data/passportd.db
volumes:
- passportd-data:/app/data
depends_on:
- redis
volumes:
redis-data:
passportd-data:
文档
完整文档请访问 passportd.readthedocs.io
本地构建文档:
pip install -r requirements/docs.txt
cd docs && make html
许可证
Apache License 2.0
备注
沿用 1.x 设计思路,使用 OIDC 标准协议重构实现,除核心代码外大部分使用 AI 生成。
如从 1.x 迁移,可使用 tools 脚本。
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 passportd-2.6.0.tar.gz.
File metadata
- Download URL: passportd-2.6.0.tar.gz
- Upload date:
- Size: 2.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2440de18284e5b824fcc956cb7940f79ba1eccf1001459e8152391a860de2bed
|
|
| MD5 |
51a6103368b27100922afac30406d446
|
|
| BLAKE2b-256 |
046103746490d4ba6c2d450ab6c9ec9f068bd9cd354662cfb15108e318b3af90
|
Provenance
The following attestation bundles were made for passportd-2.6.0.tar.gz:
Publisher:
publish.yml on staugur/passportd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
passportd-2.6.0.tar.gz -
Subject digest:
2440de18284e5b824fcc956cb7940f79ba1eccf1001459e8152391a860de2bed - Sigstore transparency entry: 2419693525
- Sigstore integration time:
-
Permalink:
staugur/passportd@3727d1d7e9da0f67f332b0725033e0bd6297d1e6 -
Branch / Tag:
refs/tags/v2.6.0 - Owner: https://github.com/staugur
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3727d1d7e9da0f67f332b0725033e0bd6297d1e6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file passportd-2.6.0-py3-none-any.whl.
File metadata
- Download URL: passportd-2.6.0-py3-none-any.whl
- Upload date:
- Size: 2.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acd3261190ad7a5e0efb5c8f77e6998a1536b040f3490cbc011f2c64f6ebbe8d
|
|
| MD5 |
f0c03659e05f92348ebf2df82ed218a6
|
|
| BLAKE2b-256 |
e5db8d06e6a8699dcdb36fd49668401783bcc3a530b0a2b689cecc938e750ef8
|
Provenance
The following attestation bundles were made for passportd-2.6.0-py3-none-any.whl:
Publisher:
publish.yml on staugur/passportd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
passportd-2.6.0-py3-none-any.whl -
Subject digest:
acd3261190ad7a5e0efb5c8f77e6998a1536b040f3490cbc011f2c64f6ebbe8d - Sigstore transparency entry: 2419693590
- Sigstore integration time:
-
Permalink:
staugur/passportd@3727d1d7e9da0f67f332b0725033e0bd6297d1e6 -
Branch / Tag:
refs/tags/v2.6.0 - Owner: https://github.com/staugur
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3727d1d7e9da0f67f332b0725033e0bd6297d1e6 -
Trigger Event:
release
-
Statement type: