oauth

package
v0.0.41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package oauth provides a client for interacting with the GitHub API using OAuth 2.0 authorization

Index

Constants

View Source
const Github = "github"

Github is the string that represents the GitHubOAuth provider

Variables

AuthorizationFlows is the list of authorization flows that the GitHubOAuth provider supports

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL