Pass github enterprise base url, derive urls for authentication

This commit is contained in:
Paul Pacheco
2020-07-30 09:33:12 -05:00
parent c0feeecc29
commit 5cde7069cf
3 changed files with 15 additions and 14 deletions
+2 -8
View File
@@ -48,15 +48,9 @@ auth:
clientSecret:
$secret:
env: AUTH_GITHUB_CLIENT_SECRET
authorizationURL:
enterpriseInstanceURL:
$secret:
env: AUTH_GITHUB_AUTHORIZATION_URL
tokenURL:
$secret:
env: AUTH_GITHUB_TOKEN_URL
userProfileUrl:
$secret:
env: AUTH_GITHUB_USER_PROFILE_URL
env: AUTH_GITHUB_ENTERPRISE_INSTANCE_URL
gitlab:
development:
appOrigin: "http://localhost:3000/"
+1 -3
View File
@@ -37,9 +37,7 @@ for github enterprise:
```bash
export AUTH_GITHUB_CLIENT_ID=x
export AUTH_GITHUB_CLIENT_SECRET=x
export AUTH_GITHUB_AUTHORIZATION_URL=https://ENTERPRISE_INSTANCE_URL/login/oauth/authorize
export AUTH_GITHUB_TOKEN_URL=https://ENTERPRISE_INSTANCE_URL/login/oauth/access_token
export AUTH_GITHUB_USER_PROFILE_URL=https://ENTERPRISE_INSTANCE_URL/api/v3/user
export AUTH_GITHUB_ENTERPRISE_INSTANCE_URL=https://x
```
### Gitlab
@@ -136,9 +136,18 @@ export function createGithubProvider(
const appOrigin = envConfig.getString('appOrigin');
const clientID = envConfig.getString('clientId');
const clientSecret = envConfig.getString('clientSecret');
const authorizationURL = envConfig.getOptionalString('authorizationURL');
const tokenURL = envConfig.getOptionalString('tokenURL');
const userProfileURL = envConfig.getOptionalString('userProfileURL');
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 = {