feat: add iam proxy support for github

pull/105/merge
moonrailgun 2 years ago
parent 50f4321719
commit 5b718c4b04

@ -7,9 +7,14 @@ const clientInfo = {
secret: process.env.IAM_GITHUB_SECRET,
};
const authorize_uri = 'https://github.com/login/oauth/authorize';
const access_token_uri = 'https://github.com/login/oauth/access_token';
const userinfo_uri = 'https://api.github.com/user';
const authorize_uri =
process.env.IAM_GITHUB_URI_AUTHORIZE ||
'https://github.com/login/oauth/authorize';
const access_token_uri =
process.env.IAM_GITHUB_URI_ACCESS_TOKEN ||
'https://github.com/login/oauth/access_token';
const userinfo_uri =
process.env.IAM_GITHUB_URI_USERINFO || 'https://api.github.com/user';
const redirect_uri = `${config.apiUrl}/api/plugin:com.msgbyte.iam/github/redirect`;
export const GithubStrategy: StrategyType = {

@ -25,6 +25,12 @@ Configure Tailchat environment variables:
Respectively, `Client ID` and `Client secrets` obtained before
> You also can use env to overwrite uri, for example use proxy:
>
> - IAM_GITHUB_URI_AUTHORIZE=https://github.com/login/oauth/authorize
> - IAM_GITHUB_URI_ACCESS_TOKEN=https://github.com/login/oauth/access_token
> - IAM_GITHUB_URI_USERINFO=https://api.github.com/user
## Security Protection
In order to prevent tokens from being obtained by malicious applications, it is recommended to add front-end domain name verification.

@ -25,6 +25,12 @@ title: iam - 第三方登录
分别为之前获取到的`Client ID` 与 `Client secrets`
> 你也可以通过环境变量重写请求地址,例如使用代理:
>
> - IAM_GITHUB_URI_AUTHORIZE=https://github.com/login/oauth/authorize
> - IAM_GITHUB_URI_ACCESS_TOKEN=https://github.com/login/oauth/access_token
> - IAM_GITHUB_URI_USERINFO=https://api.github.com/user
## 安全强化
为了token的安全不被恶意应用获取建议增加前端域名校验。

Loading…
Cancel
Save