Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

handler

v1.1.1
djinn-ci.com/provider/handler

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

11 matches

Top ↑

Types

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.

New

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

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.

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.

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.

NewRepo

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

Repo.Destroy

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

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

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.

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.

Repo.Update

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

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

Dependency graph