Skip to content

Commit

Permalink
[oidc] Fix the HEAD method call that checks reachability (#20474)
Browse files Browse the repository at this point in the history
* [oidc] Fix the HEAD method call that checks reachability

* [server] Fix setup flow

---------

Co-authored-by: Gero Posmyk-Leinemann <[email protected]>
  • Loading branch information
nandajavarma and geropl authored Dec 20, 2024
1 parent 7a27ea0 commit 4bd9924
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/public-api-server/pkg/apiv1/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ func assertIssuerIsReachable(ctx context.Context, issuer *url.URL) error {
},
}

req, err := http.NewRequestWithContext(ctx, http.MethodHead, issuer.String(), nil)
req, err := http.NewRequestWithContext(ctx, http.MethodHead, issuer.String()+"/.well-known/openid-configuration", nil)
if err != nil {
return err
}
Expand Down
7 changes: 5 additions & 2 deletions components/server/src/user/user-authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { injectable, inject } from "inversify";
import { User, Identity, Token, IdentityLookup } from "@gitpod/gitpod-protocol";
import { EmailDomainFilterDB, MaybeUser, UserDB } from "@gitpod/gitpod-db/lib";
import { BUILTIN_INSTLLATION_ADMIN_USER_ID, EmailDomainFilterDB, MaybeUser, UserDB } from "@gitpod/gitpod-db/lib";
import { HostContextProvider } from "../auth/host-context-provider";
import { log } from "@gitpod/gitpod-protocol/lib/util/logging";
import { Config } from "../config";
Expand Down Expand Up @@ -214,7 +214,10 @@ export class UserAuthentication {
const isMultiOrgEnabled = await getExperimentsClientForBackend().getValueAsync("enable_multi_org", false, {
gitpodHost: this.config.hostUrl.url.host,
});
return isAllowedToCreateOrganization(user, isDedicated, isMultiOrgEnabled);
return (
isAllowedToCreateOrganization(user, isDedicated, isMultiOrgEnabled) ||
(isDedicated && user.id === BUILTIN_INSTLLATION_ADMIN_USER_ID)
);
}

async isBlocked(params: CheckIsBlockedParams): Promise<boolean> {
Expand Down

0 comments on commit 4bd9924

Please sign in to comment.