usercontext

package
v0.90.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckOrgRequirements

func CheckOrgRequirements(uc biz.CASBackendReader) middleware.Middleware

func CheckUserInAllowList

func CheckUserInAllowList(allowList []string) middleware.Middleware

Middleware that checks that the user is defined in the allow list

func CurrentAuthzSubject added in v0.75.0

func CurrentAuthzSubject(ctx context.Context) string

func WithAttestationContextFromAPIToken added in v0.87.0

func WithAttestationContextFromAPIToken(apiTokenUC *biz.APITokenUseCase, logger *log.Helper) middleware.Middleware

WithAttestationContextFromAPIToken injects the API-Token, organization + robot account to the context

func WithAttestationContextFromRobotAccount added in v0.87.0

func WithAttestationContextFromRobotAccount(robotAccountUseCase *biz.RobotAccountUseCase, orgUseCase *biz.OrganizationUseCase, logger *log.Helper) middleware.Middleware

WithAttestationContextFromRobotAccount Middleware that injects the current user to the context

func WithAuthzSubject added in v0.75.0

func WithAuthzSubject(ctx context.Context, subject string) context.Context

Store the authorization subject

func WithCurrentAPIToken added in v0.55.0

func WithCurrentAPIToken(ctx context.Context, token *APIToken) context.Context

func WithCurrentAPITokenAndOrgMiddleware added in v0.55.0

func WithCurrentAPITokenAndOrgMiddleware(apiTokenUC *biz.APITokenUseCase, orgUC *biz.OrganizationUseCase, logger *log.Helper) middleware.Middleware

Middleware that injects the API-Token + organization to the context

func WithCurrentOrg added in v0.55.0

func WithCurrentOrg(ctx context.Context, org *Org) context.Context

func WithCurrentUser added in v0.55.0

func WithCurrentUser(ctx context.Context, user *User) context.Context

func WithCurrentUserAndOrgMiddleware

func WithCurrentUserAndOrgMiddleware(userUseCase biz.UserOrgFinder, logger *log.Helper) middleware.Middleware

Middleware that injects the current user + organization to the context

Types

type APIToken added in v0.55.0

type APIToken struct {
	ID        string
	CreatedAt *time.Time
}

func CurrentAPIToken added in v0.55.0

func CurrentAPIToken(ctx context.Context) *APIToken

type Org

type Org struct {
	ID, Name  string
	CreatedAt *time.Time
}

func CurrentOrg

func CurrentOrg(ctx context.Context) *Org

RequestID tries to retrieve requestID from the given context. If it doesn't exist, an empty string is returned.

type RobotAccount

type RobotAccount struct {
	ID, WorkflowID, OrgID, ProviderKey string
}

func CurrentRobotAccount

func CurrentRobotAccount(ctx context.Context) *RobotAccount

type User

type User struct {
	Email, ID string
	CreatedAt *time.Time
}

Utils to get and set information from context

func CurrentUser

func CurrentUser(ctx context.Context) *User

RequestID tries to retrieve requestID from the given context. If it doesn't exist, an empty string is returned.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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