Skip to content

Upgrade dependencies and ci #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release changelog

on:
push:
tags:
- v*

jobs:
changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: master

- uses: rhysd/changelog-from-release/action@v3
with:
file: docs/changelog.md
pull_request: true
github_token: ${{ secrets.GH_TOKEN }}
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- master
tags:
- '**'
pull_request:

jobs:
Expand All @@ -17,10 +15,10 @@ jobs:
python-version: [ '3.10', '3.11', '3.12' ]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PDM
uses: pdm-project/setup-pdm@v3
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: docs
on:
push:
branches:
- master
permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: sudo apt-get install pngquant
- run: pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material.git
- run: mkdocs gh-deploy --force
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.5.0
rev: v0.9.9
hooks:
- id: ruff
args:
- '--fix'
- '--unsafe-fixes'
- id: ruff-format

- repo: https://github.com/pdm-project/pdm
rev: 2.16.1
rev: 2.22.3
hooks:
- id: pdm-lock-check
25 changes: 3 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
# fastapi_oauth20
# FastAPI OAuth 2.0

![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/fastapi-practices/fastapi_oauth20/ci.yml?logo=github)
[![GitHub](https://img.shields.io/github/license/wu-clan/httpfpt)](https://github.com/wu-clan/httpfpt/blob/master/LICENSE)
![Static Badge](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue)
![Static Badge](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)
![GitHub release (with filter)](https://img.shields.io/github/v/release/fastapi-practices/fastapi_oauth20)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

在 FastAPI 中异步授权 OAuth2 客户端
在 FastAPI 中异步授权 OAuth 2.0 客户端

我们的目标是集成多个 CN 第三方客户端,敬请期待(🐦)...

#### TODO:

如果我们能够很容易获取测试客户端,或许这会很快

- [ ] tests
- [x] [Google](https://developers.google.cn/identity/protocols/oauth2/javascript-implicit-flow?hl=en)
- [ ] 微信
- [ ] QQ
- [ ] 抖音
- [x] [飞书](https://open.feishu.cn/document/common-capabilities/sso/web-application-sso/web-app-overview)
- [ ] 钉钉
- [ ] 微博
- [ ] 百度
- [x] [Gitee](https://gitee.com/api/v5/oauth_doc#/)
- [x] [Github](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app)
- [X] [开源中国](https://www.oschina.net/openapi)
- [ ] 阿里云
- [ ] [Linux Do](https://connect.linux.do/)
1 change: 1 addition & 0 deletions docs/advanced.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO...
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO...
1 change: 1 addition & 0 deletions docs/explanation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO...
27 changes: 27 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<div align="center">
<h1>🔐</h1>
</div>

---

**Documentation
**: <a href="https://fastapi-practices.github.io/fastapi-oauth20" target="_blank">https://fastapi-practices.github.io/fastapi-oauth20</a>

**Source Code
**: <a href="https://github.com/fastapi-practices/fastapi-oauth20" target="_blank">https://github.com/fastapi-practices/fastapi-oauth20</a>

---

在 FastAPI 中异步授权 OAuth 2.0 客户端

我们的目标是集成多个 CN 第三方客户端,敬请期待(🐦)...

你可以在 [集成状态](integration.md) 获取当前集成情况

## 互动

[TG / Discord](https://wu-clan.github.io/homepage/)

## 赞助

如果此项目能够帮助到你,你可以赞助作者一些咖啡豆表示鼓励:[Sponsor](https://wu-clan.github.io/sponsor/)
26 changes: 26 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## 依赖

在安装 fastapi-oauth20 之前,请确保您满足以下先决条件:

- **Python** 版本 >= 3.10
- **FastAPI** 版本 >= 0.100.0

## 安装

=== ":simple-piped: pip"

```sh
pip install fastapi-oauth20
```

=== ":simple-pdm: pdm"

```sh
pdm add fastapi-oauth20
```

=== ":simple-uv: uv"

```sh
uv add fastapi-oauth20
```
21 changes: 21 additions & 0 deletions docs/integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
如果你有更多需求,请在仓库内创建 Issues,我们将尽力完成所有目标

- [x] 表示已集成
- [ ] 表示待集成

---

- [x] [Linux Do](https://connect.linux.do/)
- [x] [GitHub](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app)
- [x] [Gitee](https://gitee.com/api/v5/oauth_doc#/)
- [x] [开源中国](https://www.oschina.net/openapi)
- [ ] [微信小程序](https://mp.weixin.qq.com/)
- [ ] [微信开放平台](https://open.weixin.qq.com/)
- [ ] [企业微信二维码登录](https://work.weixin.qq.com/wework_admin/loginpage_wx?from=myhome_openApi)
- [x] [飞书](https://open.feishu.cn/document/common-capabilities/sso/web-application-sso/web-app-overview)
- [ ] [钉钉](https://open.dingtalk.com/document/orgapp/tutorial-obtaining-user-personal-information)
- [ ] [阿里云](https://help.aliyun.com/zh/ram/user-guide/access-alibaba-cloud-apis-from-a-web-application?spm=a2c4g.11186623.0.i2)
- [ ] [QQ](https://connect.qq.com/)
- [ ] [微博](https://open.weibo.com/apps)
- [ ] [抖音](https://open.douyin.com/)
- [x] [Google](https://developers.google.cn/identity/protocols/oauth2/javascript-implicit-flow?hl=en)
1 change: 1 addition & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO...
2 changes: 0 additions & 2 deletions example/__init__.py

This file was deleted.

38 changes: 0 additions & 38 deletions example/main.py

This file was deleted.

28 changes: 9 additions & 19 deletions fastapi_oauth20/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
"""在 FastAPI 中异步授权 OAuth2 客户端"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from .clients.feishu import FeiShuOAuth20 as FeiShuOAuth20
from .clients.gitee import GiteeOAuth20 as GiteeOAuth20
from .clients.github import GitHubOAuth20 as GitHubOAuth20
from .clients.google import GoogleOAuth20 as GoogleOAuth20
from .clients.linuxdo import LinuxDoOAuth20 as LinuxDoOAuth20
from .clients.oschina import OSChinaOAuth20 as OSChinaOAuth20
from .integrations.fastapi import FastAPIOAuth20 as FastAPIOAuth20

__version__ = '0.0.1a2'

__all__ = [
'OSChinaOAuth20',
'GoogleOAuth20',
'FeiShuOAuth20',
'GiteeOAuth20',
'GitHubOAuth20',
'FastAPIOAuth20',
'LinuxDoOAuth20',
]

from .clients.feishu import FeiShuOAuth20
from .clients.gitee import GiteeOAuth20
from .clients.github import GitHubOAuth20
from .clients.google import GoogleOAuth20
from .clients.linuxdo import LinuxDoOAuth20
from .clients.oschina import OSChinaOAuth20
from .integrations.fastapi import OAuth20 as FastAPIOAuth20
2 changes: 1 addition & 1 deletion fastapi_oauth20/integrations/fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from fastapi_oauth20.oauth20 import OAuth20Base


class OAuth20:
class FastAPIOAuth20:
def __init__(
self,
client: OAuth20Base,
Expand Down
74 changes: 74 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json
site_name: FastAPI OAuth 2.0
site_description: 在 FastAPI 中异步授权 OAuth 2.0 客户端
site_url: https://wu-clan.github.io/fastapi-oauth20
site_author: Wu Clan
repo_name: fastapi-oauth20
repo_url: https://github.com/wu-clan/fastapi-oauth20
nav:
- Home:
- 主页: index.md
- 集成状态: integration.md
- Install: install.md
- Explanation: explanation.md
- Usage: usage.md
- Advanced: advanced.md
- Changelog: changelog.md
theme:
name: material
font:
code: Roboto Mono
palette:
- media: '(prefers-color-scheme)'
toggle:
icon: material/brightness-auto
name: Switch to light mode
- media: '(prefers-color-scheme: light)'
scheme: default
primary: pink
toggle:
icon: material/brightness-7
name: Switch to dark mode
- media: '(prefers-color-scheme: dark)'
scheme: slate
primary: teal
toggle:
icon: material/brightness-4
name: Switch to system preference
features:
- content.code.annotate
- content.code.select
- navigation.instant
- navigation.instant.progress
- navigation.path
- navigation.tracking
- navigation.tabs
- navigation.tabs.sticky
- navigation.top
- navigation.footer
- search.suggest
- toc.follow
plugins:
- search
markdown_extensions:
- toc:
permalink: true
- tables
- admonition
- attr_list
- def_list
- md_in_html
- pymdownx.snippets
- pymdownx.superfences
- pymdownx.inlinehilite
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.tabbed:
alternate_style: true
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- pymdownx.tasklist:
custom_checkbox: true
Loading