Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add mtls support to GoogleNetHttpTransport and GoogleApacheHttp…
…Transport (#1619)
- Loading branch information
1 parent
5f9780a
commit 1d8304c
Showing
14 changed files
with
775 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...-client/src/main/java/com/google/api/client/googleapis/mtls/ContextAwareMetadataJson.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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 | ||
* | ||
* http://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.api.client.googleapis.mtls; | ||
|
||
import java.util.List; | ||
|
||
import com.google.api.client.json.GenericJson; | ||
import com.google.api.client.util.Beta; | ||
import com.google.api.client.util.Key; | ||
|
||
/** | ||
* {@link Beta} <br> | ||
* Data class representing context_aware_metadata.json file. | ||
* | ||
* @since 1.31 | ||
*/ | ||
@Beta | ||
public class ContextAwareMetadataJson extends GenericJson { | ||
/** Cert provider command */ | ||
@Key("cert_provider_command") | ||
private List<String> commands; | ||
|
||
/** | ||
* Returns the cert provider command. | ||
* | ||
* @since 1.31 | ||
*/ | ||
public final List<String> getCommands() { | ||
return commands; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
google-api-client/src/main/java/com/google/api/client/googleapis/mtls/MtlsProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* 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 | ||
* | ||
* http://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.api.client.googleapis.mtls; | ||
|
||
import com.google.api.client.util.Beta; | ||
import java.io.IOException; | ||
import java.security.GeneralSecurityException; | ||
import java.security.KeyStore; | ||
|
||
/** | ||
* {@link Beta} <br> | ||
* Provider interface for mutual TLS. It is used in {@link | ||
* GoogleApacheHttpTransport#newTrustedTransport(MtlsProvider)} and {@link | ||
* GoogleNetHttpTransport#newTrustedTransport(MtlsProvider)} to configure the mutual TLS in the | ||
* transport. | ||
* | ||
* @since 1.31 | ||
*/ | ||
@Beta | ||
public interface MtlsProvider { | ||
/** | ||
* Returns if mutual TLS client certificate should be used. If the value is true, the key store | ||
* from {@link #getKeyStore()} and key store password from {@link #getKeyStorePassword()} will be | ||
* used to configure mutual TLS transport. | ||
*/ | ||
boolean useMtlsClientCertificate(); | ||
|
||
/** The key store to use for mutual TLS. */ | ||
String getKeyStorePassword(); | ||
|
||
/** The password for mutual TLS key store. */ | ||
KeyStore getKeyStore() throws IOException, GeneralSecurityException; | ||
} |
Oops, something went wrong.