We just added the CallCredentials
<https://github.com/grpc/grpc-java/blob/master/core/src/main/java/io/grpc/CallCredentials.java>,
which writes credentials to the headers.

The client can do:
stub.withCallCredentials(creds).foo(req);

The server needs to use a ServerInterceptor to extract the creds from the
headers and put in the Context
<https://github.com/grpc/grpc-java/blob/master/core/src/main/java/io/grpc/Context.java>,
then the service handler can read it from the Context.

On Thu, Jun 16, 2016 at 12:32 PM, 'Xiao Hang (杭啸)' via grpc.io <
[email protected]> wrote:

> You can create a interceptor to do so.  
> MetadataUtils.newAttachHeadersInterceptor
> should work for you.
>
> On Thu, Jun 16, 2016 at 12:25 PM, Min Yao <[email protected]>
> wrote:
>
>> Hi Yang and Kun,
>>      I am Min Yao from Luminate Wireless Inc.. We have used gRPC in our
>> projects. Currently we have an application case, where many users share a
>> stub to send rpc requests with per user's credential carried on request
>> metadata. It is easy to achieve this in grpc C++ since the user can add the
>> credential to ClientContext and server can fetch the credential from
>> ServerContext. However, grpc-java doesn't provide the method to add each
>> user's credential to each rpc request metadata. Is there a good way to
>> solve this problem? Thanks.
>>
>> Best regard,
>>     Min Yao
>>
>> --
>> 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].
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/grpc-io/CAPVo65Ds3EfE%2B%3DiN-weTTKZnVJwRKez7b_wc3g-wdh
>> 8O0EjtOA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/grpc-io/CAPVo65Ds3EfE%2B%3DiN-weTTKZnVJwRKez7b_wc3g-wdh8O0EjtOA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> rocking
>
> --
> 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].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/grpc-io/CAF45zmmkK9wcY%2BBhi6SFg3%2BJSKOAwwG%
> 3DDb0H0s6UZMO2gQbAzA%40mail.gmail.com
> <https://groups.google.com/d/msgid/grpc-io/CAF45zmmkK9wcY%2BBhi6SFg3%2BJSKOAwwG%3DDb0H0s6UZMO2gQbAzA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
- Kun

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAAyQuKx5rWZFr0wc-9aO7CDC%3DpK9z-YZ6YxMrcAGAhX%2BNvcsqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to