feat: implemented MakeUserAccountCredentials#16090
feat: implemented MakeUserAccountCredentials#16090sachinpro wants to merge 1 commit intogoogleapis:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for user account credentials by adding the MakeUserAccountCredentials factory function and the AuthorizedUserConfig class. The changes include updates to the credential visitor pattern, implementation of REST transport support, and explicit handling for gRPC transport which currently returns an unimplemented error. Feedback was provided regarding a potential issue in unified_rest_credentials.cc where the unspecified order of evaluation for function arguments could result in using a moved-from client_factory_ object.
| result = Decorate( | ||
| std::make_shared<oauth2_internal::AuthorizedUserCredentials>( | ||
| *info, cfg.options(), client_factory_), | ||
| std::move(client_factory_), cfg.options()); |
There was a problem hiding this comment.
The order of evaluation for function arguments is unspecified in C++. In this statement, std::move(client_factory_) might be evaluated before client_factory_ is passed to std::make_shared, which would result in an empty or invalid factory being used to create the credentials. It is safer to create the credentials object in a separate statement to ensure the factory is copied before it is moved into the Decorate function.
auto creds = std::make_shared<oauth2_internal::AuthorizedUserCredentials>(
*info, cfg.options(), client_factory_);
result = Decorate(std::move(creds), std::move(client_factory_),
cfg.options());3e42a37 to
798a51b
Compare
798a51b to
6f551a7
Compare
The C++ SDK function
MakeServiceAccountCredentialsthrowsInvalid ServiceAccountCredentials, the client_email field is missing on data loaded from memoryfor a json withauthorized_user.The PR implements
MakeUserAccountCredentials, a dedicated option forauthorized_usercredentials.