让你的Discourse支持作为 Oauth2/OIDC 的Provider

AI 生成的摘要

cuo_wu introduced a custom plugin allowing Discourse to function as an OAuth2/OIDC Provider, enabling users to create their own applications. This solution builds upon the Parkour-Vienna/distrust project to fill a gap in official Discourse features. The setup requires a MySQL/MariaDB database, configuration of distrust.yml, RSA key generation, and linking the provider in the Discourse admin panel. Once running on port 3000, users can access an interface to manage apps, view client secrets, and authorize logins. satonotdead shared an English translation of the post, noting their lack of technical expertise but interest in the tool. DaBai_LuoBo and whitewaterdeu praised the open-source contribution. However, la_panda reported a critical error when attempting to run the script with MySQL version 9.0.1, specifically a SQL syntax failure during database migration regarding unique index creation (Error 1064), indicating a potential compatibility issue with newer MySQL versions.

:information_source: Summary Oauth2/OIDC Provider. User can create them own apps.
:hammer_and_wrench: Download Link https://vvpp.cc/s/GPmCV

Features

我们知道,Discourse官方并没有使用Discourse作为 Oauth2/OIDC 的 Provider 的解决方案。

为了能更好的实现服务,也为了让大家能把更多的创意带入到NL中,NL在 Parkour-Vienna/distrust: Use discourse as an OIDC (OAuth 2.0) provider 的基础上,实现了一版用户可以自己申请应用的 Oauth2/OIDC Provider.

Configuration

用户相关数据我使用了Mysql存储,所以具体的食用方法是,先安装Mysql/MariaDB,执行Sql脚本建库;然后配置 distrust.yml,设置数据库相关内容,然后执行distrust genkey,生成对应的rsa key;再到Discourse后台创建一个discourse connect provider,把相关信息写进来。

然后执行

chmod _+x distrust
./distrust

访问你的 IP:3000/apps 就可以看到应用界面啦。

Demo

When user use Oauth2/OIDC login.

5 个赞

这似乎是我一直在寻找的东西,但我不是技术人员,所以我将耐心等待有人研究它 :slight_smile:

我正在分享原文翻译成英文 使用 DeepL。

1 个赞

一个绝佳的开端;感谢您的开源贡献。这确实是一个辉煌的开始。 :clap: :clap: :clap:

太棒了!

./distrust

mysql 版本:9.0.1

错误:

FTL 初始化数据库失败 error=“迁移数据库失败: 无法创建唯一索引: Error 1064 (42000): SQL 语法错误;检查您的 MySQL 服务器版本的手册以获取正确的语法,该语法接近 ‘IF NOT EXISTS idx_user_authorizations_user_client \\n\\t\\tON user_authorizations(user’ 第 1 行”