Skip to content

willin/sso

Folders and files

NameName
Last commit message
Last commit date

Latest commit

9a778a1 · Dec 29, 2023

History

58 Commits
Dec 28, 2023
Dec 28, 2023
Dec 26, 2023
Dec 28, 2023
Dec 29, 2023
Dec 28, 2023
Dec 25, 2023
Dec 25, 2023
Dec 26, 2023
Dec 27, 2023
Dec 28, 2023
Dec 25, 2023
Dec 25, 2023
Dec 25, 2023
Dec 25, 2023
Dec 29, 2023
Dec 28, 2023
Dec 25, 2023
Dec 28, 2023
Dec 27, 2023
Dec 25, 2023
Dec 28, 2023

Repository files navigation

An Open-Source SSO System

built with Hono.js & SvelteKit

开源免费的 IDaaS (SSO 单点登录)服务

Free IDaas And Single Sign-On Service

GitHub Repo stars Fork

中文网站 | English Website

相关文档 Documentation

端点 Endpoints

  • /auth/authorize GET
  • /auth/token POST
  • /auth/userinfo GET
  • /auth/revoke POST
  • /$lang/login (以下需要登录 below need login)
  • /$lang/dashboard
  • /api/apps GET/POST
  • /api/apps/:id GET/PUT
  • /api/apps/:id/secret POST/DELETE
  • /api/users GET
  • /api/users/:id GET/PUT/POST
  • /api/users/:id/forbidden PUT/POST
  • /api/users/:id/:provider DELETE

开源包 Packages

Packages

Package Meta Changelog
@hono-dev/auth-github npm npm npm Changelog
@hono-dev/auth-alipay npm npm npm Changelog
@hono-dev/auth-afdian npm npm npm Changelog
@hono-dev/powered-by npm npm npm Changelog

开发/部署 Development & Deployment

部署

Important

如果需要定制化的开发,比如删除/新增登录方式,则需要具备专业的开发知识,或者联系我进行付费定制。

  1. 需要有 Cloudflare 账号、可配置域名和 Github 账号三项前置准备
  2. 在 Cloudflare 中创建好 D1 数据库和 KV 缓存桶。
  3. Fork 本项目,在 Settings 中做后续环境变量配置
  4. 设置环境变量,参考 本地开发。注意:
    • 创建 Github OAuth 应用
    • 创建 支付宝基础应用
    • 爱发电应用需要私信 @afdian
    • 如果使用 Github 的 Secrets,则不能用 GITHUB_ 前缀,所以我改成了 GH_ 前缀,但代码中没有更改,只在 Workflow 中映射
    • 注意:只有 Github 可以不填 CALLBACK_URL(其他登录方式均需要指定域名回调)

本地开发

  1. 配置开发环境,推荐使用 bun 进行开发
  2. 创建 apps/website/.dev.varsAFDIAN_CLIENT_IDAFDIAN_CLIENT_SECRET 等环境变量进行配置。
  3. 安装依赖 bun install && bun run build
AFDIAN_CLIENT_ID=
AFDIAN_CLIENT_SECRET=
AFDIAN_CALLBACK_URL=
GITHUB_ID=
GITHUB_SECRET=
GITHUB__CALLBACK_URL=optional
ALIPAY_APP_ID=
ALIPAY_CALLBACK_URL=
ALIPAY_PRIVATE_KEY=
SESSION_KEY=optional
SESSION_SECRET=
  1. apps/website目录下初始化数据库: npx wrangler d1 migrations apply sso --local
  2. 启动 bun run build && bun run dev
  3. 手动修改 apps/website/.wrangler/state/v3/d1/miniflare-D1DatabaseObject 下的数据库,通过 SQLite 软件,将你的第一个用户类型 type 改为 admin

Deployment

Important

If you need customized development, such as deleting/adding login methods, you need to have professional development knowledge, or contact me for paid customization.

  1. You need to have a Cloudflare account, a configurable domain, and a Github account as prerequisites.
  2. Create a D1 database and KV bucket in Cloudflare.
  3. Fork this project and do subsequent environment variable configuration in Settings.
  4. Set environment variables, refer to Local Development. Note:
    • Create Github OAuth App
    • Create Alipay Basic App
    • For Afdian application, you need to send a private message to @afdian
    • If you use Github's Secrets, you can't use the GITHUB_ prefix, so I changed it to the GH_ prefix, but the code has not been changed, only mapped in the Workflow
    • Note: Only Github can leave CALLBACK_URL blank (other login methods need to specify the domain callback)

Local Development

  1. Configure the development environment, it is recommended to use bun for development.
  2. Create apps/website/.dev.vars and configure environment variables such as AFDIAN_CLIENT_ID, AFDIAN_CLIENT_SECRET.
  3. Install dependencies bun install && bun bun build
AFDIAN_CLIENT_ID=
AFDIAN_CLIENT_SECRET=
AFDIAN_CALLBACK_URL=
GITHUB_ID=
GITHUB_SECRET=
GITHUB__CALLBACK_URL=optional
ALIPAY_APP_ID=
ALIPAY_CALLBACK_URL=
ALIPAY_PRIVATE_KEY=
SESSION_KEY=optional
SESSION_SECRET=
  1. Cd to apps/website and init database with: npx wrangler d1 migrations apply sso --local
  2. Start with bun run build && bun run dev
  3. Manually modify the database under apps/website/.wrangler/state/v3/d1/miniflare-D1DatabaseObject using SQLite software, change your first user type type to admin

赞助 Sponsor

维护者 Owner: Willin Wang

如果您对本项目感兴趣,可以通过以下方式支持我:

Donation ways:

许可证 License

Apache-2.0