Generic Auth Provider
Gitpod supports a static set of auth provider in-tree (specifically, GitHub, GitLab and Bitbucket). Users (esp. self-hosted) might want to bring their own auth provider.
We have some preliminary generic auth provider support. That solution however has considerable drawbacks. Before we document this, we should give it a good think if this is the solution we want going forward. Especially considering that others will integrate with this, i.e. changing this feature would break downstream consumers.
Putting JavaScript in values.yaml that get injected into the server does not sit right. Adding JavaScript code in the vlaues.yaml is hard to develop, debug, test and extend.
I reckon outsourcing this functionality to some other service (which could easily be deployed alongside Gitpod) sounds like a more preferable choice, because:
- π it makes for a more stable and extensible interface, that's explicitly described in e.g. protobuf/gRPC
- π it would allow for integration with other infrastructure, i.e. customers could use this feature to integrate deeper into their system. E.g. pull some more data based on the access token
- π it sits much closer to a cloud native architectural style where concerns are split across services
- π no code would be "injected" into the server, reducing the risk for potentially breaking or malicious code within server
- π we could provide service stubs in Go/Typescript to make this integration bit easier. Further, we could provide a test harness for those services.
π for a service that can be deployed alongside Gitpod, because (as you kinda said) this enables 3rd parties to develop, debug, test and release these "adapters" independently of Gitpod.
Some thoughts regarding config / interface design:
-
Do companies want to make some auth providers available only for providing secrets, but not logins? E.g. "in my Gitpod self-hosted, users are required to log in via their Google Workspace account, and they can associate their GitLab/GitHub/Bitbucket accounts. But we can't allow the latter accounts for login, because that would prevent us from enforcing that only company-issued accounts are used.". It would be helpful if a Gitpod-Admin could configure an Auth-provider as
allowed_for_login=true|false -
Some auth providers bring secrets. E.g. when I log in my the Google Workspace account, it would be awesome if my workspaces would be logged in with my Google Cloud account. Same for AWS, Azure, Netlify, Vercel, etc.
-
Some Auth providers bring secrets that Gitpod understand natively: (a) git-credentials for the initial git-clone. and (b) docker-logins for the registry from which to pull the workspace's base-image.
-
Some Auth providers bring ENV variables. We have use-cases where the Gitpod-workspaces are expected to be preconfigured to properly connect to external infrastructure.
-
Would SAML-support be just another auth adapter or an alternative to an auth adapter?
-
Do Auth adapter need their own UI? I'm thinking of the "Configure Access" page that we already have. Not sure how quickly we will want the user to add/remove OAuth scopes, secrets, env vars.
- Should the auth adapter be able to carry a static read-only git access token that's shared among all users who did not log in with their own git accounts?
Should the auth adapter be able to carry a static read-only git access token that's shared among all users who did not log in with their own git accounts?
Do we have a concrete use case?
As an API I'd propose:
service OAuthAuthProvider {
rpc GetUser(GetUserRequest) returns (GetUserResponse) {}
}
message GetUserRequest {
string access_token = 1;
string token_type = 2;
int expires_in_seconds = 3;
string refresh_token = 4;
map<string, string> parameters = 5;
}
message GetUserResponse {
User user = 1;
boolean block = 2;
repeated string scopes = 3;
repeated EnvironmentVariable env = 4;
}
message User {
// ID is a unique identifier of the user within the domain of this auth provider.
// This ID must be no longer than 128 characters.
string id = 1;
string name = 2;
string avatar_url = 3;
string primary_email = 4;
}
message EnvironmentVariable {
string name = 1;
string value = 2;
string repository_pattern = 3;
}
Open Questions:
- In
generic-auth-provider.tsthetokenResponseit's justany. In RFC6749 token responses are specified. I've specced theGetUserRequestto carry the token response according to the RFC. @AlexTugarev am I missing a case here? - Current auth provider differentiate between a
nameand anauthName(see here). What's the difference?
Should the auth adapter be able to carry a static read-only git access token that's shared among all users who did not log in with their own git accounts?
Do we have a concrete use case?
Read-Only GitHub access out-of-the-box in Gitpod Self-Hosted when the primary auth provider is not GitHub, but a companies central identity provider or GitLab. I am aware of three larger companies who do/need this. While Read-Only access without a token is possible, having a GitHub token increases the GitHub Rate Limiting from 60 requests per hour (all users of the Gitpod installation share the rate limit counter) to 5.000 per hour per user.
About the proposed API: How would the flow be when the user ...
- is not yet logged in and the user's browser needs to be redirected to the identity provider's web server to log in?
- wants to add an additional scope? Does "token_type" say what the capabilities of the scope should be?
Current auth provider differentiate between a name and an authName (see here). What's the difference?
@csweichel, this mock shows how it looks like for GitHub:
{
id: 12345, // unique identifier in realm of a single auth service
authName: AlexTugarev // often used as "username" when calling APIs
name: Alex Tugarev // for UI
}
For other services this could be slightly different, though compatible, e.g. id = authName if renaming of accounts is not an option.
On the Read-Only GitHub Access
If we can correct this now, let's do it!
It's a way to impractical to attach this information to the provider config. We need to rethink this solution, keeping in mind that this is a valid problem.
Also, the implementation is way to limited ATM. Consider having an enterprise login provider, but starting out with GitLab repositories instead of GitHub.
+1 for dropping support to specify read-only tokens. Instead we should solve the issue separate from identity providers. Just for example, the Gitpod token is created on demand, maybe there are some common rules how to create/return tokens from an internal service which coexist with the auth providers.
/cc @meysholdt, @csweichel
On the User representation.
First of, let's change name to signal a difference to protocol/User, and underscore this is an external provider identity.
email should be an array. And somehow we want to encode the semantics of different email addresses. A primary email is interesting for account management. A "git" email address shall be used for commits.
message User {
// ID is a unique identifier of the user within the domain of this auth provider.
// This ID must be no longer than 128 characters.
string id = 1;
string name = 2;
string email = 3;
string avatar_url = 4;
}
On GetUserRequest
Would parameters represent additional stuff?
In some cases it's handy for self-hosted scenarios to just use the id_token, if the OAuth2 service is actually an OIDC service, though we might not need to enable strong identity verification. id_token often already encodes most parts we'd expect from this service interface.
I've specced the GetUserRequest to carry the token response according to the RFC.
@csweichel, this is addresses by the reference to OIDC, but I just want to make sure this is considered. Adding some params on top of this is quite common, not only in case of OIDC. Services like Azure AD have even two flavors, depending on the tenant type.
On EnvironmentVariable
It'd be interesting to add a boolean: updateIfExists flag to signal if Env Vars should be overridden.
+1 for this feature, out goal is to use Azure AD or Dex for authentication
Yes. I am also interested in using an authentication like Azure AD or Okta.
ArgoCD uses a library called Dex to allow Auth-Integration with all kinds of identity providers. Maybe such an approach could keep the code on our side simpler+smaller:
When a user logs in through Dex, the userβs identity is usually stored in another user-management system: a LDAP directory, a GitHub org, etc. Dex acts as a shim between a client app and the upstream identity provider. The client only needs to understand OpenID Connect to query Dex, while Dex implements an array of protocols for querying other user-management systems.

I have been part of a team at htpps://nodeable.io that developed a product called Secureable: https://www.nodeable.io/secureable
Which is a multi backend authentication, secrets storage, encryption, ACLs and more- built with Hashicorp Vault as the underlying engine which has been extended with a full set of REST apis. You might want to consider something like this for Auth integration and more.
We use it with other applications where a single point of access is needed for access to multiple authentication systems.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.