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 ¶
- Variables
- func GetInt64FromClaims(claims *map[string]interface{}, key string) int64
- func GetStringFromClaims(claims *map[string]interface{}, key string) string
- func HasAdminAccess(claims *map[string]interface{}) bool
- func HasRWAccess(claims *map[string]interface{}) bool
- func HasReadAccess(claims *map[string]interface{}) bool
- type InvAuth
- func (s *InvAuth) CreateEntitySchema(ctx context.Context, req *pb.CreateEntitySchemaRequest) (*pb.CreateEntitySchemaResponse, error)
- func (s *InvAuth) CreateFacility(ctx context.Context, req *pb.CreateFacilityRequest) (*pb.CreateFacilityResponse, error)
- func (s *InvAuth) CreateInventoryItem(ctx context.Context, req *pb.CreateInventoryItemRequest) (*pb.CreateInventoryItemResponse, error)
- func (s *InvAuth) CreateItemType(ctx context.Context, req *pb.CreateItemTypeRequest) (*pb.CreateItemTypeResponse, error)
- func (s *InvAuth) CreateProduct(ctx context.Context, req *pb.CreateProductRequest) (*pb.CreateProductResponse, error)
- func (s *InvAuth) CreateSubarea(ctx context.Context, req *pb.CreateSubareaRequest) (*pb.CreateSubareaResponse, error)
- func (s *InvAuth) CreateSubareaType(ctx context.Context, req *pb.CreateSubareaTypeRequest) (*pb.CreateSubareaTypeResponse, error)
- func (s *InvAuth) DeleteEntitySchema(ctx context.Context, req *pb.DeleteEntitySchemaRequest) (*pb.DeleteEntitySchemaResponse, error)
- func (s *InvAuth) DeleteFacility(ctx context.Context, req *pb.DeleteFacilityRequest) (*pb.DeleteFacilityResponse, error)
- func (s *InvAuth) DeleteInventoryItem(ctx context.Context, req *pb.DeleteInventoryItemRequest) (*pb.DeleteInventoryItemResponse, error)
- func (s *InvAuth) DeleteItemType(ctx context.Context, req *pb.DeleteItemTypeRequest) (*pb.DeleteItemTypeResponse, error)
- func (s *InvAuth) DeleteProduct(ctx context.Context, req *pb.DeleteProductRequest) (*pb.DeleteProductResponse, error)
- func (s *InvAuth) DeleteSubarea(ctx context.Context, req *pb.DeleteSubareaRequest) (*pb.DeleteSubareaResponse, error)
- func (s *InvAuth) DeleteSubareaType(ctx context.Context, req *pb.DeleteSubareaTypeRequest) (*pb.DeleteSubareaTypeResponse, error)
- func (s *InvAuth) GetEntitySchema(ctx context.Context, req *pb.GetEntitySchemaRequest) (*pb.GetEntitySchemaResponse, error)
- func (s *InvAuth) GetEntitySchemas(ctx context.Context, req *pb.GetEntitySchemasRequest) (*pb.GetEntitySchemasResponse, error)
- func (s *InvAuth) GetFacilities(ctx context.Context, req *pb.GetFacilitiesRequest) (*pb.GetFacilitiesResponse, error)
- func (s *InvAuth) GetFacility(ctx context.Context, req *pb.GetFacilityRequest) (*pb.GetFacilityResponse, error)
- func (s *InvAuth) GetFacilityWrapper(ctx context.Context, req *pb.GetFacilityWrapperRequest) (*pb.GetFacilityWrapperResponse, error)
- func (s *InvAuth) GetInventoryItem(ctx context.Context, req *pb.GetInventoryItemRequest) (*pb.GetInventoryItemResponse, error)
- func (s *InvAuth) GetInventoryItemsByFacility(ctx context.Context, req *pb.GetInventoryItemsByFacilityRequest) (*pb.GetInventoryItemsByFacilityResponse, error)
- func (s *InvAuth) GetInventoryItemsByProduct(ctx context.Context, req *pb.GetInventoryItemsByProductRequest) (*pb.GetInventoryItemsByProductResponse, error)
- func (s *InvAuth) GetInventoryItemsBySubarea(ctx context.Context, req *pb.GetInventoryItemsBySubareaRequest) (*pb.GetInventoryItemsBySubareaResponse, error)
- func (s *InvAuth) GetItemType(ctx context.Context, req *pb.GetItemTypeRequest) (*pb.GetItemTypeResponse, error)
- func (s *InvAuth) GetItemTypes(ctx context.Context, req *pb.GetItemTypesRequest) (*pb.GetItemTypesResponse, error)
- func (s *InvAuth) GetJwtFromContext(ctx context.Context) (*map[string]interface{}, error)
- func (s *InvAuth) GetProduct(ctx context.Context, req *pb.GetProductRequest) (*pb.GetProductResponse, error)
- func (s *InvAuth) GetProducts(ctx context.Context, req *pb.GetProductsRequest) (*pb.GetProductsResponse, error)
- func (s *InvAuth) GetServerVersion(ctx context.Context, req *pb.GetServerVersionRequest) (*pb.GetServerVersionResponse, error)
- func (s *InvAuth) GetSubarea(ctx context.Context, req *pb.GetSubareaRequest) (*pb.GetSubareaResponse, error)
- func (s *InvAuth) GetSubareaType(ctx context.Context, req *pb.GetSubareaTypeRequest) (*pb.GetSubareaTypeResponse, error)
- func (s *InvAuth) GetSubareaTypes(ctx context.Context, req *pb.GetSubareaTypesRequest) (*pb.GetSubareaTypesResponse, error)
- func (s *InvAuth) GetSubareas(ctx context.Context, req *pb.GetSubareasRequest) (*pb.GetSubareasResponse, error)
- func (s *InvAuth) NewApiServer(gServer *grpc.Server) error
- func (s *InvAuth) SetDatabaseConnection(sqlDB *sql.DB)
- func (s *InvAuth) SetLogger(logger log.Logger)
- func (s *InvAuth) SetPublicKey(publicKeyFile string) error
- func (s *InvAuth) UpdateEntitySchema(ctx context.Context, req *pb.UpdateEntitySchemaRequest) (*pb.UpdateEntitySchemaResponse, error)
- func (s *InvAuth) UpdateFacility(ctx context.Context, req *pb.UpdateFacilityRequest) (*pb.UpdateFacilityResponse, error)
- func (s *InvAuth) UpdateInventoryItem(ctx context.Context, req *pb.UpdateInventoryItemRequest) (*pb.UpdateInventoryItemResponse, error)
- func (s *InvAuth) UpdateItemType(ctx context.Context, req *pb.UpdateItemTypeRequest) (*pb.UpdateItemTypeResponse, error)
- func (s *InvAuth) UpdateProduct(ctx context.Context, req *pb.UpdateProductRequest) (*pb.UpdateProductResponse, error)
- func (s *InvAuth) UpdateSubarea(ctx context.Context, req *pb.UpdateSubareaRequest) (*pb.UpdateSubareaResponse, error)
- func (s *InvAuth) UpdateSubareaType(ctx context.Context, req *pb.UpdateSubareaTypeRequest) (*pb.UpdateSubareaTypeResponse, error)
Constants ¶
This section is empty.
Variables ¶
var NotImplemented = errors.New("not implemented")
Functions ¶
func GetInt64FromClaims ¶
Helper to get a claim value as int64.
func GetStringFromClaims ¶
Helper to get claim value as string.
func HasAdminAccess ¶
Helper to see if JWT provides admin access.
func HasRWAccess ¶
Helper to see if JWT provides read/write access.
func HasReadAccess ¶
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
func (s *InvAuth) CreateEntitySchema(ctx context.Context, req *pb.CreateEntitySchemaRequest) (*pb.CreateEntitySchemaResponse, error)
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
func (s *InvAuth) CreateInventoryItem(ctx context.Context, req *pb.CreateInventoryItemRequest) (*pb.CreateInventoryItemResponse, error)
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
func (s *InvAuth) CreateSubareaType(ctx context.Context, req *pb.CreateSubareaTypeRequest) (*pb.CreateSubareaTypeResponse, error)
create new subarea type
func (*InvAuth) DeleteEntitySchema ¶ added in v0.9.4
func (s *InvAuth) DeleteEntitySchema(ctx context.Context, req *pb.DeleteEntitySchemaRequest) (*pb.DeleteEntitySchemaResponse, error)
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
func (s *InvAuth) DeleteInventoryItem(ctx context.Context, req *pb.DeleteInventoryItemRequest) (*pb.DeleteInventoryItemResponse, error)
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
func (s *InvAuth) DeleteSubareaType(ctx context.Context, req *pb.DeleteSubareaTypeRequest) (*pb.DeleteSubareaTypeResponse, error)
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
func (s *InvAuth) GetEntitySchemas(ctx context.Context, req *pb.GetEntitySchemasRequest) (*pb.GetEntitySchemasResponse, error)
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
func (s *InvAuth) GetFacilityWrapper(ctx context.Context, req *pb.GetFacilityWrapperRequest) (*pb.GetFacilityWrapperResponse, error)
get a facility wrapper by id
func (*InvAuth) GetInventoryItem ¶ added in v0.9.3
func (s *InvAuth) GetInventoryItem(ctx context.Context, req *pb.GetInventoryItemRequest) (*pb.GetInventoryItemResponse, error)
get an inventory item by id
func (*InvAuth) GetInventoryItemsByFacility ¶ added in v0.9.3
func (s *InvAuth) GetInventoryItemsByFacility(ctx context.Context, req *pb.GetInventoryItemsByFacilityRequest) (*pb.GetInventoryItemsByFacilityResponse, error)
get all inventory items in a facility
func (*InvAuth) GetInventoryItemsByProduct ¶ added in v0.9.3
func (s *InvAuth) GetInventoryItemsByProduct(ctx context.Context, req *pb.GetInventoryItemsByProductRequest) (*pb.GetInventoryItemsByProductResponse, error)
get all inventory items for a product id
func (*InvAuth) GetInventoryItemsBySubarea ¶ added in v0.9.3
func (s *InvAuth) GetInventoryItemsBySubarea(ctx context.Context, req *pb.GetInventoryItemsBySubareaRequest) (*pb.GetInventoryItemsBySubareaResponse, error)
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
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
func (s *InvAuth) GetServerVersion(ctx context.Context, req *pb.GetServerVersionRequest) (*pb.GetServerVersionResponse, error)
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 (*InvAuth) SetDatabaseConnection ¶ added in v0.9.3
Set the database connection for the invAuth instance.
func (*InvAuth) SetPublicKey ¶ added in v0.9.3
Set the RSA public key for the invAuth instance to validate the JWT.
func (*InvAuth) UpdateEntitySchema ¶ added in v0.9.4
func (s *InvAuth) UpdateEntitySchema(ctx context.Context, req *pb.UpdateEntitySchemaRequest) (*pb.UpdateEntitySchemaResponse, error)
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
func (s *InvAuth) UpdateInventoryItem(ctx context.Context, req *pb.UpdateInventoryItemRequest) (*pb.UpdateInventoryItemResponse, error)
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
func (s *InvAuth) UpdateSubareaType(ctx context.Context, req *pb.UpdateSubareaTypeRequest) (*pb.UpdateSubareaTypeResponse, error)
update an existing subarea type