Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: self signed jwt support #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions google-cloud-kms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
<site.installationModule>google-cloud-kms</site.installationModule>
</properties>
<dependencies>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
<version>1.60.1</version>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
<version>1.60.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-api</artifactId>
Expand Down Expand Up @@ -50,14 +60,6 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax-grpc</artifactId>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public static List<String> getDefaultServiceScopes() {

/** Returns a builder for the default credentials for this service. */
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES);
return GoogleCredentialsProvider.newBuilder().setDefaultScopes(DEFAULT_SERVICE_SCOPES).setScopesToApply(ImmutableList.<String>of());
}

/** Returns a builder for the default ChannelProvider for this service. */
Expand Down Expand Up @@ -854,6 +854,7 @@ private static Builder createDefault() {
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setDefaultEndpoint(getDefaultEndpoint());
return initDefaults(builder);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud.kms.v1;

import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListKeyRingsPagedResponse;

import com.google.common.collect.Lists;

import java.util.List;
import org.junit.Test;

public class SampleTest {

@Test
public void myTest() throws Exception {
KeyManagementServiceSettings settings = KeyManagementServiceSettings.newBuilder().build();
KeyManagementServiceClient client = KeyManagementServiceClient.create(settings);
String project = "projects/shinfan-mtls-demo/locations/global";
// project = "projects/study-auth-265119/locations/global";

ListKeyRingsPagedResponse resp = client.listKeyRings(project);
List<KeyRing> resources = Lists.newArrayList(resp.iterateAll());
System.out.println(resources);
}
}