oauthcodes

package
v0.0.0-...-059fb3b Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidExpirationDate = fmt.Errorf("invalid expiration date")

Functions

This section is empty.

Types

type Code

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

func (*Code) Challenge

func (c *Code) Challenge() secret.Text

func (*Code) ChallengeMethod

func (c *Code) ChallengeMethod() string

func (*Code) ClientID

func (c *Code) ClientID() string

func (*Code) Code

func (c *Code) Code() secret.Text

func (*Code) CreatedAt

func (c *Code) CreatedAt() time.Time

func (*Code) ExpiresAt

func (c *Code) ExpiresAt() time.Time

func (*Code) RedirectURI

func (c *Code) RedirectURI() string

func (*Code) Scope

func (c *Code) Scope() string

func (*Code) UserID

func (c *Code) UserID() string

type CreateCmd

type CreateCmd struct {
	Code            secret.Text
	ExpiresAt       time.Time
	ClientID        string
	UserID          string
	RedirectURI     string
	Scope           string
	Challenge       secret.Text
	ChallengeMethod string
}

func (CreateCmd) Validate

func (t CreateCmd) Validate() error

Validate the fields.

type FakeCodeBuilder

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

func NewFakeCode

func NewFakeCode(t testing.TB) *FakeCodeBuilder

func (*FakeCodeBuilder) Build

func (f *FakeCodeBuilder) Build() *Code

func (*FakeCodeBuilder) CreatedBy

func (f *FakeCodeBuilder) CreatedBy(user *users.User) *FakeCodeBuilder

func (*FakeCodeBuilder) WithClient

func (f *FakeCodeBuilder) WithClient(client *oauthclients.Client) *FakeCodeBuilder

type MockService

type MockService struct {
	mock.Mock
}

MockService is an autogenerated mock type for the Service type

func NewMockService

func NewMockService(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockService

NewMockService creates a new instance of MockService. 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 (*MockService) Create

func (_m *MockService) Create(ctx context.Context, input *CreateCmd) error

Create provides a mock function with given fields: ctx, input

func (*MockService) GetByCode

func (_m *MockService) GetByCode(ctx context.Context, code secret.Text) (*Code, error)

GetByCode provides a mock function with given fields: ctx, code

func (*MockService) RemoveByCode

func (_m *MockService) RemoveByCode(ctx context.Context, code secret.Text) error

RemoveByCode provides a mock function with given fields: ctx, code

type Service

type Service interface {
	Create(ctx context.Context, input *CreateCmd) error
	RemoveByCode(ctx context.Context, code secret.Text) error
	GetByCode(ctx context.Context, code secret.Text) (*Code, error)
}

func Init

func Init(tools tools.Tools, db *sql.DB) Service

Jump to

Keyboard shortcuts

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