oauthconsents

package
v0.0.0-...-46baba5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConsentNotFound = errors.New("consent not found")
View Source
var ExampleAliceConsent = Consent{
	// contains filtered or unexported fields
}

Functions

This section is empty.

Types

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

func (*Consent) ClientID

func (c *Consent) ClientID() string

func (*Consent) CreatedAt

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

func (*Consent) ID

func (c *Consent) ID() uuid.UUID

func (*Consent) Scopes

func (c *Consent) Scopes() []string

func (*Consent) SessionToken

func (c *Consent) SessionToken() string

func (*Consent) UserID

func (c *Consent) UserID() uuid.UUID

type CreateCmd

type CreateCmd struct {
	UserID       uuid.UUID
	SessionToken string
	ClientID     string
	Scopes       []string
}

func (CreateCmd) Validate

func (t CreateCmd) Validate() error

Validate the fields.

type FakeConsentBuilder

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

func NewFakeConsent

func NewFakeConsent(t testing.TB) *FakeConsentBuilder

func (*FakeConsentBuilder) Build

func (f *FakeConsentBuilder) Build() *Consent

func (*FakeConsentBuilder) CreatedBy

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

func (*FakeConsentBuilder) WithClient

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

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) Check

func (_m *MockService) Check(r *http.Request, client *oauthclients.Client, session *websessions.Session) error

Check provides a mock function with given fields: r, client, session

func (*MockService) Create

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

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

func (*MockService) Delete

func (_m *MockService) Delete(ctx context.Context, consentID uuid.UUID) error

Delete provides a mock function with given fields: ctx, consentID

func (*MockService) DeleteAll

func (_m *MockService) DeleteAll(ctx context.Context, userID uuid.UUID) error

DeleteAll provides a mock function with given fields: ctx, userID

func (*MockService) GetAll

func (_m *MockService) GetAll(ctx context.Context, userID uuid.UUID, cmd *sqlstorage.PaginateCmd) ([]Consent, error)

GetAll provides a mock function with given fields: ctx, userID, cmd

type OauthConsentsService

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

func NewService

func NewService(storage storage, tools tools.Tools) *OauthConsentsService

func (*OauthConsentsService) Check

func (s *OauthConsentsService) Check(r *http.Request, client *oauthclients.Client, session *websessions.Session) error

func (*OauthConsentsService) Create

func (s *OauthConsentsService) Create(ctx context.Context, cmd *CreateCmd) (*Consent, error)

func (*OauthConsentsService) Delete

func (s *OauthConsentsService) Delete(ctx context.Context, consentID uuid.UUID) error

func (*OauthConsentsService) DeleteAll

func (s *OauthConsentsService) DeleteAll(ctx context.Context, userID uuid.UUID) error

func (*OauthConsentsService) GetAll

func (s *OauthConsentsService) GetAll(ctx context.Context, userID uuid.UUID, cmd *sqlstorage.PaginateCmd) ([]Consent, error)

type Service

type Service interface {
	Create(ctx context.Context, cmd *CreateCmd) (*Consent, error)
	Check(r *http.Request, client *oauthclients.Client, session *websessions.Session) error
	Delete(ctx context.Context, consentID uuid.UUID) error
	GetAll(ctx context.Context, userID uuid.UUID, cmd *sqlstorage.PaginateCmd) ([]Consent, error)
	DeleteAll(ctx context.Context, userID uuid.UUID) error
}

func Init

func Init(tools tools.Tools, db sqlstorage.Querier) Service

Jump to

Keyboard shortcuts

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