allow github enterprise logins with custom endpoints
ricsc committed
Jan 20, 2026 at 16:33 UTC
f7e31713d7c7f56b45df4565c2b513ce6452c620
3 files changed
+30
-1
meshcentral-config-schema.json
+20
@@ -3314,6 +3314,26 @@
3314
"type": "string",
3315
"description": "GitHub client secret."
3316
},
3317
+ "authorizationurl": {
3318
+ "type": "string",
3319
+ "format": "uri",
3320
+ "description": "The URL used to obtain an authorization grant from the user."
3321
+ },
3322
+ "tokenurl": {
3323
+ "type": "string",
3324
+ "format": "uri",
3325
+ "description": "The URL used to exchange a code for an access token."
3326
+ },
3327
+ "userprofileurl": {
3328
+ "type": "string",
3329
+ "format": "uri",
3330
+ "description": "The URL used to obtain user profile information."
3331
+ },
3332
+ "useremailurl": {
3333
+ "type": "string",
3334
+ "format": "uri",
3335
+ "description": "The URL used to obtain user email information."
3336
+ },
3337
"logouturl": {
3338
"type": "string",
3339
"format": "uri",
sample-config-advanced.json
+5
-1
@@ -525,7 +525,11 @@
525
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
526
"_newAccountsRights": [ "nonewgroups", "notools" ],
527
"clientid": "xxxxxxxxxxxxxxxxxxxxxxx",
528
- "clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
528
+ "clientsecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
529
+ "_authorizationurl": "https://hostname/login/oauth/authorize",
530
+ "_tokenurl": "https://hostname/login/oauth/access_token",
531
+ "_userprofileurl": "https://hostname/user",
532
+ "_useremailurl": "https://hostname/user/emails"
533
},
534
"azure": {
535
"_callbackurl": "https://server/auth-azure-callback",
webserver.js
+5
@@ -7800,6 +7800,11 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
7800
const GitHubStrategy = require('passport-github2');
7801
let options = { clientID: domain.authstrategies.github.clientid, clientSecret: domain.authstrategies.github.clientsecret };
7802
if (typeof domain.authstrategies.github.callbackurl == 'string') { options.callbackURL = domain.authstrategies.github.callbackurl; } else { options.callbackURL = url + 'auth-github-callback'; }
7803
+ //override passport-github2 defaults that point to github.com with urls specified by user
7804
+ if (typeof domain.authstrategies.github.authorizationurl == 'string') { options.authorizationURL = domain.authstrategies.github.authorizationurl; }
7805
+ if (typeof domain.authstrategies.github.tokenurl == 'string') { options.tokenURL = domain.authstrategies.github.tokenurl; }
7806
+ if (typeof domain.authstrategies.github.userprofileurl == 'string') { options.userProfileURL = domain.authstrategies.github.userprofileurl; }
7807
+ if (typeof domain.authstrategies.github.useremailurl == 'string') { options.userEmailURL = domain.authstrategies.github.useremailurl; }
7808
parent.authLog('setupDomainAuthStrategy', 'Adding Github SSO with options: ' + JSON.stringify(options));
7809
passport.use('github-' + domain.id, new GitHubStrategy(options,
7810
function (token, tokenSecret, profile, cb) {