Documentation
¶
Overview ¶
Package oauth provides a client for interacting with the GitHub API using OAuth 2.0 authorization
Index ¶
- Constants
- Variables
- func NewRestClient(config *minderv1.GitHubProviderConfig, metrics telemetry.HttpClientMetrics, ...) (*github.GitHub, error)
- func ParseV1Config(rawCfg json.RawMessage) (*minderv1.GitHubProviderConfig, error)
- type GitHubOAuthDelegate
- func (o *GitHubOAuthDelegate) GetCredential() provifv1.GitHubCredential
- func (o *GitHubOAuthDelegate) GetLogin(ctx context.Context) (string, error)
- func (o *GitHubOAuthDelegate) GetName(ctx context.Context) (string, error)
- func (o *GitHubOAuthDelegate) GetOwner() string
- func (o *GitHubOAuthDelegate) GetPrimaryEmail(ctx context.Context) (string, error)
- func (o *GitHubOAuthDelegate) GetUserId(ctx context.Context) (int64, error)
- func (o *GitHubOAuthDelegate) IsOrg() bool
- func (o *GitHubOAuthDelegate) ListAllRepositories(ctx context.Context) ([]*minderv1.Repository, error)
Constants ¶
const Github = "github"
Github is the string that represents the GitHubOAuth provider
Variables ¶
var AuthorizationFlows = []db.AuthorizationFlow{ db.AuthorizationFlowUserInput, db.AuthorizationFlowOauth2AuthorizationCodeFlow, }
AuthorizationFlows is the list of authorization flows that the GitHubOAuth provider supports
var Implements = []db.ProviderType{ db.ProviderTypeGithub, db.ProviderTypeGit, db.ProviderTypeRest, db.ProviderTypeRepoLister, }
Implements is the list of provider types that the GitHubOAuth provider implements
Functions ¶
func NewRestClient ¶
func NewRestClient( config *minderv1.GitHubProviderConfig, metrics telemetry.HttpClientMetrics, restClientCache ratecache.RestClientCache, credential provifv1.GitHubCredential, owner string, ) (*github.GitHub, error)
NewRestClient creates a new GitHub REST API client BaseURL defaults to the public GitHub API, if needing to use a customer domain endpoint (as is the case with GitHub Enterprise), set the Endpoint field in the GitHubConfig struct
func ParseV1Config ¶
func ParseV1Config(rawCfg json.RawMessage) (*minderv1.GitHubProviderConfig, error)
ParseV1Config parses the raw config into a GitHubConfig struct
Types ¶
type GitHubOAuthDelegate ¶
type GitHubOAuthDelegate struct {
// contains filtered or unexported fields
}
GitHubOAuthDelegate is the struct that contains the GitHub access token specifc operations
func (*GitHubOAuthDelegate) GetCredential ¶
func (o *GitHubOAuthDelegate) GetCredential() provifv1.GitHubCredential
GetCredential returns the GitHub OAuth credential
func (*GitHubOAuthDelegate) GetLogin ¶
func (o *GitHubOAuthDelegate) GetLogin(ctx context.Context) (string, error)
GetLogin returns the login for the authenticated user
func (*GitHubOAuthDelegate) GetName ¶
func (o *GitHubOAuthDelegate) GetName(ctx context.Context) (string, error)
GetName returns the username for the authenticated user
func (*GitHubOAuthDelegate) GetOwner ¶ added in v0.0.38
func (o *GitHubOAuthDelegate) GetOwner() string
GetOwner returns the owner filter
func (*GitHubOAuthDelegate) GetPrimaryEmail ¶
func (o *GitHubOAuthDelegate) GetPrimaryEmail(ctx context.Context) (string, error)
GetPrimaryEmail returns the primary email for the authenticated user.
func (*GitHubOAuthDelegate) GetUserId ¶
func (o *GitHubOAuthDelegate) GetUserId(ctx context.Context) (int64, error)
GetUserId returns the user id for the authenticated user
func (*GitHubOAuthDelegate) IsOrg ¶ added in v0.0.41
func (o *GitHubOAuthDelegate) IsOrg() bool
IsOrg returns true if the owner is an organization
func (*GitHubOAuthDelegate) ListAllRepositories ¶
func (o *GitHubOAuthDelegate) ListAllRepositories(ctx context.Context) ([]*minderv1.Repository, error)
ListAllRepositories returns a list of all repositories for the authenticated user Two APIs are available, contigent on whether the token is for a user or an organization