github

package
v0.0.0-...-2d572df Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

App represents the configuration of the Github OAuth application used to authenticate users.

func NewApp

func NewApp(id, secret string, client utils.HTTPClient) *App

NewApp configures a new GithubApp struct

func (*App) OAuthClient

func (ga *App) OAuthClient(code, state string) (*OAuthClient, error)

OAuthClient swaps a code token for a OAuthClient to make subsequent authenticated requests to the API

type ClientState

type ClientState struct {
	Redirect string
}

ClientState represents the state passed in by a client auth request, including a random State string, and the Redirect URI callback

type Config

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

Config contains all the values required to support the auth package

func New

func New(jwtConfig *jwtprovider.Config, db *hnysqlx.DB, client *redis.Client, githubApp *App) *Config

New build a new Config struct

func TestConfig

func TestConfig(jwtConfig *jwtprovider.Config, store auth.UserStore, stateStore cache.StateStore, githubApp *App, now time.Time) *Config

TestConfig builds a config used for testing

func (*Config) SetupHandlers

func (c *Config) SetupHandlers(router *mux.Router)

SetupHandlers mounts the auth HTTP handlers on the given router

type OAuthClient

type OAuthClient struct {
	Token      string
	HTTPClient utils.HTTPClient
	Base       string
}

OAuthClient is a http client that automatically adds the required Authorization headers when called

func (*OAuthClient) Do

func (c *OAuthClient) Do(r *http.Request) (*http.Response, error)

Do executes a request using OAuthClient

func (*OAuthClient) User

func (c *OAuthClient) User() (*auth.CreateUser, error)

User fetches the currently authenticated user from and returns the struct to be passed to create the user.

Jump to

Keyboard shortcuts

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