api

package
v0.0.0-...-4a47344 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims map[string]interface{}

type Handler

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

func NewHandler

func NewHandler(log *slog.Logger, tracer trace.Tracer, tokenParser TokenParser, tokenChecker TokenChecker, tokenIssuer TokenIssuer) *Handler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type TokenChecker

type TokenChecker interface {
	Check(context.Context, Claims, *TokenRequest) (bool, error)
}

TokenCheck checks if a client is authorized to request a token

type TokenIssuer

type TokenIssuer func(context.Context, *TokenRequest) (string, error)

type TokenParser

type TokenParser interface {
	Parse(ctx context.Context, tok string) (Claims, error)
}

TokenParser validates a token and returns the identity of the Actions Workflow it was issued to.

type TokenRequest

type TokenRequest struct {
	Repositories []string          `json:"repositories"`
	Permissions  map[string]string `json:"permissions"`
}

TokenRequest is a request from a workflow for permissions

func (TokenRequest) Owner

func (r TokenRequest) Owner() string

func (TokenRequest) OwnerPermissions

func (r TokenRequest) OwnerPermissions() bool

func (TokenRequest) Valid

func (r TokenRequest) Valid() error

type TokenResponse

type TokenResponse struct {
	Token     string `json:"token"`
	Revocable bool   `json:"revocable"`
	Error     string `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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