Documentation ¶
Index ¶
- Constants
- Variables
- func DisableSearch(ctx context.Context) bool
- func GetAccessToken(ctx context.Context) (*types.AccessToken, error)
- func GetCurrentSub(ctx context.Context) (string, error)
- func GetMetadataFromHeader(ctx context.Context) (string, bool, string, string)
- func GetNamespace(ctx context.Context) (string, error)
- func GetProjectAndBranchAndColl(req any) (string, string, string)
- func Init(tg metadata.TenantGetter)
- func IsAcceptApplicationJSON(ctx context.Context) bool
- func IsAdminApi(fullMethodName string) bool
- func IsHumanUser(ctx context.Context) bool
- func IsLocalRoot(ctx context.Context) bool
- func IsRead(ctx context.Context) bool
- func IsWrite(ctx context.Context) bool
- func NeedSchemaValidation(ctx context.Context) bool
- func ReadSearchDataFromStorage(ctx context.Context) bool
- func SetLocalRoot(ctx context.Context) context.Context
- type AccessTokenNamespaceExtractor
- type AuthInfo
- type Metadata
- func GetGrpcEndPointMetadataFromFullMethod(ctx context.Context, fullMethod string, methodType string, req any) Metadata
- func GetRequestMetadataFromContext(ctx context.Context) (*Metadata, error)
- func NewRequestEndpointMetadata(ctx context.Context, serviceName string, methodInfo grpc.MethodInfo, db string, ...) Metadata
- func NewRequestMetadata(ctx context.Context) Metadata
- func (m *Metadata) GetBranch() string
- func (m *Metadata) GetCollection() string
- func (m *Metadata) GetFullMethod() string
- func (m *Metadata) GetInitialTags() map[string]string
- func (m *Metadata) GetMethodInfo() grpc.MethodInfo
- func (m *Metadata) GetMethodName() string
- func (m *Metadata) GetNamespace() string
- func (m *Metadata) GetNamespaceName() string
- func (m *Metadata) GetProject() string
- func (m *Metadata) GetRole() string
- func (m *Metadata) GetServiceName() string
- func (m *Metadata) GetServiceType() string
- func (m *Metadata) GetTigrisNamespaceNameTag() string
- func (m *Metadata) SaveToContext(ctx context.Context) context.Context
- func (m *Metadata) SetAccessToken(token *types.AccessToken)
- func (m *Metadata) SetBranch(branch string)
- func (m *Metadata) SetCollection(collection string)
- func (m *Metadata) SetNamespace(ctx context.Context, namespace string)
- func (m *Metadata) SetProject(project string)
- type MetadataCtxKey
- type NamespaceExtractor
Constants ¶
View Source
const ( JWTTigrisClaimSpace = "https://tigris" NamespaceCode = "nc" Role = "r" UserEmail = "ue" Subject = "sub" )
View Source
const (
AcceptTypeApplicationJSON = "application/json"
)
Variables ¶
View Source
var ErrNamespaceNotFound = errors.NotFound("namespace not found")
Functions ¶
func DisableSearch ¶
func GetAccessToken ¶
func GetAccessToken(ctx context.Context) (*types.AccessToken, error)
func GetMetadataFromHeader ¶
GetMetadataFromHeader returns the namespaceCode, isHuman, user sub and user role from the header token.
func Init ¶
func Init(tg metadata.TenantGetter)
func IsAcceptApplicationJSON ¶
func IsAdminApi ¶
func IsHumanUser ¶
func IsLocalRoot ¶
func NeedSchemaValidation ¶
Types ¶
type AccessTokenNamespaceExtractor ¶
type AccessTokenNamespaceExtractor struct{}
type AuthInfo ¶
type AuthInfo struct { credentials.CommonAuthInfo LocalRoot bool }
AuthInfo is used for root authentication on the unix socket peer.
type Metadata ¶
type Metadata struct { IsHuman bool // Current user/application Sub string Role string // contains filtered or unexported fields }
func NewRequestMetadata ¶
func (*Metadata) GetCollection ¶
func (*Metadata) GetFullMethod ¶
func (*Metadata) GetInitialTags ¶
func (*Metadata) GetMethodInfo ¶
func (m *Metadata) GetMethodInfo() grpc.MethodInfo
func (*Metadata) GetMethodName ¶
func (*Metadata) GetNamespace ¶
func (*Metadata) GetNamespaceName ¶
func (*Metadata) GetProject ¶
func (*Metadata) GetServiceName ¶
func (*Metadata) GetServiceType ¶
func (*Metadata) GetTigrisNamespaceNameTag ¶
func (*Metadata) SaveToContext ¶
func (*Metadata) SetAccessToken ¶
func (m *Metadata) SetAccessToken(token *types.AccessToken)
func (*Metadata) SetCollection ¶
func (*Metadata) SetNamespace ¶
func (*Metadata) SetProject ¶
type MetadataCtxKey ¶
type MetadataCtxKey struct{}
Click to show internal directories.
Click to hide internal directories.