Skip to content
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

增加指定路由前缀鉴权 #74

Merged
merged 2 commits into from
Apr 19, 2024
Merged

Conversation

ixugo
Copy link
Contributor

@ixugo ixugo commented Apr 16, 2024

支持 #69

  1. 增加秘钥鉴权,双方协商字符串相等,即鉴权通过。参数通过 query 传递,如 "token=srcret"。
  2. 增加 ip 白名单鉴权,请求客户端必须是 ip 白名单内才允许访问。
  3. 配置文件增加 authentication 和 accept_ips 配置,默认空串空数组,表示不鉴权。
  4. 两者可以分别单独开启,也可以同时开启。
  5. doc/config.md 增加文档说明。
  6. 增加测试函数 TestAuthentication

conf/config.go Outdated
HttpsCertFile string `json:"https_cert_file"` // https cert 文件
HttpsKeyFile string `json:"https_key_file"` // https key 文件
Authentication string `json:"authentication"` // 认证信息,零值时不生效
AcceptIDs []string `json:"accept_ids"` // 允许访问的远程 IP,零值时不生效
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以改为白名单配置,配置中可以有IP,也可以有UA

@ZSC714725 ZSC714725 merged commit 5c654ff into q191201771:master Apr 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants