grpc c++ custom audience

93 views
Skip to first unread message

Bogdan Dinulica

unread,
Apr 8, 2020, 4:51:38 PM4/8/20
to grpc.io
Hi,

I'm using a grpc c++ client to make calls to a grpc serve using Google token based authentication.
 The problem that I'm facing is that the grpc c++ library assumes that the audience is based on service address and service name:
while the service uses the default Cloud Endpoints audience of the form
https://service.endpoints.project.cloud.goog

Looking at the code seems that my only options are:
1) have the service owner add the audience that the grpc c++ library uses
2) use the MetadataCredentialsPlugin and generate the token in the GetMetadata (basically, have the same implementation as the library but use the right audience).

Am I missing something, is there any other way around?

Thanks,
Bogdan

Jiangtao Li

unread,
Jul 23, 2020, 6:21:41 PM7/23/20
to grpc.io
Bogdan,

Could you please point me the code where "the grpc c++ library assumes that the audience is based on service address and service name"?

Bogdan Dinulica

unread,
Jul 23, 2020, 8:15:18 PM7/23/20
to Jiangtao Li, grpc.io

grpc_service_account_jwt_access_credentials::get_request_metadata 

calls 

jwt = grpc_jwt_encode_and_sign(&key_, context.service_url, jwt_lifetime_, nullptr);

https://github.com/grpc/grpc/blob/79c129472060b4142be97aba62c37d19cc79d5a8/src/core/lib/security/credentials/jwt/jwt_credentials.cc#L86

and the second parameter (context.service_url) is the audience

char* grpc_jwt_encode_and_sign(const grpc_auth_json_key* json_key, const char* audience, gpr_timespec token_lifetime, const char* scope)




--
You received this message because you are subscribed to a topic in the Google Groups "grpc.io" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/grpc-io/o0Kkwc2JDa4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/df28c885-2b42-4e88-8c7d-701190af9789n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages