service

package
v0.0.0-...-5230034 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Provider)

func ChatProviderParam

func ChatProviderParam(c interfaces.ChatProvider) Option

func DynamoParam

func DynamoParam(db *dynamodb.DynamoDB) Option

func EveAPIParam

func EveAPIParam(e interfaces.EveAPI) Option

func OpenIDConnectParam

func OpenIDConnectParam(cfg *config.Config, id *identity.Validator) Option

func ResolverParam

func ResolverParam(r interfaces.CommandResolver) Option

type Provider

type Provider struct {
	ChatService     interfaces.ChatProvider
	CommandResolver interfaces.CommandResolver
	EveAPI          interfaces.EveAPI
	Cfg             *config.Config
	// contains filtered or unexported fields
}

Provider provides access to the Common Deps/Services required for this project

func New

func New(cfg *config.Config, opts ...Option) *Provider

func (*Provider) AuthCodeURL

func (p *Provider) AuthCodeURL(state string) string

func (*Provider) Exchange

func (p *Provider) Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)

func (*Provider) IsAuthorized

func (p *Provider) IsAuthorized(cmd commands.EvebotCommand, userEntry *UserEntry) bool

TODO: Setup a more "polished" RBAC strategy Want to be able to map incoming/dowstream groups with Roles in our system

func (*Provider) ReadUser

func (p *Provider) ReadUser(userID string) (*UserEntry, error)

func (*Provider) SaveUserAuth

func (p *Provider) SaveUserAuth(ctx context.Context, state string, code string) error

func (*Provider) Verify

func (p *Provider) Verify(ctx context.Context, input string) (*oidc.IDToken, error)

type UserEntry

type UserEntry struct {
	UserID  string
	Name    string
	Roles   map[string]bool
	IsAdmin bool
}

UserEntry struct to hold info about new user item

type UserStore

type UserStore interface {
	SaveUserAuth(ctx context.Context, state string, code string) error
	ReadUser(userID string) (*UserEntry, error)
}

Jump to

Keyboard shortcuts

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