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: add mtls support to GoogleNetHttpTransport and GoogleApacheHttpTransport #1619

Merged
merged 33 commits into from Nov 10, 2020
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4205102
feat: add mtls support
arithmetic1728 Oct 23, 2020
fa08020
add run cert command
arithmetic1728 Oct 27, 2020
b2d8891
javanet
arithmetic1728 Oct 30, 2020
c7a0e71
Merge branch 'master' of https://github.com/googleapis/google-api-jav…
arithmetic1728 Oct 30, 2020
79e9ac1
add apache
arithmetic1728 Oct 30, 2020
f860389
update
arithmetic1728 Oct 30, 2020
43655ab
fix test
arithmetic1728 Oct 30, 2020
2849ee7
tmp
arithmetic1728 Oct 30, 2020
46d8973
fix
arithmetic1728 Oct 30, 2020
5e063b3
added tests
arithmetic1728 Oct 31, 2020
dceaacf
add apache
arithmetic1728 Oct 31, 2020
0f4f878
finished apache
arithmetic1728 Oct 31, 2020
9e33fac
doc string
arithmetic1728 Nov 1, 2020
547a6c5
Merge branch 'master' of https://github.com/googleapis/google-api-jav…
arithmetic1728 Nov 4, 2020
0442025
update code
arithmetic1728 Nov 4, 2020
d83c115
lint
arithmetic1728 Nov 4, 2020
d92d3b3
refactor: implement MtlsUtils.MtlsProvider interface with default imp…
chingor13 Nov 5, 2020
aa72510
Merge pull request #1 from chingor13/mtls-refactor
arithmetic1728 Nov 5, 2020
05e052c
refactor mtls to a module
arithmetic1728 Nov 5, 2020
312e73a
rename
arithmetic1728 Nov 5, 2020
5209bec
fix exceptions
arithmetic1728 Nov 5, 2020
1edf060
add timeout
arithmetic1728 Nov 6, 2020
daeb967
fix util test
arithmetic1728 Nov 6, 2020
a3cea68
Merge pull request #3 from arithmetic1728/refactor
arithmetic1728 Nov 6, 2020
377f944
add tests
arithmetic1728 Nov 6, 2020
533c76e
lint
arithmetic1728 Nov 6, 2020
9ad39a5
make constructor public
arithmetic1728 Nov 6, 2020
47f8c07
lint
arithmetic1728 Nov 6, 2020
7bf8d8c
make constructor public
arithmetic1728 Nov 6, 2020
55d4eb5
update
arithmetic1728 Nov 9, 2020
46dd6b8
use bigger try catch block
arithmetic1728 Nov 9, 2020
9eee919
update code
arithmetic1728 Nov 10, 2020
5593a90
Update google-api-client/src/main/java/com/google/api/client/googleap…
arithmetic1728 Nov 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -81,33 +81,26 @@ public String getKeyStorePassword() {

@Override
public KeyStore getKeyStore() throws IOException, GeneralSecurityException {
// Load the cert provider command from the json file.
InputStream stream;
try {
stream = new FileInputStream(metadataPath);
// Load the cert provider command from the json file.
InputStream stream = new FileInputStream(metadataPath);
List<String> command = extractCertificateProviderCommand(stream);

// Run the command and timeout after 1000 milliseconds.
Process process = new ProcessBuilder(command).start();
int exitCode = runCertificateProviderCommand(process, 1000);
if (exitCode != 0) {
throw new IOException(String.format("Failed to execute cert provider command with exit code: %d", exitCode));
arithmetic1728 marked this conversation as resolved.
Show resolved Hide resolved
}

// Create mTLS key store with the input certificates from shell command.
return SecurityUtils.createMtlsKeyStore(process.getInputStream());
} catch (FileNotFoundException ignored) {
// file doesn't exist
return null;
}

List<String> command = extractCertificateProviderCommand(stream);

// Call the command.
Process process = new ProcessBuilder(command).start();
int exitCode = -1;
try {
// Run the command and timeout after 1000 milliseconds.
exitCode = runCertificateProviderCommand(process, 1000);
} catch (InterruptedException e) {
throw new IOException("Interrupted executing certificate provider command", e);
}
if (exitCode != 0) {
throw new IOException(
String.format("Failed to execute cert provider command with exit code: %d", exitCode));
}

// Parse input certificates from shell command
return SecurityUtils.createMtlsKeyStore(process.getInputStream());
}

@VisibleForTesting
Expand Down