hooks

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GrantTypeClientCredentials string = "client_credentials"
	GrantTypeJWTBearer         string = "urn:ietf:params:oauth:grant-type:jwt-bearer"
)

Variables

View Source
var ErrInvalidTotalSize = fmt.Errorf("invalid total size")

Functions

This section is empty.

Types

type API

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

func NewAPI

func NewAPI(
	service ServiceInterface,
	middleware *AuthMiddleware,
	tracer tracing.TracingInterface,
	monitor monitoring.MonitorInterface,
	logger logging.LoggerInterface,
) *API

func (*API) RegisterEndpoints

func (a *API) RegisterEndpoints(mux *chi.Mux)

type AuthMiddleware

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

func NewAuthMiddleware

func NewAuthMiddleware(token string, tracer tracing.TracingInterface, logger logging.LoggerInterface) *AuthMiddleware

func (*AuthMiddleware) AuthMiddleware

func (m *AuthMiddleware) AuthMiddleware(next http.Handler) http.Handler

type AuthorizerInterface added in v1.0.2

type AuthorizerInterface interface {
	CanAccess(context.Context, string, string, []string) (bool, error)
	BatchCanAccess(context.Context, string, []string, []string) (bool, error)
}

type ClientInterface

type ClientInterface interface {
	FetchUserGroups(context.Context, User) ([]*types.Group, error)
}

type DatabaseInterface added in v1.0.2

type DatabaseInterface interface {
	GetGroupsForUser(context.Context, string) ([]*types.Group, error)
}

type Record

type Record struct {
	Department string `mapstructure:"Department2__c"`
	Team       string `mapstructure:"fHCM2__Team__c"`
}

type Salesforce

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

func (*Salesforce) FetchUserGroups

func (s *Salesforce) FetchUserGroups(ctx context.Context, user User) ([]*types.Group, error)

type Service

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

func (*Service) AuthorizeRequest added in v1.0.2

func (s *Service) AuthorizeRequest(
	ctx context.Context,
	user User,
	req oauth2.TokenHookRequest,
	groups []*types.Group,
) (bool, error)

This implements deny by default TODO: we should make this configurable

func (*Service) FetchUserGroups

func (s *Service) FetchUserGroups(ctx context.Context, user User) ([]*types.Group, error)

type ServiceInterface

type ServiceInterface interface {
	FetchUserGroups(context.Context, User) ([]*types.Group, error)
	AuthorizeRequest(context.Context, User, oauth2.TokenHookRequest, []*types.Group) (bool, error)
}

type StorageHookGroupsClient added in v1.0.2

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

func NewLocalStorageClient added in v1.0.2

NewLocalStorageClient creates a new StorageHookGroupsClient.

func (*StorageHookGroupsClient) FetchUserGroups added in v1.0.2

func (c *StorageHookGroupsClient) FetchUserGroups(ctx context.Context, user User) ([]*types.Group, error)

FetchUserGroups retrieves user groups from the local storage database.

type User

type User struct {
	SubjectId string
	ClientId  string
	Email     string
}

func NewUserFromHookRequest

func NewUserFromHookRequest(r *oauth2.TokenHookRequest, logger logging.LoggerInterface) *User

func (*User) GetUserId

func (u *User) GetUserId() string

Jump to

Keyboard shortcuts

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