Documentation ¶
Index ¶
- Constants
- Variables
- func GetAccessToken(ctx context.Context) (*types.AccessToken, error)
- func GetCurrentSub(ctx context.Context) (string, error)
- func GetMetadataFromHeader(ctx context.Context) (string, bool, string)
- func GetNamespace(ctx context.Context) (string, error)
- func GetProjectAndBranchAndColl(req interface{}) (string, string, string)
- func Init(tg metadata.TenantGetter)
- func IsAdminApi(fullMethodName string) bool
- func IsHumanUser(ctx context.Context) bool
- func IsRead(ctx context.Context) bool
- func IsWrite(ctx context.Context) bool
- type AccessTokenNamespaceExtractor
- type Metadata
- func GetGrpcEndPointMetadataFromFullMethod(ctx context.Context, fullMethod string, methodType string, req interface{}) 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) 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" UserEmail = "ue" Subject = "sub" )
Variables ¶
View Source
var ErrNamespaceNotFound = errors.NotFound("namespace not found")
Functions ¶
func GetAccessToken ¶
func GetAccessToken(ctx context.Context) (*types.AccessToken, error)
func Init ¶
func Init(tg metadata.TenantGetter)
func IsAdminApi ¶
func IsHumanUser ¶
Types ¶
type AccessTokenNamespaceExtractor ¶
type AccessTokenNamespaceExtractor struct{}
type Metadata ¶
type Metadata struct { IsHuman bool // Current user/application Sub 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.