invauth

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package invauth provides authorization for each GRPC method in MServiceInventory. The JWT extracted from the GRPC request context is used for each delegating method.

Index

Constants

This section is empty.

Variables

View Source
var NotImplemented = errors.New("not implemented")

Functions

func GetInt64FromClaims

func GetInt64FromClaims(claims *map[string]interface{}, key string) int64

Helper to get a claim value as int64.

func GetStringFromClaims

func GetStringFromClaims(claims *map[string]interface{}, key string) string

Helper to get claim value as string.

func HasAdminAccess

func HasAdminAccess(claims *map[string]interface{}) bool

Helper to see if JWT provides admin access.

func HasRWAccess

func HasRWAccess(claims *map[string]interface{}) bool

Helper to see if JWT provides read/write access.

func HasReadAccess

func HasReadAccess(claims *map[string]interface{}) bool

Helper to see if JWT provides read access.

Types

type InvAuth added in v0.9.3

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

func NewInvAuth

func NewInvAuth(invService pb.MServiceInventoryServer) *InvAuth

Get a new invAuth instance.

func (*InvAuth) CreateEntitySchema added in v0.9.4

create an entity schema

func (*InvAuth) CreateFacility added in v0.9.3

func (s *InvAuth) CreateFacility(ctx context.Context, req *pb.CreateFacilityRequest) (*pb.CreateFacilityResponse, error)

create new facility

func (*InvAuth) CreateInventoryItem added in v0.9.3

create a new inventory item

func (*InvAuth) CreateItemType added in v0.9.3

func (s *InvAuth) CreateItemType(ctx context.Context, req *pb.CreateItemTypeRequest) (*pb.CreateItemTypeResponse, error)

create new item type

func (*InvAuth) CreateProduct added in v0.9.3

func (s *InvAuth) CreateProduct(ctx context.Context, req *pb.CreateProductRequest) (*pb.CreateProductResponse, error)

create a new product

func (*InvAuth) CreateSubarea added in v0.9.3

func (s *InvAuth) CreateSubarea(ctx context.Context, req *pb.CreateSubareaRequest) (*pb.CreateSubareaResponse, error)

create a new subarea

func (*InvAuth) CreateSubareaType added in v0.9.3

create new subarea type

func (*InvAuth) DeleteEntitySchema added in v0.9.4

delete an entity schema

func (*InvAuth) DeleteFacility added in v0.9.3

func (s *InvAuth) DeleteFacility(ctx context.Context, req *pb.DeleteFacilityRequest) (*pb.DeleteFacilityResponse, error)

delete an existing facility

func (*InvAuth) DeleteInventoryItem added in v0.9.3

delete an existing inventory item

func (*InvAuth) DeleteItemType added in v0.9.3

func (s *InvAuth) DeleteItemType(ctx context.Context, req *pb.DeleteItemTypeRequest) (*pb.DeleteItemTypeResponse, error)

delete an existing item type

func (*InvAuth) DeleteProduct added in v0.9.3

func (s *InvAuth) DeleteProduct(ctx context.Context, req *pb.DeleteProductRequest) (*pb.DeleteProductResponse, error)

delete an existing product

func (*InvAuth) DeleteSubarea added in v0.9.3

func (s *InvAuth) DeleteSubarea(ctx context.Context, req *pb.DeleteSubareaRequest) (*pb.DeleteSubareaResponse, error)

delete an existing subarea

func (*InvAuth) DeleteSubareaType added in v0.9.3

delete an existing subarea type

func (*InvAuth) GetEntitySchema added in v0.9.4

func (s *InvAuth) GetEntitySchema(ctx context.Context, req *pb.GetEntitySchemaRequest) (*pb.GetEntitySchemaResponse, error)

get an entity schema by name

func (*InvAuth) GetEntitySchemas added in v0.9.4

get all entity schemas for account

func (*InvAuth) GetFacilities added in v0.9.3

func (s *InvAuth) GetFacilities(ctx context.Context, req *pb.GetFacilitiesRequest) (*pb.GetFacilitiesResponse, error)

get all facilities by mservice_id

func (*InvAuth) GetFacility added in v0.9.3

func (s *InvAuth) GetFacility(ctx context.Context, req *pb.GetFacilityRequest) (*pb.GetFacilityResponse, error)

get a facility by id

func (*InvAuth) GetFacilityWrapper added in v0.9.3

get a facility wrapper by id

func (*InvAuth) GetInventoryItem added in v0.9.3

get an inventory item by id

func (*InvAuth) GetInventoryItemsByFacility added in v0.9.3

get all inventory items in a facility

func (*InvAuth) GetInventoryItemsByProduct added in v0.9.3

get all inventory items for a product id

func (*InvAuth) GetInventoryItemsBySubarea added in v0.9.3

get all inventory items in a subarea

func (*InvAuth) GetItemType added in v0.9.3

func (s *InvAuth) GetItemType(ctx context.Context, req *pb.GetItemTypeRequest) (*pb.GetItemTypeResponse, error)

get a item type by id

func (*InvAuth) GetItemTypes added in v0.9.3

func (s *InvAuth) GetItemTypes(ctx context.Context, req *pb.GetItemTypesRequest) (*pb.GetItemTypesResponse, error)

get item types by mservice_id

func (*InvAuth) GetJwtFromContext added in v0.9.3

func (s *InvAuth) GetJwtFromContext(ctx context.Context) (*map[string]interface{}, error)

Get the JWT from the GRPC request context.

func (*InvAuth) GetProduct added in v0.9.3

func (s *InvAuth) GetProduct(ctx context.Context, req *pb.GetProductRequest) (*pb.GetProductResponse, error)

get a product by id

func (*InvAuth) GetProducts added in v0.9.3

func (s *InvAuth) GetProducts(ctx context.Context, req *pb.GetProductsRequest) (*pb.GetProductsResponse, error)

get all products by mservice_id

func (*InvAuth) GetServerVersion added in v0.9.3

get current server version and uptime - health check

func (*InvAuth) GetSubarea added in v0.9.3

func (s *InvAuth) GetSubarea(ctx context.Context, req *pb.GetSubareaRequest) (*pb.GetSubareaResponse, error)

get a subarea by id

func (*InvAuth) GetSubareaType added in v0.9.3

func (s *InvAuth) GetSubareaType(ctx context.Context, req *pb.GetSubareaTypeRequest) (*pb.GetSubareaTypeResponse, error)

get a subarea type by id

func (*InvAuth) GetSubareaTypes added in v0.9.3

func (s *InvAuth) GetSubareaTypes(ctx context.Context, req *pb.GetSubareaTypesRequest) (*pb.GetSubareaTypesResponse, error)

get subarea types by mservice_id

func (*InvAuth) GetSubareas added in v0.9.3

func (s *InvAuth) GetSubareas(ctx context.Context, req *pb.GetSubareasRequest) (*pb.GetSubareasResponse, error)

get all subareas by facility_id

func (*InvAuth) NewApiServer added in v0.9.3

func (s *InvAuth) NewApiServer(gServer *grpc.Server) error

func (*InvAuth) SetDatabaseConnection added in v0.9.3

func (s *InvAuth) SetDatabaseConnection(sqlDB *sql.DB)

Set the database connection for the invAuth instance.

func (*InvAuth) SetLogger added in v0.9.3

func (s *InvAuth) SetLogger(logger log.Logger)

Set a logger for the invAuth instance.

func (*InvAuth) SetPublicKey added in v0.9.3

func (s *InvAuth) SetPublicKey(publicKeyFile string) error

Set the RSA public key for the invAuth instance to validate the JWT.

func (*InvAuth) UpdateEntitySchema added in v0.9.4

update an entity schema

func (*InvAuth) UpdateFacility added in v0.9.3

func (s *InvAuth) UpdateFacility(ctx context.Context, req *pb.UpdateFacilityRequest) (*pb.UpdateFacilityResponse, error)

update an existing facility

func (*InvAuth) UpdateInventoryItem added in v0.9.3

update an existing inventory item

func (*InvAuth) UpdateItemType added in v0.9.3

func (s *InvAuth) UpdateItemType(ctx context.Context, req *pb.UpdateItemTypeRequest) (*pb.UpdateItemTypeResponse, error)

update an existing item type

func (*InvAuth) UpdateProduct added in v0.9.3

func (s *InvAuth) UpdateProduct(ctx context.Context, req *pb.UpdateProductRequest) (*pb.UpdateProductResponse, error)

update an existing product

func (*InvAuth) UpdateSubarea added in v0.9.3

func (s *InvAuth) UpdateSubarea(ctx context.Context, req *pb.UpdateSubareaRequest) (*pb.UpdateSubareaResponse, error)

update an existing subarea

func (*InvAuth) UpdateSubareaType added in v0.9.3

update an existing subarea type

Jump to

Keyboard shortcuts

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