oauth

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPermissionDeny = errors.New("no permission")

ErrPermissionDeny of an operation

View Source
var ErrTokenOwnerNotFound = errors.New("requires token owner")

ErrTokenOwnerNotFound in context

Functions

This section is empty.

Types

type Service

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

Service of OAuth

func NewService

func NewService(
	config *config.Config,
	oauthStore core.OAuthStore,
	userStore core.UserStore,
) *Service

NewService for OAuth

func (*Service) CreateToken

func (s *Service) CreateToken(ctx context.Context, name string) (*core.OAuthToken, error)

CreateToken with name. Required context with User.

func (*Service) DeleteToken

func (s *Service) DeleteToken(ctx context.Context, token *core.OAuthToken) error

DeleteToken with access code

func (*Service) ListTokens

func (s *Service) ListTokens(ctx context.Context) ([]*core.OAuthToken, error)

ListTokens of token owner

func (*Service) Validate

func (s *Service) Validate(r *http.Request) (*core.User, error)

Validate Bearer token and return token's User if exist

func (*Service) WithUser

func (s *Service) WithUser(ctx context.Context, user *core.User) context.Context

WithUser context

Jump to

Keyboard shortcuts

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