{"id":28546759,"url":"https://github.com/k8scat/lua-resty-feishu-auth","last_synced_at":"2026-02-28T10:03:03.526Z","repository":{"id":41103859,"uuid":"394840746","full_name":"k8scat/lua-resty-feishu-auth","owner":"k8scat","description":"适用于 OpenResty / ngx_lua 的基于飞书组织架构的登录认证","archived":false,"fork":false,"pushed_at":"2025-06-10T17:46:03.000Z","size":79,"stargazers_count":42,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-17T22:47:46.260Z","etag":null,"topics":["auth","feishu","jwt","login","lua","lua-resty-http","lua-resty-jwt","nginx","openresty"],"latest_commit_sha":null,"homepage":"https://github.com/k8scat/lua-resty-feishu-auth","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/k8scat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-11T02:44:27.000Z","updated_at":"2025-06-10T17:46:06.000Z","dependencies_parsed_at":"2022-07-24T20:32:06.063Z","dependency_job_id":null,"html_url":"https://github.com/k8scat/lua-resty-feishu-auth","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/k8scat/lua-resty-feishu-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k8scat%2Flua-resty-feishu-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k8scat%2Flua-resty-feishu-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k8scat%2Flua-resty-feishu-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k8scat%2Flua-resty-feishu-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k8scat","download_url":"https://codeload.github.com/k8scat/lua-resty-feishu-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k8scat%2Flua-resty-feishu-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29929594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T09:58:13.507Z","status":"ssl_error","status_checked_at":"2026-02-28T09:57:57.047Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auth","feishu","jwt","login","lua","lua-resty-http","lua-resty-jwt","nginx","openresty"],"created_at":"2025-06-10T00:07:51.301Z","updated_at":"2026-02-28T10:03:03.485Z","avatar_url":"https://github.com/k8scat.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lua-resty-feishu-auth\n\n适用于 OpenResty / ngx_lua 的基于[飞书](https://www.feishu.cn/)组织架构的登录认证\n\n## 使用\n\n### 安装 OpenResty\n\n参考: https://k8scat.com/posts/linux/install-openresty-on-ubuntu-from-source-code/\n\n### 下载\n\n```bash\ncd /usr/local/openresty/site/lualib\ngit clone https://github.com/k8scat/lua-resty-http.git\ngit clone https://github.com/k8scat/lua-resty-jwt.git\ngit clone https://github.com/k8scat/lua-resty-feishu-auth.git\n```\n\n### 配置\n\n#### http 配置\n\n```conf\nhttp {\n    lua_package_path \"/usr/local/openresty/site/lualib/lua-resty-feishu-auth/lib/?.lua;/usr/local/openresty/site/lualib/lua-resty-jwt/lib/?.lua;/usr/local/openresty/site/lualib/lua-resty-jwt/vendor/?.lua;/usr/local/openresty/site/lualib/lua-resty-http/lib/?.lua;;\";\n}\n```\n\n#### server 配置\n\n```\nserver {\n    listen 443 ssl;\n    server_name feishu-auth.example.com;\n    resolver 8.8.8.8;\n    \n    ssl_certificate /usr/local/openresty/cert/feishu-auth.example.com.crt;\n    ssl_certificate_key /usr/local/openresty/cert/feishu-auth.example.com.key;\n    ssl_session_cache shared:SSL:1m;\n    ssl_session_timeout 5m;\n    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\n    ssl_ciphers AESGCM:HIGH:!aNULL:!MD5;\n    ssl_prefer_server_ciphers  on;\n    lua_ssl_verify_depth 2;\n    lua_ssl_trusted_certificate /etc/pki/tls/certs/ca-bundle.crt;\n    if ($time_iso8601 ~ \"^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2})\") {\n        set $year $1;\n        set $month $2;\n        set $day $3;\n    }\n    access_log logs/feishu-auth.example.com_access_$year$month$day.log main;\n    error_log logs/feishu-auth.example.com_error_$year$month$day.log;\n\n    access_by_lua_block {\n        local feishu_auth = require \"resty.feishu_auth\"\n        feishu_auth.app_id = \"\"\n        feishu_auth.app_secret = \"\"\n        feishu_auth.callback_uri = \"/feishu_auth_callback\"\n        feishu_auth.logout_uri = \"/feishu_auth_logout\"\n        feishu_auth.app_domain = \"feishu-auth.example.com\"\n\n        feishu_auth.jwt_secret = \"thisisjwtsecret\"\n\n        feishu_auth.ip_blacklist = {\"47.1.2.3\"}\n        feishu_auth.uri_whitelist = {\"/\"}\n        feishu_auth.department_whitelist = {\"0\"}\n\n        feishu_auth:auth()\n    }\n}\n\nserver {\n    listen 80;\n    server_name feishu-auth.example.com;\n\n    location / {\n        rewrite ^/(.*) https://$server_name/$1 redirect;\n    }\n}\n```\n\n### 配置说明\n\n- `app_id` 用于设置飞书企业自建应用的 `App ID`\n- `app_secret` 用于设置飞书企业自建应用的 `App Secret`\n- `callback_uri` 用于设置飞书网页登录后的回调地址（需在飞书企业自建应用的安全设置中设置重定向 URL）\n- `logout_uri` 用于设置登出地址\n- `app_domain` 用于设置访问域名（需和业务服务的访问域名一致）\n- `jwt_secret` 用于设置 JWT secret\n- `ip_blacklist` 用于设置 IP 黑名单\n- `uri_whitelist` 用于设置地址白名单，例如首页不需要登录认证\n- `department_whitelist` 用于设置部门白名单（字符串），默认不限制部门\n\n### 应用权限说明\n\n- 获取部门基础信息\n- 获取部门组织架构信息\n- 以应用身份读取通讯录\n- 获取用户组织架构信息\n- 获取用户基本信息\n\n## 依赖模块\n\n- [lua-resty-http](https://github.com/ledgetech/lua-resty-http)\n- [lua-resty-jwt](https://github.com/SkyLothar/lua-resty-jwt)\n\n## 相关项目\n\n- [lua-resty-weauth](https://github.com/k8scat/lua-resty-weauth) 适用于 OpenResty / ngx_lua 的基于[企业微信](https://work.weixin.qq.com/)组织架构的登录认证\n\n## 作者\n\nk8scat@gmail.com\n\n## 开源协议\n\n[MIT](./LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk8scat%2Flua-resty-feishu-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk8scat%2Flua-resty-feishu-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk8scat%2Flua-resty-feishu-auth/lists"}