Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v13] Add default GitHub API URLs to SSO connector #31480

Merged
merged 1 commit into from Sep 8, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions api/types/github.go
Expand Up @@ -28,8 +28,8 @@ import (
)

const (
githubURL = "https://github.com"
githubAPIURL = "https://api.github.com"
GithubURL = "https://github.com"
GithubAPIURL = "https://api.github.com"
)

// GithubConnector defines an interface for a Github OAuth2 connector
Expand Down Expand Up @@ -269,12 +269,12 @@ func (c *GithubConnectorV3) SetDisplay(display string) {

// GetEndpointURL returns the endpoint URL
func (c *GithubConnectorV3) GetEndpointURL() string {
return githubURL
return GithubURL
}

// GetEndpointURL returns the API endpoint URL
func (c *GithubConnectorV3) GetAPIEndpointURL() string {
return githubAPIURL
return GithubAPIURL
}

// MapClaims returns a list of logins based on the provided claims,
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/access-controls/sso/github-sso.mdx
Expand Up @@ -92,11 +92,11 @@ kind: github
metadata:
name: github
spec:
api_endpoint_url: ""
api_endpoint_url: https://api.github.com
client_id: <client-id>
client_secret: <client-secret>
display: GitHub
endpoint_url: ""
endpoint_url: https://github.com
redirect_url: https://<proxy-address>/v1/webapi/github/callback
teams_to_logins: null
teams_to_roles:
Expand Down
11 changes: 9 additions & 2 deletions tool/tctl/sso/configure/github.go
Expand Up @@ -49,8 +49,15 @@ func addGithubCommand(cmd *SSOConfigureCommand) *AuthKindCommand {
sub.Flag("display", "Sets the connector display name.").StringVar(&spec.Display)
sub.Flag("id", "GitHub app client ID.").PlaceHolder("ID").Required().StringVar(&spec.ClientID)
sub.Flag("secret", "GitHub app client secret.").Required().PlaceHolder("SECRET").StringVar(&spec.ClientSecret)
sub.Flag("endpoint-url", "Endpoint URL for GitHub instance.").StringVar(&spec.EndpointURL)
sub.Flag("api-endpoint-url", "API endpoint URL for GitHub instance.").StringVar(&spec.APIEndpointURL)
sub.Flag("endpoint-url", "Endpoint URL for GitHub instance.").
PlaceHolder("URL").
Default(types.GithubURL).
StringVar(&spec.EndpointURL)

sub.Flag("api-endpoint-url", "API endpoint URL for GitHub instance.").
PlaceHolder("URL").
Default(types.GithubAPIURL).
StringVar(&spec.APIEndpointURL)

// auto
sub.Flag("redirect-url", "Authorization callback URL.").PlaceHolder("URL").StringVar(&spec.RedirectURL)
Expand Down