Merge pull request #1783 from AmericanAirlines/ghe

Add configuration for github enterprise
This commit is contained in:
Patrik Oldsberg
2020-07-30 17:19:38 +02:00
committed by GitHub
3 changed files with 26 additions and 0 deletions
+3
View File
@@ -48,6 +48,9 @@ auth:
clientSecret:
$secret:
env: AUTH_GITHUB_CLIENT_SECRET
enterpriseInstanceUrl:
$secret:
env: AUTH_GITHUB_ENTERPRISE_INSTANCE_URL
gitlab:
development:
appOrigin: "http://localhost:3000/"
+8
View File
@@ -32,6 +32,14 @@ export AUTH_GITHUB_CLIENT_ID=x
export AUTH_GITHUB_CLIENT_SECRET=x
```
for github enterprise:
```bash
export AUTH_GITHUB_CLIENT_ID=x
export AUTH_GITHUB_CLIENT_SECRET=x
export AUTH_GITHUB_ENTERPRISE_INSTANCE_URL=https://x
```
### Gitlab
```bash
@@ -136,11 +136,26 @@ export function createGithubProvider(
const appOrigin = envConfig.getString('appOrigin');
const clientID = envConfig.getString('clientId');
const clientSecret = envConfig.getString('clientSecret');
const enterpriseInstanceUrl = envConfig.getOptionalString(
'enterpriseInstanceUrl',
);
const authorizationURL = enterpriseInstanceUrl
? `${enterpriseInstanceUrl}/login/oauth/authorize`
: undefined;
const tokenURL = enterpriseInstanceUrl
? `${enterpriseInstanceUrl}/login/oauth/access_token`
: undefined;
const userProfileURL = enterpriseInstanceUrl
? `${enterpriseInstanceUrl}/api/v3/user`
: undefined;
const callbackURL = `${baseUrl}/${providerId}/handler/frame?env=${env}`;
const opts = {
clientID,
clientSecret,
authorizationURL,
tokenURL,
userProfileURL,
callbackURL,
};