coderd

package
v0.8.14 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: AGPL-3.0 Imports: 85 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DisabledImplementations = FeatureInterfaces{
	Auditor: audit.NewNop(),
}

DisabledImplementations includes all the implementations of turned-off features. There are no turned-on implementations in AGPL code.

Functions

func AuthorizeFilter added in v0.6.0

func AuthorizeFilter[O rbac.Objecter](h *HTTPAuthorizer, r *http.Request, action rbac.Action, objects []O) ([]O, error)

func ConvertProvisionerJobStatus added in v0.8.3

func ConvertProvisionerJobStatus(provisionerJob database.ProvisionerJob) codersdk.ProvisionerJobStatus

Types

type API added in v0.6.1

type API struct {
	*Options

	Handler chi.Router
	// contains filtered or unexported fields
}

func New

func New(options *Options) *API

New constructs a Coder API handler.

func (*API) Authorize added in v0.6.1

func (api *API) Authorize(r *http.Request, action rbac.Action, object rbac.Objecter) bool

Authorize will return false if the user is not authorized to do the action. This function will log appropriately, but the caller must return an error to the api client. Eg:

if !api.Authorize(...) {
	httpapi.Forbidden(rw)
	return
}

func (*API) Close added in v0.6.1

func (api *API) Close() error

Close waits for all WebSocket connections to drain before returning.

func (*API) ListenProvisionerDaemon added in v0.6.1

func (api *API) ListenProvisionerDaemon(ctx context.Context) (client proto.DRPCProvisionerDaemonClient, err error)

ListenProvisionerDaemon is an in-memory connection to a provisionerd. Useful when starting coderd and provisionerd in the same process.

type AutoImportTemplate added in v0.8.7

type AutoImportTemplate string

Auto-importable templates. These can be auto-imported after the first user has been created.

const (
	AutoImportTemplateKubernetes AutoImportTemplate = "kubernetes"
)

type FeatureInterfaces added in v0.8.12

type FeatureInterfaces struct {
	Auditor audit.Auditor
}

FeatureInterfaces contains a field for each interface controlled by an enterprise feature.

type FeaturesService added in v0.8.10

type FeaturesService interface {
	EntitlementsAPI(w http.ResponseWriter, r *http.Request)

	// Get returns the implementations for feature interfaces. Parameter `s` must be a pointer to a
	// struct type containing feature interfaces as fields.  The FeatureService sets all fields to
	// the correct implementations depending on whether the features are turned on.
	Get(s any) error
}

FeaturesService is the interface for interacting with enterprise features.

type GithubOAuth2Config added in v0.4.4

type GithubOAuth2Config struct {
	httpmw.OAuth2Config
	AuthenticatedUser           func(ctx context.Context, client *http.Client) (*github.User, error)
	ListEmails                  func(ctx context.Context, client *http.Client) ([]*github.UserEmail, error)
	ListOrganizationMemberships func(ctx context.Context, client *http.Client) ([]*github.Membership, error)
	TeamMembership              func(ctx context.Context, client *http.Client, org, team, username string) (*github.Membership, error)

	AllowSignups       bool
	AllowOrganizations []string
	AllowTeams         []GithubOAuth2Team
}

GithubOAuth2Provider exposes required functions for the Github authentication flow.

type GithubOAuth2Team added in v0.7.8

type GithubOAuth2Team struct {
	Organization string
	Slug         string
}

GithubOAuth2Team represents a team scoped to an organization.

type HTTPAuthorizer added in v0.8.7

type HTTPAuthorizer struct {
	Authorizer rbac.Authorizer
	Logger     slog.Logger
}

func (*HTTPAuthorizer) Authorize added in v0.8.7

func (h *HTTPAuthorizer) Authorize(r *http.Request, action rbac.Action, object rbac.Objecter) bool

Authorize will return false if the user is not authorized to do the action. This function will log appropriately, but the caller must return an error to the api client. Eg:

if !h.Authorize(...) {
	httpapi.Forbidden(rw)
	return
}

type OIDCConfig added in v0.8.2

type OIDCConfig struct {
	httpmw.OAuth2Config

	Verifier *oidc.IDTokenVerifier
	// EmailDomain is the domain to enforce when a user authenticates.
	EmailDomain  string
	AllowSignups bool
}

type Options

type Options struct {
	AccessURL *url.URL
	Logger    slog.Logger
	Database  database.Store
	Pubsub    database.Pubsub

	// CacheDir is used for caching files served by the API.
	CacheDir string

	AgentConnectionUpdateFrequency time.Duration
	AgentInactiveDisconnectTimeout time.Duration
	// APIRateLimit is the minutely throughput rate limit per user or ip.
	// Setting a rate limit <0 will disable the rate limiter across the entire
	// app. Specific routes may have their own limiters.
	APIRateLimit         int
	AWSCertificates      awsidentity.Certificates
	Authorizer           rbac.Authorizer
	AzureCertificates    x509.VerifyOptions
	GoogleTokenValidator *idtoken.Validator
	GithubOAuth2Config   *GithubOAuth2Config
	OIDCConfig           *OIDCConfig
	PrometheusRegistry   *prometheus.Registry
	ICEServers           []webrtc.ICEServer
	SecureAuthCookie     bool
	SSHKeygenAlgorithm   gitsshkey.Algorithm
	Telemetry            telemetry.Reporter
	TURNServer           *turnconn.Server
	TracerProvider       *sdktrace.TracerProvider
	AutoImportTemplates  []AutoImportTemplate
	LicenseHandler       http.Handler
	FeaturesService      FeaturesService

	TailscaleEnable    bool
	TailnetCoordinator *tailnet.Coordinator
	DERPMap            *tailcfg.DERPMap

	MetricsCacheRefreshInterval time.Duration
	AgentStatsRefreshInterval   time.Duration
}

Options are requires parameters for Coder to start.

Directories

Path Synopsis
autobuild
schedule
package schedule provides utilities for parsing and deserializing cron-style expressions.
package schedule provides utilities for parsing and deserializing cron-style expressions.
Package database connects to external services for stateful storage.
Package database connects to external services for stateful storage.
util
ptr
Package ptr contains some utility methods related to pointers.
Package ptr contains some utility methods related to pointers.
tz
Package tz includes utilities for cross-platform timezone/location detection.
Package tz includes utilities for cross-platform timezone/location detection.
Package wsconncache caches workspace agent connections by UUID.
Package wsconncache caches workspace agent connections by UUID.

Jump to

Keyboard shortcuts

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