jwt

package
v0.58.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// Issuer is the name of the issuer for PipeCD token.
	Issuer = "PipeCD"
	// SignedTokenKey is the name of singed token key in cookie.
	SignedTokenKey = "token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	jwtgo.RegisteredClaims
	AvatarURL string     `json:"avatarUrl,omitempty"`
	Role      model.Role `json:"role,omitempty"`
}

Claims extends the RegisteredClaims with the role to access PipeCD resources.

func NewClaims

func NewClaims(githubUserID, avatarURL string, ttl time.Duration, role model.Role) *Claims

NewClaims creates a new claims for a given github user.

type Signer

type Signer interface {
	Sign(claims *Claims) (string, error)
}

func NewSigner

func NewSigner(method jwtgo.SigningMethod, keyFile string) (Signer, error)

NewSigner returns a new signer using SigningMethodRS256.

type Verifier

type Verifier interface {
	Verify(token string) (*Claims, error)
}

func NewVerifier

func NewVerifier(method jwtgo.SigningMethod, keyFile string) (Verifier, error)

NewVerifier returns a new verifier using given signing method.

Directories

Path Synopsis
Package jwttest is a generated GoMock package.
Package jwttest is a generated GoMock package.

Jump to

Keyboard shortcuts

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