rossvideo / Catena

Other
4 stars 0 forks source link

add interceptors to RPCs and apply authorization logic #140

Closed mejohnnaylor closed 2 months ago

mejohnnaylor commented 3 months ago

let's start with GetValue.

expected behavior:

A parameter's access scope is specified by:

How I'd do this...

am = device.default_access_scope;
while (navigating to param) {
   if (param.access_scope isn't an empty string)
     am = param.access_scope;
   if (we navigated to the end of the path)
     navigating to param = false
  else
      param = param[child oid]
}

The main work here is reading up on grpc interceptors and figuring out how to use them. They're basically middleware.

mejohnnaylor commented 3 months ago

... and as middle ware, it'd be good if it could pass some of the work done to the next layer - e.g. the interceptor is going to have to get a ParamAccessor to do it's job, based on the oid in GetValue. This work should be reused, probably by altering the request that gets passed to the next layer to include the relevant ParamAccessor*

mejohnnaylor commented 3 months ago

good progress - need to finish ahead of NAB.

mejohnnaylor commented 2 months ago

@johndanenRV reported that gRPC has better built-in authz features that we should consider using. It works directly in the server context which is much easier than in the interceptor.