I'm looking into how to support client connections to disparate services 
using custom oAuth2 tokens. The services may or may not support SSL/TLS.

I have created a custom authenticator plugin following the sample code 
at https://grpc.io/docs/guides/auth.html.

I build my custom call credentials and store them using a 
CompositeChannelCredientials object

auto call_creds = 
grpc::MetadataCredentialsFromPlugin(std::unique_ptr<grpc::MetadataCredentialsPlugin>(new
 
MyCustomAuthenticator(accessToken)));

if (secure)
    mCredentials = 
grpc::CompositeChannelCredentials(grpc::SslCredentials(opts), call_creds);
else
    mCredentials = 
grpc::CompositeChannelCredentials(grpc::InsecureChannelCredentials(), 
call_creds);

However, I noticed during debugging that mCredentials is nullptr when 
connecting to a service that doesn't support SSL/TLS. It looks like 
CompositeChannelCredentials attempts to cast the InsecureChannelCredentials 
to SecureChannelCredentials, with this cast returning NULL.

Is there any documentation or sample code of how to make an authenticated 
call over an insecure channel? Is this something that's currently supported 
in the C++ API?

-- 
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/02cc8891-fac1-4101-9aad-938772f8b59e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to