token

package
v0.0.0-...-e175c89 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 22 Imported by: 150

Documentation

Index

Constants

View Source
const (
	// Registry service
	Registry = "harbor-registry"
)

Variables

This section is empty.

Functions

func GetResourceActions

func GetResourceActions(scopes []string) []*token.ResourceActions

GetResourceActions ...

func InitCreators

func InitCreators()

InitCreators initialize the token creators for different services

func MakeToken

func MakeToken(ctx context.Context, username, service string, access []*token.ResourceActions) (*models.Token, error)

MakeToken makes a valid jwt token based on parms.

Types

type Creator

type Creator interface {
	Create(r *http.Request) (*models.Token, error)
}

Creator creates a token ready to be served based on the http request.

type Handler

type Handler struct {
	web.Controller
}

Handler handles request on /service/token, which is the auth provider for registry.

func (*Handler) Get

func (h *Handler) Get()

Get handles GET request, it checks the http header for user credentials and parse service and scope based on docker registry v2 standard, checks the permission against local DB and generates jwt token.

Jump to

Keyboard shortcuts

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