token

package
v0.0.0-...-977965f Latest Latest
Warning

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

Go to latest
Published: May 28, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Notary service
	Notary = "harbor-notary"
	// 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(username, service string, access []*token.ResourceActions) (*models.Token, error)

MakeToken makes a valid jwt token based on parms. 生成 token 的重点

Types

type Creator

type Creator interface {
	// 为 docker pull/push 创建 token 信息
	Create(r *http.Request) (*models.Token, error)
}

Creator creates a token ready to be served based on the http request. 为 http 请求创建 token 服务

type Handler

type Handler struct {
	beego.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, checkes the permission against local DB and generates jwt token. 检查用户权限,生成 jwt token 数据

Jump to

Keyboard shortcuts

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