Skip to content

Commit b39902f

Browse files
authored
[org] Disallow logins with organizational Git Auth (#16874)
1 parent 28e8113 commit b39902f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

components/server/src/auth/auth-provider-service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export class AuthProviderService {
5959
host: oap.host.toLowerCase(),
6060
verified: oap.status === "verified",
6161
builtin: false,
62+
disallowLogin: !!oap.organizationId,
6263
// hiddenOnDashboard: true, // i.e. show only if it's used
6364
loginContextMatcher: `https://${oap.host}/`,
6465
oauth: {

components/server/src/auth/authenticator.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ export class Authenticator {
110110
res.redirect(this.getSorryUrl(`Bad request: missing parameters.`));
111111
return;
112112
}
113+
// Logins with organizational Git Auth is not permitted
114+
if (authProvider.info.organizationId) {
115+
log.info({ sessionId: req.sessionID }, `Login with "${host}" is not permitted.`, {
116+
"authorize-flow": true,
117+
ap: authProvider.info,
118+
});
119+
res.redirect(this.getSorryUrl(`Login with "${host}" is not permitted.`));
120+
return;
121+
}
113122
if (this.config.disableDynamicAuthProviderLogin && !authProvider.params.builtin) {
114123
log.info({ sessionId: req.sessionID }, `Auth Provider is not allowed.`, { ap: authProvider.info });
115124
res.redirect(this.getSorryUrl(`Login with ${authProvider.params.host} is not allowed.`));

0 commit comments

Comments
 (0)