auth

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PublicPrefixes = flag.String("public", "", "prefixes of public readable folders")
	UserInput      = flag.String("users", "", "Yaml formatted list of users")
	Realm          = flag.String("realm", "Registry", "Realm for the registry")
	Issuer         = flag.String("issuer", "Registry", "Issuer for the registry")
	Service        = flag.String("service", "Registry", "Service name for the registry")
)
View Source
var (
	Debug = flag.Bool("debug", false, "Show debug logging")
)
View Source
var (
	ServerPort = flag.Int("port", 8080, "Port for the server to listen on")
)

Functions

func CreateToken

func CreateToken(publicKey libtrust.PublicKey, privateKey libtrust.PrivateKey, issuer string, request *Request) (string, error)

func InitFormatter added in v1.0.10

func InitFormatter()

func IsScopePublic added in v1.0.12

func IsScopePublic(publicPrefixes []string, scopeItem *token.ResourceActions) bool

func ParsePrefixes

func ParsePrefixes(prefixInput string) []string

func ParseUsers

func ParseUsers(userInput string) (map[string]string, error)

Types

type Formatter

type Formatter struct {
	Debug bool
}

func (Formatter) Format

func (f Formatter) Format(entry *log.Entry) ([]byte, error)

type Request

type Request struct {
	User           string
	Password       string
	Service        string
	ApprovedScope  []*token.ResourceActions
	RequestedScope []*token.ResourceActions
	// contains filtered or unexported fields
}

type Response

type Response struct {
	Success bool
	Token   string `json:"token"`
}

type Server

type Server struct {
	Users          map[string]string
	PublicPrefixes []string
	Issuer         string
	CertDir        string
	CertPath       string
	KeyPath        string
	Service        string
	Realm          string
	Port           int
	Debug          bool
	Router         *mux.Router
	// contains filtered or unexported fields
}

func (*Server) GetFullAccessToken added in v1.0.10

func (s *Server) GetFullAccessToken(repository ...string) (string, error)

func (*Server) HandleAuth

func (s *Server) HandleAuth(writer http.ResponseWriter, request *http.Request)

func (*Server) Initialise

func (s *Server) Initialise() error

func (*Server) LoadCertAndKey

func (s *Server) LoadCertAndKey(certFile string, keyFile string) error

func (*Server) StartAndWait

func (s *Server) StartAndWait() error

Jump to

Keyboard shortcuts

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