Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/model/project.proto
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ message ProjectSSOConfig {
string client_secret = 2 [(validate.rules).string.min_len = 1];
string base_url = 3;
string upload_url = 4;
string proxy_url = 5;
}

message Google {
Expand Down
14 changes: 14 additions & 0 deletions pkg/oauth/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package github
import (
"context"
"fmt"
"net/http"
"net/url"

"github.com/google/go-github/v29/github"
Expand Down Expand Up @@ -54,9 +55,22 @@ func NewOAuthClient(ctx context.Context,
ClientSecret: sso.ClientSecret,
Endpoint: oauth2github.Endpoint,
}

if sso.ProxyUrl != "" {
proxyURL, err := url.Parse(sso.ProxyUrl)
if err != nil {
return nil, err
}

t := http.DefaultTransport.(*http.Transport).Clone()
t.Proxy = http.ProxyURL(proxyURL)
ctx = context.WithValue(ctx, oauth2.HTTPClient, &http.Client{Transport: t})
}

if enterprise {
return newGHEOAuthClient(ctx, sso, code, c, cfg)
}

token, err := cfg.Exchange(ctx, code)
if err != nil {
return nil, err
Expand Down