I am implementing a service in CapnProto. The service follows these steps (roughly):
- authenticate on the server
- do operations through a Service interface (object-capability) once authenticated.
I want to achieve something like the following:
interface Authorization {
login @0 (userName :User) -> (result :Service);
}
interface Service {
# doOperation needs userName in order to operate, as an implicit
# parameter, when the RPC arrives. I do not want to use an explicit
# userName parameter. Otherwise, a user could claim to
# be someone else in a function parameter. To achieve this I need
# to know who is the userName that holds this capability from inside
# doOperation. I want to avoid token authentication
# for each operation.
# Thus, the RPC I am implementing is stateful.
doOperation @0 (param1 :A);
#...
}
What I want is, that from doOperation, I can identify the user that is using that capability (I want to know her userName). Namely:
What I have solved is that the user using the Service capability is known to have that permission (since the Service is the result of calling login)
The problem is that I have many of those users, and, for each of them, I want to do the matching between the user of the Service capability and her login in the first step.