handler

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	web.Handler
	// contains filtered or unexported fields
}

Provider is the handler that handles the authentication flow against a provider that a user either wants to login with, or connect to.

func New

func New(h web.Handler, redis *redis.Client, crypto *crypto.AESGCM, providers *provider.Registry) Provider

func (Provider) Auth

func (h Provider) Auth(w http.ResponseWriter, r *http.Request)

Auth will authenticate the user via the provider in the request. If a user is logging in for the first time via a provider, then we create an account for them and link it to the provider. Otherwise we simply connect the provider to the current user's account.

func (Provider) Revoke

func (h Provider) Revoke(w http.ResponseWriter, r *http.Request)

Revoke will disconnect the user from the provider sent in the request. This will also disable all of the repository hooks for the given provider if any were set.

type Repo

type Repo struct {
	web.Handler
	// contains filtered or unexported fields
}

Repo is the handler that handles the adding and removing of webhooks to a repo on the provider.

func NewRepo

func NewRepo(h web.Handler, redis *redis.Client, block *crypto.AESGCM, providers *provider.Registry) Repo

func (Repo) Destroy

func (h Repo) Destroy(w http.ResponseWriter, r *http.Request)

Destroy will remove the webhook from the repo in the request.

func (Repo) Index

func (h Repo) Index(w http.ResponseWriter, r *http.Request)

Index serves the HTML response detailing the repositories retrieved from the provider in the request. It will first attempt to get the repositores from the cache, if the cache is empty then the API is hit, and the cache stores the response for 1 hour.

func (Repo) Store

func (h Repo) Store(w http.ResponseWriter, r *http.Request)

Store will add a webhook to the provider's repo in the given request.

func (Repo) Update

func (h Repo) Update(w http.ResponseWriter, r *http.Request)

Update will reload all of the provider repos in the cache.

Jump to

Keyboard shortcuts

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