vkuth

package
v1.0.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JWTTimeWindow        = 5 * time.Second
	TokenIssuer          = "vkuth"
	KindHeaderName       = "kind"
	KindHeaderTokenValue = "token"
	VkuthKeyHeader       = "X-Vkuth-Key"
)

Variables

This section is empty.

Functions

func GetAccessToken

func GetAccessToken(r *http.Request) string

func ParseVkuthKeys

func ParseVkuthKeys(encoded []string) (map[string][]byte, error)

func ParseVkuthKeysPemInBase64

func ParseVkuthKeysPemInBase64(encoded []string) (map[string][]byte, error)

Types

type AccessData

type AccessData struct {
	Bits map[string]struct{} // bits without namespace and only for appName service
	User string
	VkID *int64
}

type Claims

type Claims struct {
	*jwt.RegisteredClaims
	Data Data `json:"vkuth_data"`
	// contains filtered or unexported fields
}

func (*Claims) Valid

func (c *Claims) Valid() error

type Data

type Data struct {
	Bits []string `json:"bits"`
	User string   `json:"user"`
	VkID *int64   `json:"vk_id"`
}

type JWTHelper

type JWTHelper struct {
	// contains filtered or unexported fields
}

func NewJWTHelper

func NewJWTHelper(publicKeys map[string][]byte, appName string) *JWTHelper

func (*JWTHelper) ParseVkuthData

func (helper *JWTHelper) ParseVkuthData(accessToken string) (*AccessData, error)

func (*JWTHelper) SetNow

func (helper *JWTHelper) SetNow(now func() time.Time)

Jump to

Keyboard shortcuts

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