github

package
v0.0.0-...-ce8de81 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 10 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	CurrentUser(*http.Client) (*github.User, error)
	Organizations(*http.Client) ([]string, error)
	Teams(*http.Client) (OrganizationTeams, error)
}

Client contains the methods that abstract an API

func NewClient

func NewClient() Client

NewClient creates a new instance of client

type OrganizationTeams

type OrganizationTeams map[string][]string

OrganizationTeams is a map of organization names and teams

type OrganizationVerifier

type OrganizationVerifier struct {
	// contains filtered or unexported fields
}

OrganizationVerifier checks if the current user belongs any of the defined organizations

func NewOrganizationVerifier

func NewOrganizationVerifier(organizations []string, gitHubClient Client) *OrganizationVerifier

NewOrganizationVerifier creates a new instance of OrganizationVerifier

func (*OrganizationVerifier) Verify

func (v *OrganizationVerifier) Verify(r *http.Request, httpClient *http.Client) (bool, error)

Verify makes a check and return a boolean if the check was successful or not

type Provider

type Provider struct {
	provider.Verifier
	// contains filtered or unexported fields
}

Provider abstracts the authentication for github

func (*Provider) Build

func (gp *Provider) Build(config config.Credentials) provider.Provider

Build acts like the constructor for a provider

func (*Provider) GetClaims

func (gp *Provider) GetClaims(httpClient *http.Client) (jwt.MapClaims, error)

GetClaims returns a JWT Map Claim

type Team

type Team struct {
	Name         string
	Organization string
}

Team represents a github team within the organization

type TeamVerifier

type TeamVerifier struct {
	// contains filtered or unexported fields
}

TeamVerifier checks if the current user belongs any of the defined teams

func NewTeamVerifier

func NewTeamVerifier(teams []Team, gitHubClient Client) *TeamVerifier

NewTeamVerifier creates a new instance of TeamVerifier

func (*TeamVerifier) Verify

func (v *TeamVerifier) Verify(r *http.Request, httpClient *http.Client) (bool, error)

Verify makes a check and return a boolean if the check was successful or not

Jump to

Keyboard shortcuts

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