Documentation
¶
Index ¶
- Constants
- Variables
- func Package() config.ProtoCommandIface
- type AuthService
- func (srv *AuthService) ApiDomainServiceHandler(ctx context.Context, st streams.Connection, body command.Body) (cr.Response, error)
- func (srv *AuthService) Close() error
- func (srv *AuthService) GitHubTokenHTTPAuth(ctx http.Context) (interface{}, error)
- func (srv *AuthService) GitHubTokenHTTPAuthCleanup(ctx http.Context) (interface{}, error)
- func (s *AuthService) KV() kv.KVDB
- func (s *AuthService) Node() peer.Node
- type GitHubClient
- type MembershipVerifier
- type ProjectCreateResponse
- type ProjectDeleteInfo
- type ProjectDeleteResponse
- type ProjectDetails
- type ProjectInfo
- type ProjectInfoResponse
- type ProjectResponse
- type RepositoryBasicInfo
- type RepositoryDetails
- type RepositoryInfo
- type RepositoryListOptions
- type RepositoryRegistrationResponse
- type RepositoryShortInfo
- type UserInfo
- type UserProjectsResponse
- type UserRepositoriesResponse
- type UserResponse
Constants ¶
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 ¶
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 (*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 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 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
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 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 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"`
}