components

package
v0.0.0-...-e2d6795 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetComponent

func GetComponent[T any](ctx context.Context, dest *T) error

func GetComponentFromServer

func GetComponentFromServer[T any](s *Server, dest *T) error

func MustGetComponent

func MustGetComponent[T any](ctx context.Context) T

func WithServer

func WithServer(ctx context.Context, s *Server) context.Context

Types

type AuthenticationInfo

type AuthenticationInfo struct {
	Provider         AuthenticationProvider
	ProviderUserID   string
	ProviderUserName string

	PopulateUserData func(ctx context.Context, token *oauth2.Token, info *AuthenticationInfo) (*userapi.UserSpec, error)
}

type AuthenticationProvider

type AuthenticationProvider interface {
	ProviderID() string
	// Redeem is called from the oauth2 callback request; it normally exchanges a code for a token for the logged-in user
	Redeem(ctx context.Context, redirectURI string, code string) error
	GetLoginURL(ctx context.Context, redirectURI, state string) string
}

AuthenticationProvider is implemented by authentication services.

type Component

type Component interface {
	RegisterHandlers(server *Server, mux *http.ServeMux) error

	// AddToScope adds values to the template scope
	AddToScope(ctx context.Context, scope *scopes.Scope)
}

type FileResponse

type FileResponse struct {
	StatusCode int
	StatusText string

	Body io.ReadCloser
	// contains filtered or unexported fields
}

func (*FileResponse) Close

func (r *FileResponse) Close() error

func (*FileResponse) Headers

func (r *FileResponse) Headers() http.Header

func (*FileResponse) WriteTo

func (r *FileResponse) WriteTo(ctx context.Context, w http.ResponseWriter)

type JSONResponse

type JSONResponse struct {
	Object any
}

func (JSONResponse) WriteTo

func (r JSONResponse) WriteTo(ctx context.Context, w http.ResponseWriter)

type Request

type Request struct {
	Session Session

	*http.Request

	PathParameters map[string]string
}

func GetRequest

func GetRequest(ctx context.Context) *Request

func (*Request) BrowserUsingHTTPS

func (r *Request) BrowserUsingHTTPS() bool

BrowserUsingHTTPS returns true if the _browser_ is using https to talk to us We may (or may not) be using encryption behind a load balancer

func (*Request) IsLocalhost

func (r *Request) IsLocalhost() bool

func (*Request) PathParameter

func (r *Request) PathParameter(key string) string

type RequestFilter

type RequestFilter interface {
	ProcessRequest(ctx context.Context, req *Request, next RequestFilterChain) (Response, error)
}

type RequestFilterChain

type RequestFilterChain func(ctx context.Context, req *Request) (Response, error)

type RequestFilterFunction

type RequestFilterFunction func(ctx context.Context, req *Request, next RequestFilterChain) (Response, error)

type Response

type Response interface {
	WriteTo(ctx context.Context, w http.ResponseWriter)
}

func ErrorResponse

func ErrorResponse(code int) Response

func RedirectResponse

func RedirectResponse(redirectURL string) Response

type Server

type Server struct {
	Components []Component
}

func GetServer

func GetServer(ctx context.Context) *Server

func (*Server) NewScope

func (s *Server) NewScope(ctx context.Context) *scopes.Scope

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(fn func(ctx context.Context, req *Request) (Response, error)) func(w http.ResponseWriter, r *http.Request)

type Session

type Session interface {
	Clear(_ proto.Message)
	Set(value proto.Message)
	Get(dest proto.Message) bool
}

Session implements session storage.

type SimpleResponse

type SimpleResponse struct {
	StatusCode int
	StatusText string

	Body []byte
	// contains filtered or unexported fields
}

func (*SimpleResponse) Headers

func (r *SimpleResponse) Headers() http.Header

func (SimpleResponse) WriteTo

func (r SimpleResponse) WriteTo(ctx context.Context, w http.ResponseWriter)

type UserMapper

type UserMapper interface {
	MapToUser(ctx context.Context, token *oauth2.Token, info *AuthenticationInfo) (*userapi.User, error)
}

Directories

Path Synopsis
pb
pb
kubejson/internal/set
Package set provides simple set data structures for uint64s.
Package set provides simple set data structures for uint64s.
pb
api
pb

Jump to

Keyboard shortcuts

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