On Fri, May 19, 2017 at 3:22 PM, Benoit Sigoure <[email protected]> wrote:

> In Foo(), I authenticate the client using a user/password passed as
> metadata before executing the FooRequest.  Authenticating the client
> each time is expensive, so I want to remember somewhere that I already
> authenticated this client (for this discussion let’s ignore security
> considerations like caching policy etc).


I'd suggest caching the authentication result and check the cache each
request. The client is not aware when a new connection is used and binding
the authentication to the connection breaks some proxying models. We
purposefully do not support this.

(Now, if you needed some information to make the cache usages faster, that
we could entertain. But each request must be authenticated separately
except for transport-level authentication, like TLS client certificates.)

I can’t return a session ID
> or something like that to the client, I just receive the user/pass
> each time.
>

Well, you can, but gRPC won't help the client to pass that value in the
future. It would generally be discouraged.

My thinking was to cache this information somewhere in the transport,
> but there’s a small twist: I need to clean up something whenever the
> transport goes down.  I can’t tie this to the Stream because this is
> not a streaming RPC so each call to Foo() has its own single-use
> stream in the context.  I can get access to the transport
> (*transport.http2Server), but I can’t access its private shutdownChan
> to wait for the transport to be closed.
>
> So what’s the best way (if any) to tie something to the lifetime to
> the transport?
>

What sort of thing do you need to clean up? Like removing an ID from a map?

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CA%2B4M1oMRmB9Wh3vPy%3DRKwVuC-QV9m7Mau8JJYB-witvq7YsXjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to