You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/12/12 08:45:51 UTC

[camel] branch main updated: CAMEL-17322 Set scopes on Google Pubsub Credentials (#6527)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new dcc7024  CAMEL-17322 Set scopes on Google Pubsub Credentials (#6527)
dcc7024 is described below

commit dcc7024133e9bffd49fe9452f1e1cba4c35b856a
Author: Preben Asmussen <pr...@dr.dk>
AuthorDate: Sun Dec 12 09:45:10 2021 +0100

    CAMEL-17322 Set scopes on Google Pubsub Credentials (#6527)
---
 .../apache/camel/component/google/pubsub/GooglePubsubComponent.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubComponent.java b/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubComponent.java
index 7a49337..f6cb6b8 100644
--- a/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubComponent.java
+++ b/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubComponent.java
@@ -37,6 +37,7 @@ import com.google.auth.oauth2.ServiceAccountCredentials;
 import com.google.cloud.pubsub.v1.MessageReceiver;
 import com.google.cloud.pubsub.v1.Publisher;
 import com.google.cloud.pubsub.v1.Subscriber;
+import com.google.cloud.pubsub.v1.stub.PublisherStubSettings;
 import com.google.cloud.pubsub.v1.stub.SubscriberStub;
 import com.google.cloud.pubsub.v1.stub.SubscriberStubSettings;
 import com.google.common.cache.Cache;
@@ -220,7 +221,8 @@ public class GooglePubsubComponent extends DefaultComponent {
         if (endpoint.isAuthenticate()) {
             credentialsProvider = FixedCredentialsProvider.create(ObjectHelper.isEmpty(endpoint.getServiceAccountKey())
                     ? GoogleCredentials.getApplicationDefault() : ServiceAccountCredentials.fromStream(ResourceHelper
-                            .resolveMandatoryResourceAsInputStream(getCamelContext(), endpoint.getServiceAccountKey())));
+                            .resolveMandatoryResourceAsInputStream(getCamelContext(), endpoint.getServiceAccountKey()))
+                            .createScoped(PublisherStubSettings.getDefaultServiceScopes()));
         } else {
             credentialsProvider = NoCredentialsProvider.create();
         }