token

package
v0.0.310 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultIssuerName = "kubesphere"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	Username  string              `json:"username"`
	Groups    []string            `json:"groups,omitempty"`
	Extra     map[string][]string `json:"extra,omitempty"`
	TokenType TokenType           `json:"token_type"`
	// Currently, we are not using any field in jwt.StandardClaims
	jwt.StandardClaims
}

type Issuer

type Issuer interface {
	// IssueTo issues a token a User, return error if issuing process failed
	IssueTo(user user.Info, tokenType TokenType, expiresIn time.Duration) (string, error)

	// Verify verifies a token, and return a user info if it's a valid token, otherwise return error
	Verify(string) (user.Info, TokenType, error)
}

Issuer issues token to user, tokens are required to perform mutating requests to resources

func NewTokenIssuer

func NewTokenIssuer(secret string, maximumClockSkew time.Duration) Issuer

type TokenType

type TokenType string
const (
	AccessToken  TokenType = "access_token"
	RefreshToken TokenType = "refresh_token"
	StaticToken  TokenType = "static_token"
)

Jump to

Keyboard shortcuts

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