secret

package
v0.0.0-...-e8722c0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSecret

func GetSecret(req *http.Request) string

GetSecret gets the secret from the request authorization header

func NewAuthorizer

func NewAuthorizer() lib.Authorizer

NewAuthorizer returns an instance of the authorizer

Types

type Manager

type Manager interface {
	// Generate generates a secret for the given repository, sample value for repository: "library/ubuntu"
	Generate(repository string) string
	// Verify verifies the secret against repo name, after the verification the secret should be invalid
	Verify(secret, repository string) bool
}

Manager generates and verifies the secret for repositories under proxy project The secret normally is used for authorizing a request trying to push artifact to a project A secret can be used only once and expires in a short period of time. As the request will be sent to 127.0.0.1 so the secret will live in one process.

func GetManager

func GetManager() Manager

GetManager returns the default manager which is a singleton in the package

Jump to

Keyboard shortcuts

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