api

package
v0.0.0-...-209885f Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RedirectURICookie = "redirecturi"
	OAuthStateCookie  = "oauthstate"
)

Variables

This section is empty.

Functions

func New

func New(
	repo *database.Repo,
	gcsClient *gcs.Client,
	teamCatalog teamkatalogen.Teamkatalogen,
	httpAPI HTTPAPI,
	authMW auth.MiddlewareHandler,
	promReg *prometheus.Registry,
	amplitudeClient amplitude.Amplitude,
	teamTokenCreds string,
	l *logrus.Logger,
) *chi.Mux

Types

type HTTP

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

func NewHTTP

func NewHTTP(oauth2Config OAuth2, callbackURL string, log *logrus.Entry) HTTP

func (HTTP) Callback

func (h HTTP) Callback(w http.ResponseWriter, r *http.Request)

func (HTTP) Login

func (h HTTP) Login(w http.ResponseWriter, r *http.Request)

func (HTTP) Logout

func (h HTTP) Logout(w http.ResponseWriter, r *http.Request)

type HTTPAPI

type HTTPAPI interface {
	Login(w http.ResponseWriter, r *http.Request)
	Callback(w http.ResponseWriter, r *http.Request)
	Logout(w http.ResponseWriter, r *http.Request)
}

type OAuth2

type OAuth2 interface {
	Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)
	AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
	Verify(ctx context.Context, rawIDToken string) (*oidc.IDToken, error)
}

Jump to

Keyboard shortcuts

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