auth

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: BSD-3-Clause Imports: 52 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// MembershipPositiveTTL is the revocation window: a user removed from the
	// namespace keeps registering for this long. Registration is a rare,
	// interactive operation, so a short window costs little.
	MembershipPositiveTTL = 5 * time.Minute
	// MembershipNegativeTTL bounds how often a refused caller re-asks.
	MembershipNegativeTTL = time.Minute
)

Variables

View Source
var ErrNoTenancy = errors.New("no tenancy configured: set tenancy.owner in this node's config " +
	"to the GitHub account that owns the cloud, or to an organization together with tenancy.app " +
	"(a GitHub App with organization Members: read, installed on it)")

ErrNoTenancy is returned when a registration is attempted on a cloud with no owning namespace configured. Refusing beats falling open: an unconfigured cloud would otherwise accept a registration from anyone holding a valid provider token.

Functions

func Package

func Package() config.ProtoCommandIface

Types

type AuthService

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

func New

func New(ctx context.Context, cfg tauConfig.Config) (*AuthService, error)

func (*AuthService) ApiDomainServiceHandler added in v1.1.9

func (srv *AuthService) ApiDomainServiceHandler(ctx context.Context, st streams.Connection, body command.Body) (cr.Response, error)

****** DOMAIN ******* ApiDomainServiceHandler handles domain-related p2p stream requests

func (*AuthService) Close

func (srv *AuthService) Close() error

func (*AuthService) GitHubTokenHTTPAuth

func (srv *AuthService) GitHubTokenHTTPAuth(ctx http.Context) (interface{}, error)

GitHubTokenHTTPAuth validates the caller's provider token and then answers whether that identity may use this cloud's API at all. Every authenticated route runs it, including ones that only read — listing projects, deleting one and issuing a domain token all hang off this single gate, so the identity question cannot be answered per-route without leaving some of them open.

How the second question is answered differs per build: see identity.go and identity_ee.go.

func (*AuthService) GitHubTokenHTTPAuthCleanup

func (srv *AuthService) GitHubTokenHTTPAuthCleanup(ctx http.Context) (interface{}, error)

func (*AuthService) KV

func (s *AuthService) KV() kv.KVDB

func (*AuthService) Node

func (s *AuthService) Node() peer.Node

type GitHubClient added in v1.1.9

type GitHubClient interface {
	Cur() *github.Repository
	Me() *github.User
	GetByID(id string) error
	GetCurrentRepository() (*github.Repository, error)
	CreateRepository(name *string, description *string, private *bool) error
	CreateDeployKey(name *string, key *string) error
	RemoveOtherDeployKeys(name string, keep string) error
	RemoveDeployKey(key string) error
	CreatePushHook(name *string, url *string, devMode bool) (int64, string, error)
	ListMyRepos() (map[string]RepositoryBasicInfo, error)
	EachRepoPage(fn func(ids []string) (more bool)) error
	ShortRepositoryInfo(id string) RepositoryShortInfo
}

GitHubClient defines the interface for GitHub operations

func NewGitHubClient added in v1.1.9

func NewGitHubClient(ctx context.Context, token string) (GitHubClient, error)

type MembershipVerifier added in v1.2.0

type MembershipVerifier interface {
	IsActiveMember(ctx context.Context, namespace, username string) (bool, error)
}

MembershipVerifier answers whether a user belongs to a namespace. A (false, nil) result is a definitive non-member; everything else -- missing permission, rate limit, transport failure -- is an error, so an outage can never read as a refusal.

type ProjectCreateResponse added in v1.1.9

type ProjectCreateResponse struct {
	Project ProjectInfo `json:"project"`
}

type ProjectDeleteInfo added in v1.1.9

type ProjectDeleteInfo struct {
	ID     string `json:"id"`
	Status string `json:"status"`
}

type ProjectDeleteResponse added in v1.1.9

type ProjectDeleteResponse struct {
	Project ProjectDeleteInfo `json:"project"`
}

type ProjectDetails added in v1.1.9

type ProjectDetails struct {
	ID           string            `json:"id"`
	Name         string            `json:"name"`
	Repositories RepositoryDetails `json:"repositories"`
}

type ProjectInfo added in v1.1.9

type ProjectInfo struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type ProjectInfoResponse added in v1.1.9

type ProjectInfoResponse struct {
	Project ProjectDetails `json:"project"`
}

type ProjectResponse added in v1.1.9

type ProjectResponse struct {
	Project ProjectInfo `json:"project"`
}

type RepositoryBasicInfo added in v1.1.9

type RepositoryBasicInfo struct {
	Name string `json:"name"`
	URL  string `json:"url"`
}

RepositoryBasicInfo represents basic repository information for listing

type RepositoryDetails added in v1.1.9

type RepositoryDetails struct {
	Provider      string              `json:"provider"`
	Configuration RepositoryShortInfo `json:"configuration"`
	Code          RepositoryShortInfo `json:"code"`
}

type RepositoryInfo added in v1.1.9

type RepositoryInfo struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type RepositoryListOptions added in v1.1.9

type RepositoryListOptions github.RepositoryListOptions

type RepositoryRegistrationResponse added in v1.1.9

type RepositoryRegistrationResponse struct {
	Key string `json:"key"`
}

type RepositoryShortInfo added in v1.1.9

type RepositoryShortInfo struct {
	Name     string `json:"name"`
	FullName string `json:"fullname"`
	URL      string `json:"url"`
	ID       string `json:"id"`
	Error    string `json:"error,omitempty"`
}

RepositoryShortInfo represents basic repository information

type UserInfo added in v1.1.9

type UserInfo struct {
	Name    string `json:"name"`
	Company string `json:"company"`
	Email   string `json:"email"`
	Login   string `json:"login"`
}

type UserProjectsResponse added in v1.1.9

type UserProjectsResponse struct {
	Projects []ProjectInfo `json:"projects"`
	// Newest says Projects are the most recent first, cut to what was asked for.
	Newest bool `json:"newest,omitempty"`
}

type UserRepositoriesResponse added in v1.1.9

type UserRepositoriesResponse struct {
	Repositories map[string]RepositoryInfo `json:"repositories"`
}

type UserResponse added in v1.1.9

type UserResponse struct {
	User UserInfo `json:"user"`
}

Directories

Path Synopsis
acme

Jump to

Keyboard shortcuts

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