accessverifier

package
v14.36.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package accessverifier provides functionality for verifying access to GitLab resources

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a client for accessing resources

func NewClient

func NewClient(config *config.Config) (*Client, error)

NewClient creates a new instance of Client

func (*Client) Verify

func (c *Client) Verify(ctx context.Context, args *commandargs.Shell, action commandargs.CommandType, repo string) (*Response, error)

Verify verifies access to a GitLab resource

type CustomPayload

type CustomPayload struct {
	Action string            `json:"action"`
	Data   CustomPayloadData `json:"data"`
}

CustomPayload represents a custom payload

type CustomPayloadData

type CustomPayloadData struct {
	APIEndpoints                            []string          `json:"api_endpoints"`
	Username                                string            `json:"gl_username"`
	PrimaryRepo                             string            `json:"primary_repo"`
	UserID                                  string            `json:"gl_id,omitempty"`
	RequestHeaders                          map[string]string `json:"request_headers"`
	GeoProxyDirectToPrimary                 bool              `json:"geo_proxy_direct_to_primary"`
	GeoProxyFetchDirectToPrimary            bool              `json:"geo_proxy_fetch_direct_to_primary"`
	GeoProxyFetchDirectToPrimaryWithOptions bool              `json:"geo_proxy_fetch_direct_to_primary_with_options"`
	GeoProxyFetchSSHDirectToPrimary         bool              `json:"geo_proxy_fetch_ssh_direct_to_primary"`
	GeoProxyPushSSHDirectToPrimary          bool              `json:"geo_proxy_push_ssh_direct_to_primary"`
}

CustomPayloadData represents custom payload data

type Gitaly

type Gitaly struct {
	Repo     pb.Repository     `json:"repository"`
	Address  string            `json:"address"`
	Token    string            `json:"token"`
	Features map[string]string `json:"features"`
}

Gitaly represents Gitaly server information

type Request

type Request struct {
	Action        commandargs.CommandType `json:"action"`
	Repo          string                  `json:"project"`
	Changes       string                  `json:"changes"`
	Protocol      string                  `json:"protocol"`
	KeyID         string                  `json:"key_id,omitempty"`
	Username      string                  `json:"username,omitempty"`
	Krb5Principal string                  `json:"krb5principal,omitempty"`
	CheckIP       string                  `json:"check_ip,omitempty"`
	// NamespacePath is the full path of the namespace in which the authenticated
	// user is allowed to perform operation.
	NamespacePath string `json:"namespace_path,omitempty"`
}

Request represents a request for accessing resources

type Response

type Response struct {
	Success          bool          `json:"status"`
	Message          string        `json:"message"`
	Repo             string        `json:"gl_repository"`
	UserID           string        `json:"gl_id"`
	KeyType          string        `json:"gl_key_type"`
	KeyID            int           `json:"gl_key_id"`
	ProjectID        int           `json:"gl_project_id"`
	RootNamespaceID  int           `json:"gl_root_namespace_id"`
	Username         string        `json:"gl_username"`
	GitConfigOptions []string      `json:"git_config_options"`
	Gitaly           Gitaly        `json:"gitaly"`
	GitProtocol      string        `json:"git_protocol"`
	Payload          CustomPayload `json:"payload"`
	ConsoleMessages  []string      `json:"gl_console_messages"`
	Who              string
	StatusCode       int
	// NeedAudit indicates whether git event should be audited to rails.
	NeedAudit bool `json:"need_audit"`
}

Response represents a response from GitLab

func (*Response) IsCustomAction

func (r *Response) IsCustomAction() bool

IsCustomAction checks if the response indicates a custom action

Jump to

Keyboard shortcuts

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