jwtService

package
v0.0.0-...-15bed1d Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package jwtService is a generated GoMock package.

Package jwtService is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(ctx context.Context) *service

Types

type ClaimInterface

type ClaimInterface interface {
	Type() (userID string, module int) // 类型 区分多个类型
	Valid() error                      // 额外校验
}

type Claims

type Claims interface {
	Valid() error
	ID() string
	Owner() string
	Expire() time.Duration
}

type JwtService

type JwtService interface {
	Unpack(src string, dst Claims) error    // 解包,验证有效
	Pack(Claims) (string, error)            // 打包
	Invalid(claims Claims) error            // 使过期,防止重复使用
	Register(claims Claims) error           // 注册生效
	Valid(c Claims) (valid bool, err error) // 验证是否已使用
}

func NewJwtService

func NewJwtService(ctx context.Context) JwtService

type MockClaimInterface

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

MockClaimInterface is a mock of ClaimInterface interface.

func NewMockClaimInterface

func NewMockClaimInterface(ctrl *gomock.Controller) *MockClaimInterface

NewMockClaimInterface creates a new mock instance.

func (*MockClaimInterface) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClaimInterface) Type

func (m *MockClaimInterface) Type() (string, int)

Type mocks base method.

func (*MockClaimInterface) Valid

func (m *MockClaimInterface) Valid() error

Valid mocks base method.

type MockClaimInterfaceMockRecorder

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

MockClaimInterfaceMockRecorder is the mock recorder for MockClaimInterface.

func (*MockClaimInterfaceMockRecorder) Type

Type indicates an expected call of Type.

func (*MockClaimInterfaceMockRecorder) Valid

Valid indicates an expected call of Valid.

type MockClaims

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

MockClaims is a mock of Claims interface.

func NewMockClaims

func NewMockClaims(ctrl *gomock.Controller) *MockClaims

NewMockClaims creates a new mock instance.

func (*MockClaims) EXPECT

func (m *MockClaims) EXPECT() *MockClaimsMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClaims) Expire

func (m *MockClaims) Expire() time.Duration

Expire mocks base method.

func (*MockClaims) ID

func (m *MockClaims) ID() string

ID mocks base method.

func (*MockClaims) Owner

func (m *MockClaims) Owner() string

Owner mocks base method.

func (*MockClaims) Valid

func (m *MockClaims) Valid() error

Valid mocks base method.

type MockClaimsMockRecorder

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

MockClaimsMockRecorder is the mock recorder for MockClaims.

func (*MockClaimsMockRecorder) Expire

func (mr *MockClaimsMockRecorder) Expire() *gomock.Call

Expire indicates an expected call of Expire.

func (*MockClaimsMockRecorder) ID

ID indicates an expected call of ID.

func (*MockClaimsMockRecorder) Owner

func (mr *MockClaimsMockRecorder) Owner() *gomock.Call

Owner indicates an expected call of Owner.

func (*MockClaimsMockRecorder) Valid

func (mr *MockClaimsMockRecorder) Valid() *gomock.Call

Valid indicates an expected call of Valid.

type MockJwtService

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

MockJwtService is a mock of JwtService interface.

func NewMockJwtService

func NewMockJwtService(ctrl *gomock.Controller) *MockJwtService

NewMockJwtService creates a new mock instance.

func (*MockJwtService) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockJwtService) Invalid

func (m *MockJwtService) Invalid(claims Claims) error

Invalid mocks base method.

func (*MockJwtService) Pack

func (m *MockJwtService) Pack(arg0 Claims) (string, error)

Pack mocks base method.

func (*MockJwtService) Register

func (m *MockJwtService) Register(claims Claims) error

Register mocks base method.

func (*MockJwtService) Unpack

func (m *MockJwtService) Unpack(src string, dst Claims) error

Unpack mocks base method.

func (*MockJwtService) Valid

func (m *MockJwtService) Valid(c Claims) (bool, error)

Valid mocks base method.

type MockJwtServiceMockRecorder

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

MockJwtServiceMockRecorder is the mock recorder for MockJwtService.

func (*MockJwtServiceMockRecorder) Invalid

func (mr *MockJwtServiceMockRecorder) Invalid(claims interface{}) *gomock.Call

Invalid indicates an expected call of Invalid.

func (*MockJwtServiceMockRecorder) Pack

func (mr *MockJwtServiceMockRecorder) Pack(arg0 interface{}) *gomock.Call

Pack indicates an expected call of Pack.

func (*MockJwtServiceMockRecorder) Register

func (mr *MockJwtServiceMockRecorder) Register(claims interface{}) *gomock.Call

Register indicates an expected call of Register.

func (*MockJwtServiceMockRecorder) Unpack

func (mr *MockJwtServiceMockRecorder) Unpack(src, dst interface{}) *gomock.Call

Unpack indicates an expected call of Unpack.

func (*MockJwtServiceMockRecorder) Valid

func (mr *MockJwtServiceMockRecorder) Valid(c interface{}) *gomock.Call

Valid indicates an expected call of Valid.

type RewardClaim

type RewardClaim[ct ClaimInterface] struct {
	Claim ct
	jwt.RegisteredClaims
}

func NewClaim

func NewClaim[T ClaimInterface](claim T, startTime, endTime time.Time) RewardClaim[T]

NewClaim claim

func (RewardClaim[ct]) Expire

func (r RewardClaim[ct]) Expire() time.Duration

func (RewardClaim[ct]) ID

func (r RewardClaim[ct]) ID() string

func (RewardClaim[ct]) Owner

func (r RewardClaim[ct]) Owner() string

func (RewardClaim[ct]) Valid

func (r RewardClaim[ct]) Valid() error

Jump to

Keyboard shortcuts

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