gojwt

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 13 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.

README

GoJWT

Go Reference

Installation

go get github.com/masv3971/gojwt

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	URL string

	JWT *JWT
	// contains filtered or unexported fields
}

Client holds the object of jwt

func New

func New(config Config) *Client

New creates a new instance of jwt

func (*Client) EnsureJWT

func (c *Client) EnsureJWT(ctx context.Context) error

EnsureJWT ensure that a jwt is present and valid

type Config

type Config struct {
	Certificate []byte
	PrivateKey  []byte
	Password    string
	Scope       string
	Type        string
	URL         string
	Key         string
	Client      string
}

Config holds the configuration for jwt

type EmptyStruct

type EmptyStruct struct{}

EmptyStruct type

type Error

type Error interface {
	Error() string
}

Error interface

type Errors

type Errors struct {
	Detail []struct {
		Loc  []string `json:"loc"`
		Msg  string   `json:"msg"`
		Type string   `json:"type"`
	} `json:"detail"`
}

Errors is a general error reply

func (*Errors) Error

func (e *Errors) Error() string

type GetJWTRequest

type GetJWTRequest struct {
	Data JWTRequest `json:"data"`
}

GetJWTRequest holds the request

type JWT

type JWT struct {
	sync.RWMutex
	RAW       string
	ExpiresAt int64
	IssuedAt  int64
	NotBefore int64
}

JWT holds the raw token, mutex lock and expiration dates

func (*JWT) Valid

func (jwt *JWT) Valid() bool

Valid checks if jwt token i valid of not

type JWTAccess

type JWTAccess struct {
	Scope string `json:"scope"`
	Type  string `json:"type"`
}

JWTAccess type

type JWTAccessToken

type JWTAccessToken struct {
	Flags  []string    `json:"flags"`
	Access []JWTAccess `json:"access"`
}

JWTAccessToken type

type JWTClient

type JWTClient struct {
	Key string `json:"key"`
}

JWTClient type

type JWTReply

type JWTReply struct {
	AccessToken struct {
		Value  string `json:"value"`
		Access []struct {
			Type  string `json:"type"`
			Scope string `json:"scope"`
		} `json:"access"`
		Flags []string `json:"flags"`
	} `json:"access_token"`
}

JWTReply reply from jwt retrival endpoint

type JWTRequest

type JWTRequest struct {
	AccessToken []JWTAccessToken `json:"access_token"`
	Client      JWTClient        `json:"client"`
}

JWTRequest request type for ensureJWT

Jump to

Keyboard shortcuts

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