usercontext

package
v1.36.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: Apache-2.0 Imports: 22 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 CheckUserHasAccess added in v1.3.0

func CheckUserHasAccess(allowList *conf.AllowList, userUC biz.UserOrgFinder) middleware.Middleware

Middleware that checks that the user has access to the current route Note that the source of truth is in the end the property set in the DB The value in the allowlist conf setting is used as a starting point to populate the property in the DB

func CurrentAuthzSubject added in v0.75.0

func CurrentAuthzSubject(ctx context.Context) string

func Prometheus added in v0.127.0

func Prometheus() middleware.Middleware

This package contains a set of wrappers that take grpc.UnaryInterceptors and translate them into Kratos middlewares. The reason for having these kind of wrappers is so we can sort them in the context of the rest of middlewares. Otherwise, plain grpc interceptors will be added after the chain of middlewares https://github.com/go-kratos/kratos/blob/f8b97f675b32dfad02edae12d83053c720720b5b/transport/grpc/server.go#L166

func ResetMembershipsCache added in v1.11.0

func ResetMembershipsCache()

func WithAPITokenUsageUpdater added in v1.19.0

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

func WithAttestationContextFromAPIToken added in v0.87.0

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

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

func WithAttestationContextFromFederatedInfo added in v0.165.0

func WithAttestationContextFromFederatedInfo(orgUC *biz.OrganizationUseCase, logger *log.Helper) middleware.Middleware

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 WithAttestationContextFromUser added in v0.179.0

func WithAttestationContextFromUser(userUC *biz.UserUseCase, membershipUC *biz.MembershipUseCase, logger *log.Helper) middleware.Middleware

WithAttestationContextFromUser injects the current user + organization to the context during the attestation process it leverages the existing middlewares to set the current user and organization but with a skipping behavior since that's the one required by the attMiddleware multi-selector

func WithAuthzSubject added in v0.75.0

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

Store the authorization subject

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 WithCurrentOrganizationMiddleware added in v0.92.0

func WithCurrentOrganizationMiddleware(userUseCase biz.UserOrgFinder, membershipUC biz.MembershipsRBAC, logger *log.Helper) middleware.Middleware

func WithCurrentUserMiddleware added in v0.92.0

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

WithCurrentUserMiddleware injects the current user + organization to the context

Types

type RobotAccount

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

func CurrentRobotAccount

func CurrentRobotAccount(ctx context.Context) *RobotAccount

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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