@@ -35,7 +35,7 @@ auto const kSelfSignedJwtEnvVar =
3535 " GOOGLE_CLOUD_CPP_EXPERIMENTAL_DISABLE_SELF_SIGNED_JWT" ;
3636
3737StatusRecordOr<std::shared_ptr<Credentials>> CreateServiceCredentials (
38- std::string const & credentials_file_path) {
38+ std::string const & credentials_file_path, Options const & options ) {
3939 if (credentials_file_path.empty ()) {
4040 LOG (ERROR )
4141 << " CreateServiceCredentials:: The path to the file can't be empty" ;
@@ -73,19 +73,19 @@ StatusRecordOr<std::shared_ptr<Credentials>> CreateServiceCredentials(
7373 credentials_file_path};
7474 }
7575
76- return ::google::cloud::MakeServiceAccountCredentials (contents);
76+ return ::google::cloud::MakeServiceAccountCredentials (contents, options );
7777}
7878
7979StatusRecordOr<std::shared_ptr<Credentials>>
80- CreateApplicationDefaultCredentials () {
80+ CreateApplicationDefaultCredentials (Options const & options ) {
8181 // C++ client library in google-cloud-cpp first checks
8282 // GOOGLE_APPLICATION_CREDENTIALS env var and use it if it's present. Then it
8383 // looks for a 'default' location of the file with credentials.
84- return ::google::cloud::MakeGoogleDefaultCredentials ();
84+ return ::google::cloud::MakeGoogleDefaultCredentials (options );
8585}
8686
8787StatusRecordOr<std::shared_ptr<Credentials>> CreateExternalAuthCredentialsJSON (
88- std::string const & credentials_file_path) {
88+ std::string const & credentials_file_path, Options const & options ) {
8989 if (credentials_file_path.empty ()) {
9090 LOG (ERROR ) << " CreateExternalAuthCredentialsJSON:: The path to the "
9191 " external auth JSON file can't be empty" ;
@@ -117,7 +117,7 @@ StatusRecordOr<std::shared_ptr<Credentials>> CreateExternalAuthCredentialsJSON(
117117 credentials_file_path};
118118 }
119119
120- return ::google::cloud::MakeExternalAccountCredentials (contents);
120+ return ::google::cloud::MakeExternalAccountCredentials (contents, options );
121121}
122122
123123StatusRecordOr<nlohmann::json> CreateJsonCredsObject (
@@ -140,7 +140,8 @@ StatusRecordOr<nlohmann::json> CreateJsonCredsObject(
140140}
141141
142142StatusRecordOr<std::shared_ptr<Credentials>>
143- CreateExternalAccountAuthenticationBYOID (Oauth const & oauth) {
143+ CreateExternalAccountAuthenticationBYOID (Oauth const & oauth,
144+ Options const & options) {
144145 if (!IsBYOIDPropsSet (oauth)) {
145146 LOG (ERROR )
146147 << " CreateExternalAccountAuthenticationBYOID:: Unable to create "
@@ -158,23 +159,25 @@ CreateExternalAccountAuthenticationBYOID(Oauth const& oauth) {
158159 << json_creds.GetStatusRecord ().message ;
159160 return json_creds.GetStatusRecord ();
160161 }
161- return ::google::cloud::MakeExternalAccountCredentials ((*json_creds).dump ());
162+ return ::google::cloud::MakeExternalAccountCredentials ((*json_creds).dump (),
163+ options);
162164}
163165
164166StatusRecordOr<std::shared_ptr<Credentials>> CreateCredentials (
165- Oauth const & oauth) {
167+ Oauth const & oauth, Options const & options ) {
166168 switch (oauth.auth_mechanism ) {
167169 case OauthMechanism::kServiceAndUserAccount :
168- return CreateServiceCredentials (oauth.credentials_file_path );
170+ return CreateServiceCredentials (oauth.credentials_file_path , options );
169171 case OauthMechanism::kApplicationDefault :
170- return CreateApplicationDefaultCredentials ();
172+ return CreateApplicationDefaultCredentials (options );
171173 case OauthMechanism::kExternalUser : {
172174 if (!IsBYOIDPropsSet (oauth)) {
173175 // Call creation of external auth via JSON file
174- return CreateExternalAuthCredentialsJSON (oauth.credentials_file_path );
176+ return CreateExternalAuthCredentialsJSON (oauth.credentials_file_path ,
177+ options);
175178 }
176179 // Call creation of external auth via BYOID properties.
177- return CreateExternalAccountAuthenticationBYOID (oauth);
180+ return CreateExternalAccountAuthenticationBYOID (oauth, options );
178181 }
179182 }
180183 LOG (ERROR ) << " CreateCredentials:: OauthMechanism enum is invalid" ;
0 commit comments