jwt

package
v0.0.0-...-825d742 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	UserID   uint   `json:"user_id"`
	Username string `json:"username"`
	jwt.StandardClaims
}

type Manager

type Manager interface {
	GenerateToken(userID uint, username string) (string, error)
	ValidateToken(encodedToken string) (*jwt.Token, error)
	FromMapClaims(userClaims jwt.MapClaims) (*Claims, error)
	GetClaims(c *gin.Context) (*Claims, error)
}

func New

func New(secretKey, issure string) Manager

New creates a new token manager with the given secret key and issure.

type MockManager

type MockManager struct {
	mock.Mock
}

MockManager is an autogenerated mock type for the Manager type

func NewMockManager

func NewMockManager(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockManager

NewMockManager creates a new instance of MockManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockManager) EXPECT

func (_m *MockManager) EXPECT() *MockManager_Expecter

func (*MockManager) FromMapClaims

func (_m *MockManager) FromMapClaims(userClaims golang_jwtjwt.MapClaims) (*Claims, error)

FromMapClaims provides a mock function with given fields: userClaims

func (*MockManager) GenerateToken

func (_m *MockManager) GenerateToken(userID uint, username string) (string, error)

GenerateToken provides a mock function with given fields: userID, username

func (*MockManager) GetClaims

func (_m *MockManager) GetClaims(c *gin.Context) (*Claims, error)

GetClaims provides a mock function with given fields: c

func (*MockManager) ValidateToken

func (_m *MockManager) ValidateToken(encodedToken string) (*golang_jwtjwt.Token, error)

ValidateToken provides a mock function with given fields: encodedToken

type MockManager_Expecter

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

func (*MockManager_Expecter) FromMapClaims

func (_e *MockManager_Expecter) FromMapClaims(userClaims interface{}) *MockManager_FromMapClaims_Call

FromMapClaims is a helper method to define mock.On call

  • userClaims golang_jwtjwt.MapClaims

func (*MockManager_Expecter) GenerateToken

func (_e *MockManager_Expecter) GenerateToken(userID interface{}, username interface{}) *MockManager_GenerateToken_Call

GenerateToken is a helper method to define mock.On call

  • userID uint
  • username string

func (*MockManager_Expecter) GetClaims

func (_e *MockManager_Expecter) GetClaims(c interface{}) *MockManager_GetClaims_Call

GetClaims is a helper method to define mock.On call

  • c *gin.Context

func (*MockManager_Expecter) ValidateToken

func (_e *MockManager_Expecter) ValidateToken(encodedToken interface{}) *MockManager_ValidateToken_Call

ValidateToken is a helper method to define mock.On call

  • encodedToken string

type MockManager_FromMapClaims_Call

type MockManager_FromMapClaims_Call struct {
	*mock.Call
}

MockManager_FromMapClaims_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FromMapClaims'

func (*MockManager_FromMapClaims_Call) Return

func (*MockManager_FromMapClaims_Call) Run

func (*MockManager_FromMapClaims_Call) RunAndReturn

type MockManager_GenerateToken_Call

type MockManager_GenerateToken_Call struct {
	*mock.Call
}

MockManager_GenerateToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GenerateToken'

func (*MockManager_GenerateToken_Call) Return

func (*MockManager_GenerateToken_Call) Run

func (_c *MockManager_GenerateToken_Call) Run(run func(userID uint, username string)) *MockManager_GenerateToken_Call

func (*MockManager_GenerateToken_Call) RunAndReturn

type MockManager_GetClaims_Call

type MockManager_GetClaims_Call struct {
	*mock.Call
}

MockManager_GetClaims_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClaims'

func (*MockManager_GetClaims_Call) Return

func (*MockManager_GetClaims_Call) Run

func (*MockManager_GetClaims_Call) RunAndReturn

type MockManager_ValidateToken_Call

type MockManager_ValidateToken_Call struct {
	*mock.Call
}

MockManager_ValidateToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidateToken'

func (*MockManager_ValidateToken_Call) Return

func (*MockManager_ValidateToken_Call) Run

func (_c *MockManager_ValidateToken_Call) Run(run func(encodedToken string)) *MockManager_ValidateToken_Call

func (*MockManager_ValidateToken_Call) RunAndReturn

Jump to

Keyboard shortcuts

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