token

package
v1.8.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HToken

type HToken struct {
	jwt.Token
}

HToken htoken is a jwt token for harbor robot account, which contains the robot ID, project ID and the access permission for the project. It used for authn/authz for robot account in Harbor.

func New

func New(tokenID, projectID, expiresAt int64, access []*rbac.Policy) (*HToken, error)

New ...

func ParseWithClaims

func ParseWithClaims(rawToken string, claims jwt.Claims) (*HToken, error)

ParseWithClaims ...

func (*HToken) Raw

func (htk *HToken) Raw() (string, error)

Raw get the Raw string of token

type Options

type Options struct {
	SignMethod jwt.SigningMethod
	PublicKey  []byte
	PrivateKey []byte
	TTL        time.Duration
	Issuer     string
}

Options ...

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions ...

func (*Options) GetKey

func (o *Options) GetKey() (interface{}, error)

GetKey ...

type RobotClaims

type RobotClaims struct {
	jwt.StandardClaims
	TokenID   int64          `json:"id"`
	ProjectID int64          `json:"pid"`
	Access    []*rbac.Policy `json:"access"`
}

RobotClaims implements the interface of jwt.Claims

func (RobotClaims) Valid

func (rc RobotClaims) Valid() error

Valid valid the claims "tokenID, projectID and access".

Jump to

Keyboard shortcuts

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