diff --git a/appengine/pom.xml b/appengine/pom.xml index 00b623f07..4bd7dae82 100644 --- a/appengine/pom.xml +++ b/appengine/pom.xml @@ -20,8 +20,6 @@ - java - javatests org.apache.maven.plugins diff --git a/appengine/java/com/google/auth/appengine/AppEngineCredentials.java b/appengine/src/main/java/com/google/auth/appengine/AppEngineCredentials.java similarity index 100% rename from appengine/java/com/google/auth/appengine/AppEngineCredentials.java rename to appengine/src/main/java/com/google/auth/appengine/AppEngineCredentials.java diff --git a/appengine/javatests/com/google/auth/appengine/AppEngineCredentialsTest.java b/appengine/src/test/java/com/google/auth/appengine/AppEngineCredentialsTest.java similarity index 100% rename from appengine/javatests/com/google/auth/appengine/AppEngineCredentialsTest.java rename to appengine/src/test/java/com/google/auth/appengine/AppEngineCredentialsTest.java diff --git a/appengine/javatests/com/google/auth/appengine/MockAppIdentityService.java b/appengine/src/test/java/com/google/auth/appengine/MockAppIdentityService.java similarity index 100% rename from appengine/javatests/com/google/auth/appengine/MockAppIdentityService.java rename to appengine/src/test/java/com/google/auth/appengine/MockAppIdentityService.java diff --git a/appengine/src/test/resources/junit-platform.properties b/appengine/src/test/resources/junit-platform.properties new file mode 100644 index 000000000..82de190bf --- /dev/null +++ b/appengine/src/test/resources/junit-platform.properties @@ -0,0 +1,2 @@ +junit.jupiter.execution.parallel.enabled = true +junit.jupiter.execution.parallel.mode.default = concurrent \ No newline at end of file diff --git a/cab-token-generator/pom.xml b/cab-token-generator/pom.xml index b044a6fb6..57e1e924b 100644 --- a/cab-token-generator/pom.xml +++ b/cab-token-generator/pom.xml @@ -12,11 +12,6 @@ google-auth-library-cab-token-generator Google Auth Library for Java - Cab Token Generator - - java - javatests - - diff --git a/cab-token-generator/java/com/google/auth/credentialaccessboundary/ClientSideCredentialAccessBoundaryFactory.java b/cab-token-generator/src/main/java/com/google/auth/credentialaccessboundary/ClientSideCredentialAccessBoundaryFactory.java similarity index 100% rename from cab-token-generator/java/com/google/auth/credentialaccessboundary/ClientSideCredentialAccessBoundaryFactory.java rename to cab-token-generator/src/main/java/com/google/auth/credentialaccessboundary/ClientSideCredentialAccessBoundaryFactory.java diff --git a/cab-token-generator/java/com/google/auth/credentialaccessboundary/protobuf/ClientSideAccessBoundaryProto.java b/cab-token-generator/src/main/java/com/google/auth/credentialaccessboundary/protobuf/ClientSideAccessBoundaryProto.java similarity index 98% rename from cab-token-generator/java/com/google/auth/credentialaccessboundary/protobuf/ClientSideAccessBoundaryProto.java rename to cab-token-generator/src/main/java/com/google/auth/credentialaccessboundary/protobuf/ClientSideAccessBoundaryProto.java index 307f8bde9..88b3e7cb2 100644 --- a/cab-token-generator/java/com/google/auth/credentialaccessboundary/protobuf/ClientSideAccessBoundaryProto.java +++ b/cab-token-generator/src/main/java/com/google/auth/credentialaccessboundary/protobuf/ClientSideAccessBoundaryProto.java @@ -1,3 +1,33 @@ +/* + * Copyright 2025 Google LLC + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: client_side_access_boundary.proto diff --git a/cab-token-generator/javatests/com/google/auth/credentialaccessboundary/ClientSideCredentialAccessBoundaryFactoryTest.java b/cab-token-generator/src/test/java/com/google/auth/credentialaccessboundary/ClientSideCredentialAccessBoundaryFactoryTest.java similarity index 99% rename from cab-token-generator/javatests/com/google/auth/credentialaccessboundary/ClientSideCredentialAccessBoundaryFactoryTest.java rename to cab-token-generator/src/test/java/com/google/auth/credentialaccessboundary/ClientSideCredentialAccessBoundaryFactoryTest.java index c42c15af5..e5d72bc5d 100644 --- a/cab-token-generator/javatests/com/google/auth/credentialaccessboundary/ClientSideCredentialAccessBoundaryFactoryTest.java +++ b/cab-token-generator/src/test/java/com/google/auth/credentialaccessboundary/ClientSideCredentialAccessBoundaryFactoryTest.java @@ -71,11 +71,14 @@ import java.util.concurrent.CountDownLatch; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.Execution; +import org.junit.jupiter.api.parallel.ExecutionMode; /** * Tests for {@link * com.google.auth.credentialaccessboundary.ClientSideCredentialAccessBoundaryFactory}. */ +@Execution(ExecutionMode.SAME_THREAD) class ClientSideCredentialAccessBoundaryFactoryTest { private static final String SA_PRIVATE_KEY_PKCS8 = "-----BEGIN PRIVATE KEY-----\n" diff --git a/cab-token-generator/javatests/com/google/auth/credentialaccessboundary/ITClientSideCredentialAccessBoundaryTest.java b/cab-token-generator/src/test/java/com/google/auth/credentialaccessboundary/ITClientSideCredentialAccessBoundaryTest.java similarity index 100% rename from cab-token-generator/javatests/com/google/auth/credentialaccessboundary/ITClientSideCredentialAccessBoundaryTest.java rename to cab-token-generator/src/test/java/com/google/auth/credentialaccessboundary/ITClientSideCredentialAccessBoundaryTest.java diff --git a/credentials/pom.xml b/credentials/pom.xml index 225b77bc7..a23a4318e 100644 --- a/credentials/pom.xml +++ b/credentials/pom.xml @@ -19,8 +19,6 @@ - java - javatests org.apache.maven.plugins diff --git a/credentials/java/com/google/auth/ApiKeyCredentials.java b/credentials/src/main/java/com/google/auth/ApiKeyCredentials.java similarity index 100% rename from credentials/java/com/google/auth/ApiKeyCredentials.java rename to credentials/src/main/java/com/google/auth/ApiKeyCredentials.java diff --git a/credentials/java/com/google/auth/CredentialTypeForMetrics.java b/credentials/src/main/java/com/google/auth/CredentialTypeForMetrics.java similarity index 100% rename from credentials/java/com/google/auth/CredentialTypeForMetrics.java rename to credentials/src/main/java/com/google/auth/CredentialTypeForMetrics.java diff --git a/credentials/java/com/google/auth/Credentials.java b/credentials/src/main/java/com/google/auth/Credentials.java similarity index 100% rename from credentials/java/com/google/auth/Credentials.java rename to credentials/src/main/java/com/google/auth/Credentials.java diff --git a/credentials/java/com/google/auth/RequestMetadataCallback.java b/credentials/src/main/java/com/google/auth/RequestMetadataCallback.java similarity index 100% rename from credentials/java/com/google/auth/RequestMetadataCallback.java rename to credentials/src/main/java/com/google/auth/RequestMetadataCallback.java diff --git a/credentials/java/com/google/auth/Retryable.java b/credentials/src/main/java/com/google/auth/Retryable.java similarity index 100% rename from credentials/java/com/google/auth/Retryable.java rename to credentials/src/main/java/com/google/auth/Retryable.java diff --git a/credentials/java/com/google/auth/ServiceAccountSigner.java b/credentials/src/main/java/com/google/auth/ServiceAccountSigner.java similarity index 100% rename from credentials/java/com/google/auth/ServiceAccountSigner.java rename to credentials/src/main/java/com/google/auth/ServiceAccountSigner.java diff --git a/credentials/javatests/com/google/auth/ApiKeyCredentialsTest.java b/credentials/src/test/java/com/google/auth/ApiKeyCredentialsTest.java similarity index 100% rename from credentials/javatests/com/google/auth/ApiKeyCredentialsTest.java rename to credentials/src/test/java/com/google/auth/ApiKeyCredentialsTest.java diff --git a/credentials/javatests/com/google/auth/SigningExceptionTest.java b/credentials/src/test/java/com/google/auth/SigningExceptionTest.java similarity index 100% rename from credentials/javatests/com/google/auth/SigningExceptionTest.java rename to credentials/src/test/java/com/google/auth/SigningExceptionTest.java diff --git a/credentials/src/test/resources/junit-platform.properties b/credentials/src/test/resources/junit-platform.properties new file mode 100644 index 000000000..82de190bf --- /dev/null +++ b/credentials/src/test/resources/junit-platform.properties @@ -0,0 +1,2 @@ +junit.jupiter.execution.parallel.enabled = true +junit.jupiter.execution.parallel.mode.default = concurrent \ No newline at end of file diff --git a/java.header b/java.header index 142fa6b5c..44d9e18f0 100644 --- a/java.header +++ b/java.header @@ -1,5 +1,5 @@ ^/\*$ -^ \* Copyright \d\d\d\d, Google (Inc\. All rights reserved\.|LLC)$ +^ \* Copyright \d\d\d\d,? Google (Inc\. All rights reserved\.|LLC)$ ^ \*$ ^ \* Redistribution and use in source and binary forms, with or without$ ^ \* modification, are permitted provided that the following conditions are$ @@ -27,4 +27,4 @@ ^ \* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT$ ^ \* \(INCLUDING NEGLIGENCE OR OTHERWISE\) ARISING IN ANY WAY OUT OF THE USE$ ^ \* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\.$ -^ \*/$ +^ \*/$ \ No newline at end of file diff --git a/oauth2_http/java/com/google/auth/oauth2/EnvironmentProvider.java b/oauth2_http/java/com/google/auth/oauth2/EnvironmentProvider.java deleted file mode 100644 index 5c77ecc65..000000000 --- a/oauth2_http/java/com/google/auth/oauth2/EnvironmentProvider.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.google.auth.oauth2; - -/** Interface for an environment provider. */ -interface EnvironmentProvider { - String getEnv(String name); -} diff --git a/oauth2_http/java/com/google/auth/oauth2/SystemEnvironmentProvider.java b/oauth2_http/java/com/google/auth/oauth2/SystemEnvironmentProvider.java deleted file mode 100644 index a29707721..000000000 --- a/oauth2_http/java/com/google/auth/oauth2/SystemEnvironmentProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.google.auth.oauth2; - -import java.io.Serializable; - -/** Represents the default system environment provider. */ -class SystemEnvironmentProvider implements EnvironmentProvider, Serializable { - static final SystemEnvironmentProvider INSTANCE = new SystemEnvironmentProvider(); - private static final long serialVersionUID = -4698164985883575244L; - - private SystemEnvironmentProvider() {} - - @Override - public String getEnv(String name) { - return System.getenv(name); - } - - public static SystemEnvironmentProvider getInstance() { - return INSTANCE; - } -} diff --git a/oauth2_http/javatests/com/google/auth/oauth2/GdchCredentialsTestUtil.java b/oauth2_http/javatests/com/google/auth/oauth2/GdchCredentialsTestUtil.java deleted file mode 100644 index 76385a5e8..000000000 --- a/oauth2_http/javatests/com/google/auth/oauth2/GdchCredentialsTestUtil.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.google.auth.oauth2; - -import com.google.api.client.testing.http.FixedClock; -import java.io.IOException; -import java.net.URI; -import java.util.Map; - -class GdchCredentialsTestUtil { - public static void registerGdchCredentialWithMockTransport( - GdchCredentials credentials, - MockTokenServerTransport transport, - String projectId, - String serviceIdentityName, - String tokenString, - URI tokenServerUri) { - credentials.clock = new FixedClock(0L); - transport.addGdchServiceAccount( - GdchCredentials.getIssuerSubjectValue(projectId, serviceIdentityName), tokenString); - transport.setTokenServerUri(tokenServerUri); - } - - public static GdchCredentials fromJson( - Map json, MockTokenServerTransportFactory transportFactory) - throws IOException { - return GdchCredentials.fromJson(json, transportFactory); - } -} diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MockHttpTransportFactory.java b/oauth2_http/javatests/com/google/auth/oauth2/MockHttpTransportFactory.java deleted file mode 100644 index 00976e00f..000000000 --- a/oauth2_http/javatests/com/google/auth/oauth2/MockHttpTransportFactory.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.google.auth.oauth2; - -import com.google.api.client.http.HttpTransport; -import com.google.api.client.testing.http.MockHttpTransport; -import com.google.auth.http.HttpTransportFactory; - -public class MockHttpTransportFactory implements HttpTransportFactory { - - MockHttpTransport transport = new MockHttpTransport(); - - @Override - public HttpTransport create() { - return transport; - } -} diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MockTokenServerTransportFactory.java b/oauth2_http/javatests/com/google/auth/oauth2/MockTokenServerTransportFactory.java deleted file mode 100644 index a1d5831ad..000000000 --- a/oauth2_http/javatests/com/google/auth/oauth2/MockTokenServerTransportFactory.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.google.auth.oauth2; - -import com.google.api.client.http.HttpTransport; -import com.google.auth.http.HttpTransportFactory; - -public class MockTokenServerTransportFactory implements HttpTransportFactory { - - public MockTokenServerTransport transport = new MockTokenServerTransport(); - - @Override - public HttpTransport create() { - return transport; - } -} diff --git a/oauth2_http/javatests/com/google/auth/oauth2/TestEnvironmentProvider.java b/oauth2_http/javatests/com/google/auth/oauth2/TestEnvironmentProvider.java deleted file mode 100644 index 9e6de1108..000000000 --- a/oauth2_http/javatests/com/google/auth/oauth2/TestEnvironmentProvider.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.google.auth.oauth2; - -import java.util.HashMap; -import java.util.Map; - -final class TestEnvironmentProvider implements EnvironmentProvider { - - private final Map environmentVariables = new HashMap<>(); - - @Override - public String getEnv(String name) { - return environmentVariables.get(name); - } - - public TestEnvironmentProvider setEnv(String name, String value) { - environmentVariables.put(name, value); - return this; - } -} diff --git a/oauth2_http/pom.xml b/oauth2_http/pom.xml index 92bdc6a94..2b32eb850 100644 --- a/oauth2_http/pom.xml +++ b/oauth2_http/pom.xml @@ -130,19 +130,12 @@ - java - resources + src/main/resources true - javatests - - - testresources - - org.apache.maven.plugins diff --git a/oauth2_http/java/com/google/auth/http/AuthHttpConstants.java b/oauth2_http/src/main/java/com/google/auth/http/AuthHttpConstants.java similarity index 100% rename from oauth2_http/java/com/google/auth/http/AuthHttpConstants.java rename to oauth2_http/src/main/java/com/google/auth/http/AuthHttpConstants.java diff --git a/oauth2_http/java/com/google/auth/http/HttpCredentialsAdapter.java b/oauth2_http/src/main/java/com/google/auth/http/HttpCredentialsAdapter.java similarity index 100% rename from oauth2_http/java/com/google/auth/http/HttpCredentialsAdapter.java rename to oauth2_http/src/main/java/com/google/auth/http/HttpCredentialsAdapter.java diff --git a/oauth2_http/java/com/google/auth/http/HttpTransportFactory.java b/oauth2_http/src/main/java/com/google/auth/http/HttpTransportFactory.java similarity index 100% rename from oauth2_http/java/com/google/auth/http/HttpTransportFactory.java rename to oauth2_http/src/main/java/com/google/auth/http/HttpTransportFactory.java diff --git a/oauth2_http/java/com/google/auth/http/InternalAuthHttpConstants.java b/oauth2_http/src/main/java/com/google/auth/http/InternalAuthHttpConstants.java similarity index 100% rename from oauth2_http/java/com/google/auth/http/InternalAuthHttpConstants.java rename to oauth2_http/src/main/java/com/google/auth/http/InternalAuthHttpConstants.java diff --git a/oauth2_http/java/com/google/auth/mtls/CertificateSourceUnavailableException.java b/oauth2_http/src/main/java/com/google/auth/mtls/CertificateSourceUnavailableException.java similarity index 93% rename from oauth2_http/java/com/google/auth/mtls/CertificateSourceUnavailableException.java rename to oauth2_http/src/main/java/com/google/auth/mtls/CertificateSourceUnavailableException.java index 22a96ed22..084b8462f 100644 --- a/oauth2_http/java/com/google/auth/mtls/CertificateSourceUnavailableException.java +++ b/oauth2_http/src/main/java/com/google/auth/mtls/CertificateSourceUnavailableException.java @@ -5,13 +5,14 @@ * modification, are permitted provided that the following conditions are * met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above + * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google LLC nor the names of its + * + * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/oauth2_http/java/com/google/auth/mtls/ContextAwareMetadataJson.java b/oauth2_http/src/main/java/com/google/auth/mtls/ContextAwareMetadataJson.java similarity index 91% rename from oauth2_http/java/com/google/auth/mtls/ContextAwareMetadataJson.java rename to oauth2_http/src/main/java/com/google/auth/mtls/ContextAwareMetadataJson.java index 11583c4d0..4da9df2d8 100644 --- a/oauth2_http/java/com/google/auth/mtls/ContextAwareMetadataJson.java +++ b/oauth2_http/src/main/java/com/google/auth/mtls/ContextAwareMetadataJson.java @@ -5,13 +5,14 @@ * modification, are permitted provided that the following conditions are * met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above + * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google LLC nor the names of its + * + * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/oauth2_http/java/com/google/auth/mtls/DefaultMtlsProviderFactory.java b/oauth2_http/src/main/java/com/google/auth/mtls/DefaultMtlsProviderFactory.java similarity index 93% rename from oauth2_http/java/com/google/auth/mtls/DefaultMtlsProviderFactory.java rename to oauth2_http/src/main/java/com/google/auth/mtls/DefaultMtlsProviderFactory.java index b57accd4c..87ad9b1f0 100644 --- a/oauth2_http/java/com/google/auth/mtls/DefaultMtlsProviderFactory.java +++ b/oauth2_http/src/main/java/com/google/auth/mtls/DefaultMtlsProviderFactory.java @@ -5,13 +5,14 @@ * modification, are permitted provided that the following conditions are * met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above + * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google LLC nor the names of its + * + * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/oauth2_http/java/com/google/auth/mtls/MtlsHttpTransportFactory.java b/oauth2_http/src/main/java/com/google/auth/mtls/MtlsHttpTransportFactory.java similarity index 100% rename from oauth2_http/java/com/google/auth/mtls/MtlsHttpTransportFactory.java rename to oauth2_http/src/main/java/com/google/auth/mtls/MtlsHttpTransportFactory.java diff --git a/oauth2_http/java/com/google/auth/mtls/MtlsProvider.java b/oauth2_http/src/main/java/com/google/auth/mtls/MtlsProvider.java similarity index 92% rename from oauth2_http/java/com/google/auth/mtls/MtlsProvider.java rename to oauth2_http/src/main/java/com/google/auth/mtls/MtlsProvider.java index edc412552..f38fe311e 100644 --- a/oauth2_http/java/com/google/auth/mtls/MtlsProvider.java +++ b/oauth2_http/src/main/java/com/google/auth/mtls/MtlsProvider.java @@ -5,13 +5,14 @@ * modification, are permitted provided that the following conditions are * met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above + * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google LLC nor the names of its + * + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/oauth2_http/java/com/google/auth/mtls/SecureConnectProvider.java b/oauth2_http/src/main/java/com/google/auth/mtls/SecureConnectProvider.java similarity index 97% rename from oauth2_http/java/com/google/auth/mtls/SecureConnectProvider.java rename to oauth2_http/src/main/java/com/google/auth/mtls/SecureConnectProvider.java index 9d30d6800..17217d2e3 100644 --- a/oauth2_http/java/com/google/auth/mtls/SecureConnectProvider.java +++ b/oauth2_http/src/main/java/com/google/auth/mtls/SecureConnectProvider.java @@ -5,13 +5,14 @@ * modification, are permitted provided that the following conditions are * met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above + * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google LLC nor the names of its + * + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/oauth2_http/java/com/google/auth/mtls/WorkloadCertificateConfiguration.java b/oauth2_http/src/main/java/com/google/auth/mtls/WorkloadCertificateConfiguration.java similarity index 95% rename from oauth2_http/java/com/google/auth/mtls/WorkloadCertificateConfiguration.java rename to oauth2_http/src/main/java/com/google/auth/mtls/WorkloadCertificateConfiguration.java index db439eea5..89f4fda6a 100644 --- a/oauth2_http/java/com/google/auth/mtls/WorkloadCertificateConfiguration.java +++ b/oauth2_http/src/main/java/com/google/auth/mtls/WorkloadCertificateConfiguration.java @@ -5,13 +5,14 @@ * modification, are permitted provided that the following conditions are * met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above + * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google LLC nor the names of its + * + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/oauth2_http/java/com/google/auth/mtls/X509Provider.java b/oauth2_http/src/main/java/com/google/auth/mtls/X509Provider.java similarity index 97% rename from oauth2_http/java/com/google/auth/mtls/X509Provider.java rename to oauth2_http/src/main/java/com/google/auth/mtls/X509Provider.java index 7ff490f0f..de8a194a2 100644 --- a/oauth2_http/java/com/google/auth/mtls/X509Provider.java +++ b/oauth2_http/src/main/java/com/google/auth/mtls/X509Provider.java @@ -5,13 +5,14 @@ * modification, are permitted provided that the following conditions are * met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above + * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google LLC nor the names of its + * + * * Neither the name of Google LLC nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/oauth2_http/java/com/google/auth/oauth2/AccessToken.java b/oauth2_http/src/main/java/com/google/auth/oauth2/AccessToken.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/AccessToken.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/AccessToken.java diff --git a/oauth2_http/java/com/google/auth/oauth2/ActingParty.java b/oauth2_http/src/main/java/com/google/auth/oauth2/ActingParty.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/ActingParty.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/ActingParty.java diff --git a/oauth2_http/java/com/google/auth/oauth2/AppEngineCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/AppEngineCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/AppEngineCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/AppEngineCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/AwsCredentialSource.java b/oauth2_http/src/main/java/com/google/auth/oauth2/AwsCredentialSource.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/AwsCredentialSource.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/AwsCredentialSource.java diff --git a/oauth2_http/java/com/google/auth/oauth2/AwsCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/AwsCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/AwsCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/AwsCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/AwsDates.java b/oauth2_http/src/main/java/com/google/auth/oauth2/AwsDates.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/AwsDates.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/AwsDates.java diff --git a/oauth2_http/java/com/google/auth/oauth2/AwsRequestSignature.java b/oauth2_http/src/main/java/com/google/auth/oauth2/AwsRequestSignature.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/AwsRequestSignature.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/AwsRequestSignature.java diff --git a/oauth2_http/java/com/google/auth/oauth2/AwsRequestSigner.java b/oauth2_http/src/main/java/com/google/auth/oauth2/AwsRequestSigner.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/AwsRequestSigner.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/AwsRequestSigner.java diff --git a/oauth2_http/java/com/google/auth/oauth2/AwsSecurityCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/AwsSecurityCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/AwsSecurityCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/AwsSecurityCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/AwsSecurityCredentialsSupplier.java b/oauth2_http/src/main/java/com/google/auth/oauth2/AwsSecurityCredentialsSupplier.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/AwsSecurityCredentialsSupplier.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/AwsSecurityCredentialsSupplier.java diff --git a/oauth2_http/java/com/google/auth/oauth2/CertificateIdentityPoolSubjectTokenSupplier.java b/oauth2_http/src/main/java/com/google/auth/oauth2/CertificateIdentityPoolSubjectTokenSupplier.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/CertificateIdentityPoolSubjectTokenSupplier.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/CertificateIdentityPoolSubjectTokenSupplier.java diff --git a/oauth2_http/java/com/google/auth/oauth2/ClientId.java b/oauth2_http/src/main/java/com/google/auth/oauth2/ClientId.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/ClientId.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/ClientId.java diff --git a/oauth2_http/java/com/google/auth/oauth2/CloudShellCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/CloudShellCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/CloudShellCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/CloudShellCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/ComputeEngineCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/ComputeEngineCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/CredentialAccessBoundary.java b/oauth2_http/src/main/java/com/google/auth/oauth2/CredentialAccessBoundary.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/CredentialAccessBoundary.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/CredentialAccessBoundary.java diff --git a/oauth2_http/java/com/google/auth/oauth2/CredentialFormatException.java b/oauth2_http/src/main/java/com/google/auth/oauth2/CredentialFormatException.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/CredentialFormatException.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/CredentialFormatException.java diff --git a/oauth2_http/java/com/google/auth/oauth2/DefaultCredentialsProvider.java b/oauth2_http/src/main/java/com/google/auth/oauth2/DefaultCredentialsProvider.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/DefaultCredentialsProvider.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/DefaultCredentialsProvider.java diff --git a/oauth2_http/java/com/google/auth/oauth2/DefaultPKCEProvider.java b/oauth2_http/src/main/java/com/google/auth/oauth2/DefaultPKCEProvider.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/DefaultPKCEProvider.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/DefaultPKCEProvider.java diff --git a/oauth2_http/java/com/google/auth/oauth2/DownscopedCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/DownscopedCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/DownscopedCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/DownscopedCredentials.java diff --git a/oauth2_http/src/main/java/com/google/auth/oauth2/EnvironmentProvider.java b/oauth2_http/src/main/java/com/google/auth/oauth2/EnvironmentProvider.java new file mode 100644 index 000000000..bc26e1502 --- /dev/null +++ b/oauth2_http/src/main/java/com/google/auth/oauth2/EnvironmentProvider.java @@ -0,0 +1,37 @@ +/* + * Copyright 2021 Google LLC + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package com.google.auth.oauth2; + +/** Interface for an environment provider. */ +interface EnvironmentProvider { + String getEnv(String name); +} diff --git a/oauth2_http/java/com/google/auth/oauth2/ExecutableHandler.java b/oauth2_http/src/main/java/com/google/auth/oauth2/ExecutableHandler.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/ExecutableHandler.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/ExecutableHandler.java diff --git a/oauth2_http/java/com/google/auth/oauth2/ExecutableResponse.java b/oauth2_http/src/main/java/com/google/auth/oauth2/ExecutableResponse.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/ExecutableResponse.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/ExecutableResponse.java diff --git a/oauth2_http/java/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/ExternalAccountCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/ExternalAccountCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/ExternalAccountCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/ExternalAccountMetricsHandler.java b/oauth2_http/src/main/java/com/google/auth/oauth2/ExternalAccountMetricsHandler.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/ExternalAccountMetricsHandler.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/ExternalAccountMetricsHandler.java diff --git a/oauth2_http/java/com/google/auth/oauth2/ExternalAccountSupplierContext.java b/oauth2_http/src/main/java/com/google/auth/oauth2/ExternalAccountSupplierContext.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/ExternalAccountSupplierContext.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/ExternalAccountSupplierContext.java diff --git a/oauth2_http/java/com/google/auth/oauth2/FileIdentityPoolSubjectTokenSupplier.java b/oauth2_http/src/main/java/com/google/auth/oauth2/FileIdentityPoolSubjectTokenSupplier.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/FileIdentityPoolSubjectTokenSupplier.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/FileIdentityPoolSubjectTokenSupplier.java diff --git a/oauth2_http/java/com/google/auth/oauth2/GdchCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/GdchCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/GdchCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/GdchCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/GoogleAuthException.java b/oauth2_http/src/main/java/com/google/auth/oauth2/GoogleAuthException.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/GoogleAuthException.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/GoogleAuthException.java diff --git a/oauth2_http/java/com/google/auth/oauth2/GoogleAuthUtils.java b/oauth2_http/src/main/java/com/google/auth/oauth2/GoogleAuthUtils.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/GoogleAuthUtils.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/GoogleAuthUtils.java diff --git a/oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/GoogleCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/GoogleCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/IamUtils.java b/oauth2_http/src/main/java/com/google/auth/oauth2/IamUtils.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/IamUtils.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/IamUtils.java diff --git a/oauth2_http/java/com/google/auth/oauth2/IdToken.java b/oauth2_http/src/main/java/com/google/auth/oauth2/IdToken.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/IdToken.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/IdToken.java diff --git a/oauth2_http/java/com/google/auth/oauth2/IdTokenCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/IdTokenCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/IdTokenCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/IdTokenCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/IdTokenProvider.java b/oauth2_http/src/main/java/com/google/auth/oauth2/IdTokenProvider.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/IdTokenProvider.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/IdTokenProvider.java diff --git a/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentialSource.java b/oauth2_http/src/main/java/com/google/auth/oauth2/IdentityPoolCredentialSource.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentialSource.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/IdentityPoolCredentialSource.java diff --git a/oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/IdentityPoolCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/IdentityPoolCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/IdentityPoolCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/IdentityPoolSubjectTokenSupplier.java b/oauth2_http/src/main/java/com/google/auth/oauth2/IdentityPoolSubjectTokenSupplier.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/IdentityPoolSubjectTokenSupplier.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/IdentityPoolSubjectTokenSupplier.java diff --git a/oauth2_http/java/com/google/auth/oauth2/ImpersonatedCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/ImpersonatedCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/ImpersonatedCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/ImpersonatedCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/InternalAwsSecurityCredentialsSupplier.java b/oauth2_http/src/main/java/com/google/auth/oauth2/InternalAwsSecurityCredentialsSupplier.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/InternalAwsSecurityCredentialsSupplier.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/InternalAwsSecurityCredentialsSupplier.java diff --git a/oauth2_http/java/com/google/auth/oauth2/JwtClaims.java b/oauth2_http/src/main/java/com/google/auth/oauth2/JwtClaims.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/JwtClaims.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/JwtClaims.java diff --git a/oauth2_http/java/com/google/auth/oauth2/JwtCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/JwtCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/JwtCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/JwtCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/JwtProvider.java b/oauth2_http/src/main/java/com/google/auth/oauth2/JwtProvider.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/JwtProvider.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/JwtProvider.java diff --git a/oauth2_http/java/com/google/auth/oauth2/LoggerProvider.java b/oauth2_http/src/main/java/com/google/auth/oauth2/LoggerProvider.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/LoggerProvider.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/LoggerProvider.java diff --git a/oauth2_http/java/com/google/auth/oauth2/LoggingUtils.java b/oauth2_http/src/main/java/com/google/auth/oauth2/LoggingUtils.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/LoggingUtils.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/LoggingUtils.java diff --git a/oauth2_http/java/com/google/auth/oauth2/MemoryTokensStorage.java b/oauth2_http/src/main/java/com/google/auth/oauth2/MemoryTokensStorage.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/MemoryTokensStorage.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/MemoryTokensStorage.java diff --git a/oauth2_http/java/com/google/auth/oauth2/MetricsUtils.java b/oauth2_http/src/main/java/com/google/auth/oauth2/MetricsUtils.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/MetricsUtils.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/MetricsUtils.java diff --git a/oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/OAuth2Credentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/OAuth2Credentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/OAuth2Credentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/OAuth2CredentialsWithRefresh.java b/oauth2_http/src/main/java/com/google/auth/oauth2/OAuth2CredentialsWithRefresh.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/OAuth2CredentialsWithRefresh.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/OAuth2CredentialsWithRefresh.java diff --git a/oauth2_http/java/com/google/auth/oauth2/OAuth2Utils.java b/oauth2_http/src/main/java/com/google/auth/oauth2/OAuth2Utils.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/OAuth2Utils.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/OAuth2Utils.java diff --git a/oauth2_http/java/com/google/auth/oauth2/OAuthException.java b/oauth2_http/src/main/java/com/google/auth/oauth2/OAuthException.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/OAuthException.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/OAuthException.java diff --git a/oauth2_http/java/com/google/auth/oauth2/PKCEProvider.java b/oauth2_http/src/main/java/com/google/auth/oauth2/PKCEProvider.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/PKCEProvider.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/PKCEProvider.java diff --git a/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentialSource.java b/oauth2_http/src/main/java/com/google/auth/oauth2/PluggableAuthCredentialSource.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentialSource.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/PluggableAuthCredentialSource.java diff --git a/oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/PluggableAuthCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/PluggableAuthCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/PluggableAuthCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/PluggableAuthException.java b/oauth2_http/src/main/java/com/google/auth/oauth2/PluggableAuthException.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/PluggableAuthException.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/PluggableAuthException.java diff --git a/oauth2_http/java/com/google/auth/oauth2/PluggableAuthHandler.java b/oauth2_http/src/main/java/com/google/auth/oauth2/PluggableAuthHandler.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/PluggableAuthHandler.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/PluggableAuthHandler.java diff --git a/oauth2_http/java/com/google/auth/oauth2/QuotaProjectIdProvider.java b/oauth2_http/src/main/java/com/google/auth/oauth2/QuotaProjectIdProvider.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/QuotaProjectIdProvider.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/QuotaProjectIdProvider.java diff --git a/oauth2_http/java/com/google/auth/oauth2/SecureSessionAgent.java b/oauth2_http/src/main/java/com/google/auth/oauth2/SecureSessionAgent.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/SecureSessionAgent.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/SecureSessionAgent.java diff --git a/oauth2_http/java/com/google/auth/oauth2/SecureSessionAgentConfig.java b/oauth2_http/src/main/java/com/google/auth/oauth2/SecureSessionAgentConfig.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/SecureSessionAgentConfig.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/SecureSessionAgentConfig.java diff --git a/oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/ServiceAccountCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/ServiceAccountCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java diff --git a/oauth2_http/java/com/google/auth/oauth2/Slf4jLoggingHelpers.java b/oauth2_http/src/main/java/com/google/auth/oauth2/Slf4jLoggingHelpers.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/Slf4jLoggingHelpers.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/Slf4jLoggingHelpers.java diff --git a/oauth2_http/java/com/google/auth/oauth2/Slf4jUtils.java b/oauth2_http/src/main/java/com/google/auth/oauth2/Slf4jUtils.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/Slf4jUtils.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/Slf4jUtils.java diff --git a/oauth2_http/java/com/google/auth/oauth2/StsRequestHandler.java b/oauth2_http/src/main/java/com/google/auth/oauth2/StsRequestHandler.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/StsRequestHandler.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/StsRequestHandler.java diff --git a/oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeRequest.java b/oauth2_http/src/main/java/com/google/auth/oauth2/StsTokenExchangeRequest.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeRequest.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/StsTokenExchangeRequest.java diff --git a/oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeResponse.java b/oauth2_http/src/main/java/com/google/auth/oauth2/StsTokenExchangeResponse.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/StsTokenExchangeResponse.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/StsTokenExchangeResponse.java diff --git a/oauth2_http/src/main/java/com/google/auth/oauth2/SystemEnvironmentProvider.java b/oauth2_http/src/main/java/com/google/auth/oauth2/SystemEnvironmentProvider.java new file mode 100644 index 000000000..9bed338b2 --- /dev/null +++ b/oauth2_http/src/main/java/com/google/auth/oauth2/SystemEnvironmentProvider.java @@ -0,0 +1,51 @@ +/* + * Copyright 2021 Google LLC + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package com.google.auth.oauth2; + +import java.io.Serializable; + +/** Represents the default system environment provider. */ +class SystemEnvironmentProvider implements EnvironmentProvider, Serializable { + static final SystemEnvironmentProvider INSTANCE = new SystemEnvironmentProvider(); + private static final long serialVersionUID = -4698164985883575244L; + + private SystemEnvironmentProvider() {} + + @Override + public String getEnv(String name) { + return System.getenv(name); + } + + public static SystemEnvironmentProvider getInstance() { + return INSTANCE; + } +} diff --git a/oauth2_http/java/com/google/auth/oauth2/TokenStore.java b/oauth2_http/src/main/java/com/google/auth/oauth2/TokenStore.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/TokenStore.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/TokenStore.java diff --git a/oauth2_http/java/com/google/auth/oauth2/TokenVerifier.java b/oauth2_http/src/main/java/com/google/auth/oauth2/TokenVerifier.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/TokenVerifier.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/TokenVerifier.java diff --git a/oauth2_http/java/com/google/auth/oauth2/UrlIdentityPoolSubjectTokenSupplier.java b/oauth2_http/src/main/java/com/google/auth/oauth2/UrlIdentityPoolSubjectTokenSupplier.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/UrlIdentityPoolSubjectTokenSupplier.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/UrlIdentityPoolSubjectTokenSupplier.java diff --git a/oauth2_http/java/com/google/auth/oauth2/UserAuthorizer.java b/oauth2_http/src/main/java/com/google/auth/oauth2/UserAuthorizer.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/UserAuthorizer.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/UserAuthorizer.java diff --git a/oauth2_http/java/com/google/auth/oauth2/UserCredentials.java b/oauth2_http/src/main/java/com/google/auth/oauth2/UserCredentials.java similarity index 100% rename from oauth2_http/java/com/google/auth/oauth2/UserCredentials.java rename to oauth2_http/src/main/java/com/google/auth/oauth2/UserCredentials.java diff --git a/oauth2_http/resources/META-INF/native-image/com.google.auth/google-auth-library-oauth2-http/reflect-config.json b/oauth2_http/src/main/resources/META-INF/native-image/com.google.auth/google-auth-library-oauth2-http/reflect-config.json similarity index 100% rename from oauth2_http/resources/META-INF/native-image/com.google.auth/google-auth-library-oauth2-http/reflect-config.json rename to oauth2_http/src/main/resources/META-INF/native-image/com.google.auth/google-auth-library-oauth2-http/reflect-config.json diff --git a/oauth2_http/resources/META-INF/native-image/native-image.properties b/oauth2_http/src/main/resources/META-INF/native-image/native-image.properties similarity index 100% rename from oauth2_http/resources/META-INF/native-image/native-image.properties rename to oauth2_http/src/main/resources/META-INF/native-image/native-image.properties diff --git a/oauth2_http/resources/com/google/auth/oauth2/google-auth-library.properties b/oauth2_http/src/main/resources/com/google/auth/oauth2/google-auth-library.properties similarity index 100% rename from oauth2_http/resources/com/google/auth/oauth2/google-auth-library.properties rename to oauth2_http/src/main/resources/com/google/auth/oauth2/google-auth-library.properties diff --git a/oauth2_http/javatests/com/google/auth/TestClock.java b/oauth2_http/src/test/java/com/google/auth/TestClock.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/TestClock.java rename to oauth2_http/src/test/java/com/google/auth/TestClock.java diff --git a/oauth2_http/javatests/com/google/auth/TestUtils.java b/oauth2_http/src/test/java/com/google/auth/TestUtils.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/TestUtils.java rename to oauth2_http/src/test/java/com/google/auth/TestUtils.java diff --git a/oauth2_http/javatests/com/google/auth/http/HttpCredentialsAdapterTest.java b/oauth2_http/src/test/java/com/google/auth/http/HttpCredentialsAdapterTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/http/HttpCredentialsAdapterTest.java rename to oauth2_http/src/test/java/com/google/auth/http/HttpCredentialsAdapterTest.java diff --git a/oauth2_http/javatests/com/google/auth/mtls/SecureConnectProviderTest.java b/oauth2_http/src/test/java/com/google/auth/mtls/SecureConnectProviderTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/mtls/SecureConnectProviderTest.java rename to oauth2_http/src/test/java/com/google/auth/mtls/SecureConnectProviderTest.java diff --git a/oauth2_http/javatests/com/google/auth/mtls/WorkloadCertificateConfigurationTest.java b/oauth2_http/src/test/java/com/google/auth/mtls/WorkloadCertificateConfigurationTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/mtls/WorkloadCertificateConfigurationTest.java rename to oauth2_http/src/test/java/com/google/auth/mtls/WorkloadCertificateConfigurationTest.java diff --git a/oauth2_http/javatests/com/google/auth/mtls/X509ProviderTest.java b/oauth2_http/src/test/java/com/google/auth/mtls/X509ProviderTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/mtls/X509ProviderTest.java rename to oauth2_http/src/test/java/com/google/auth/mtls/X509ProviderTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/AccessTokenTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/AccessTokenTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/AccessTokenTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/AccessTokenTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/AppEngineCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/AppEngineCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/AppEngineCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/AppEngineCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/AwsCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/AwsCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/AwsCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/AwsCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/AwsRequestSignerTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/AwsRequestSignerTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/AwsRequestSignerTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/AwsRequestSignerTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/BaseSerializationTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/BaseSerializationTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/BaseSerializationTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/BaseSerializationTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/CertificateIdentityPoolSubjectTokenSupplierTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/CertificateIdentityPoolSubjectTokenSupplierTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/CertificateIdentityPoolSubjectTokenSupplierTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/CertificateIdentityPoolSubjectTokenSupplierTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ClientIdTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/ClientIdTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/ClientIdTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/ClientIdTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/CloudShellCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/CloudShellCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/CloudShellCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/CloudShellCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ComputeEngineCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/ComputeEngineCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/ComputeEngineCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/ComputeEngineCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/CredentialAccessBoundaryTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/CredentialAccessBoundaryTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/CredentialAccessBoundaryTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/CredentialAccessBoundaryTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/DefaultCredentialsProviderTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/DefaultCredentialsProviderTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/DefaultCredentialsProviderTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/DefaultCredentialsProviderTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/DefaultPKCEProviderTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/DefaultPKCEProviderTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/DefaultPKCEProviderTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/DefaultPKCEProviderTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/DownscopedCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/DownscopedCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/DownscopedCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/DownscopedCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ExecutableResponseTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/ExecutableResponseTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/ExecutableResponseTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/ExecutableResponseTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/ExternalAccountAuthorizedUserCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/ExternalAccountCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/ExternalAccountCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountSupplierContextTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/ExternalAccountSupplierContextTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/ExternalAccountSupplierContextTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/ExternalAccountSupplierContextTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/GdchCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/GdchCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/GdchCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/GdchCredentialsTest.java diff --git a/oauth2_http/src/test/java/com/google/auth/oauth2/GdchCredentialsTestUtil.java b/oauth2_http/src/test/java/com/google/auth/oauth2/GdchCredentialsTestUtil.java new file mode 100644 index 000000000..d464cff21 --- /dev/null +++ b/oauth2_http/src/test/java/com/google/auth/oauth2/GdchCredentialsTestUtil.java @@ -0,0 +1,58 @@ +/* + * Copyright 2023 Google LLC + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package com.google.auth.oauth2; + +import com.google.api.client.testing.http.FixedClock; +import java.io.IOException; +import java.net.URI; +import java.util.Map; + +class GdchCredentialsTestUtil { + public static void registerGdchCredentialWithMockTransport( + GdchCredentials credentials, + MockTokenServerTransport transport, + String projectId, + String serviceIdentityName, + String tokenString, + URI tokenServerUri) { + credentials.clock = new FixedClock(0L); + transport.addGdchServiceAccount( + GdchCredentials.getIssuerSubjectValue(projectId, serviceIdentityName), tokenString); + transport.setTokenServerUri(tokenServerUri); + } + + public static GdchCredentials fromJson( + Map json, MockTokenServerTransportFactory transportFactory) + throws IOException { + return GdchCredentials.fromJson(json, transportFactory); + } +} diff --git a/oauth2_http/javatests/com/google/auth/oauth2/GoogleAuthUtilsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/GoogleAuthUtilsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/GoogleAuthUtilsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/GoogleAuthUtilsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/GoogleCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/GoogleCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/GoogleCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/GoogleCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ITDownscopingTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/ITDownscopingTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/ITDownscopingTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/ITDownscopingTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ITWorkloadIdentityFederationTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/ITWorkloadIdentityFederationTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/ITWorkloadIdentityFederationTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/ITWorkloadIdentityFederationTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/IamUtilsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/IamUtilsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/IamUtilsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/IamUtilsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/IdTokenCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/IdTokenCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/IdTokenCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/IdTokenCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/IdTokenTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/IdTokenTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/IdTokenTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/IdTokenTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/IdentityPoolCredentialsSourceTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/IdentityPoolCredentialsSourceTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/IdentityPoolCredentialsSourceTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/IdentityPoolCredentialsSourceTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/IdentityPoolCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/IdentityPoolCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/IdentityPoolCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/IdentityPoolCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ImpersonatedCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/ImpersonatedCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/ImpersonatedCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/ImpersonatedCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/InternalAwsSecurityCredentialsSupplierTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/InternalAwsSecurityCredentialsSupplierTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/InternalAwsSecurityCredentialsSupplierTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/InternalAwsSecurityCredentialsSupplierTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/JwtClaimsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/JwtClaimsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/JwtClaimsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/JwtClaimsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/JwtCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/JwtCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/JwtCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/JwtCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/LoggingTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/LoggingTest.java similarity index 74% rename from oauth2_http/javatests/com/google/auth/oauth2/LoggingTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/LoggingTest.java index 8be16a89a..8539abfc9 100644 --- a/oauth2_http/javatests/com/google/auth/oauth2/LoggingTest.java +++ b/oauth2_http/src/test/java/com/google/auth/oauth2/LoggingTest.java @@ -64,6 +64,8 @@ import java.util.Map; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.Execution; +import org.junit.jupiter.api.parallel.ExecutionMode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.event.KeyValuePair; @@ -73,14 +75,34 @@ * credentials test classes with addition of test logging appender setup and test logic for logging. * This duplicates tests setups, but centralizes logging test setup in this class. */ +@Execution(ExecutionMode.SAME_THREAD) class LoggingTest { + // Configure Logback to initialize at most for 3 seconds + private static final long LOGBACK_POLL_ATTEMPTS = 30L; + private static final long LOGBACK_POLL_DELAY_MS = 100L; + private TestAppender setupTestLogger(Class clazz) { - TestAppender testAppender = new TestAppender(); + ThreadLocal testAppenderThreadLocal = ThreadLocal.withInitial(TestAppender::new); + TestAppender testAppender = testAppenderThreadLocal.get(); testAppender.start(); Logger logger = LoggerFactory.getLogger(clazz); - ((ch.qos.logback.classic.Logger) logger).addAppender(testAppender); - return testAppender; + // From + // https://stackoverflow.com/questions/1827677/how-to-do-a-junit-assert-on-a-message-in-a-logger/51812144#comment128302495_51812144 + // LoggerFactory.getLogger() might return an org.slf4j.helpers.SubstituteLogger instance despite + // the usage of Logback while the logging is still initializing + for (int i = 0; i < LOGBACK_POLL_ATTEMPTS; i++) { + if ((logger instanceof ch.qos.logback.classic.Logger)) { + ((ch.qos.logback.classic.Logger) logger).addAppender(testAppender); + return testAppender; + } + try { + Thread.sleep(LOGBACK_POLL_DELAY_MS); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + throw new RuntimeException("Unable to setup test logger"); } @BeforeAll @@ -109,11 +131,11 @@ void userCredentials_getRequestMetadata_fromRefreshToken_hasAccessToken() throws TestUtils.assertContainsBearerToken(metadata, ACCESS_TOKEN); - assertEquals(3, testAppender.events.size()); + assertEquals(3, testAppender.getEvents().size()); assertEquals( - "Sending request to refresh access token", testAppender.events.get(0).getMessage()); - assertEquals(4, testAppender.events.get(0).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(0).getKeyValuePairs()) { + "Sending request to refresh access token", testAppender.getEvents().get(0).getMessage()); + assertEquals(4, testAppender.getEvents().get(0).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(0).getKeyValuePairs()) { assertTrue( kvp.key.equals("request.headers") || kvp.key.equals("request.payload") @@ -124,17 +146,17 @@ void userCredentials_getRequestMetadata_fromRefreshToken_hasAccessToken() throws } } assertEquals( - "Received response for refresh access token", testAppender.events.get(1).getMessage()); - assertEquals(3, testAppender.events.get(1).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(1).getKeyValuePairs()) { + "Received response for refresh access token", testAppender.getEvents().get(1).getMessage()); + assertEquals(3, testAppender.getEvents().get(1).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(1).getKeyValuePairs()) { assertTrue( kvp.key.equals("response.headers") || kvp.key.equals("response.status") || kvp.key.equals("response.status.message")); } - assertEquals("Response payload for access token", testAppender.events.get(2).getMessage()); - assertEquals(4, testAppender.events.get(2).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(2).getKeyValuePairs()) { + assertEquals("Response payload for access token", testAppender.getEvents().get(2).getMessage()); + assertEquals(4, testAppender.getEvents().get(2).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(2).getKeyValuePairs()) { assertTrue( kvp.key.equals("access_token") || kvp.key.equals("refresh_token") @@ -142,6 +164,7 @@ void userCredentials_getRequestMetadata_fromRefreshToken_hasAccessToken() throws || kvp.key.equals("expires_in")); } testAppender.stop(); + testAppender.clearEvents(); } boolean isValidJson(String jsonString) { @@ -163,12 +186,12 @@ void serviceAccountCredentials_getRequestMetadata_hasAccessToken() throws IOExce Map> metadata = credentials.getRequestMetadata(CALL_URI); TestUtils.assertContainsBearerToken(metadata, ACCESS_TOKEN); - assertEquals(3, testAppender.events.size()); + assertEquals(3, testAppender.getEvents().size()); assertEquals( - "Sending request to refresh access token", testAppender.events.get(0).getMessage()); - assertEquals(4, testAppender.events.get(0).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(0).getKeyValuePairs()) { + "Sending request to refresh access token", testAppender.getEvents().get(0).getMessage()); + assertEquals(4, testAppender.getEvents().get(0).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(0).getKeyValuePairs()) { assertTrue( kvp.key.equals("request.headers") || kvp.key.equals("request.payload") @@ -180,23 +203,24 @@ void serviceAccountCredentials_getRequestMetadata_hasAccessToken() throws IOExce } } assertEquals( - "Received response for refresh access token", testAppender.events.get(1).getMessage()); - assertEquals(3, testAppender.events.get(1).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(1).getKeyValuePairs()) { + "Received response for refresh access token", testAppender.getEvents().get(1).getMessage()); + assertEquals(3, testAppender.getEvents().get(1).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(1).getKeyValuePairs()) { assertTrue( kvp.key.equals("response.headers") || kvp.key.equals("response.status") || kvp.key.equals("response.status.message")); } - assertEquals("Response payload", testAppender.events.get(2).getMessage()); - assertEquals(3, testAppender.events.get(2).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(2).getKeyValuePairs()) { + assertEquals("Response payload", testAppender.getEvents().get(2).getMessage()); + assertEquals(3, testAppender.getEvents().get(2).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(2).getKeyValuePairs()) { assertTrue( kvp.key.equals("access_token") || kvp.key.equals("token_type") || kvp.key.equals("expires_in")); } testAppender.stop(); + testAppender.clearEvents(); } @Test @@ -231,11 +255,11 @@ void serviceAccountCredentials_idTokenWithAudience_iamFlow_targetAudienceMatches targetAudience, tokenCredential.getIdToken().getJsonWebSignature().getPayload().getAudience()); - assertEquals(3, testAppender.events.size()); + assertEquals(3, testAppender.getEvents().size()); - assertEquals("Sending request to get ID token", testAppender.events.get(0).getMessage()); - assertEquals(4, testAppender.events.get(0).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(0).getKeyValuePairs()) { + assertEquals("Sending request to get ID token", testAppender.getEvents().get(0).getMessage()); + assertEquals(4, testAppender.getEvents().get(0).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(0).getKeyValuePairs()) { assertTrue( kvp.key.equals("request.headers") || kvp.key.equals("request.payload") @@ -245,17 +269,19 @@ void serviceAccountCredentials_idTokenWithAudience_iamFlow_targetAudienceMatches assertTrue(isValidJson((String) kvp.value)); } } - assertEquals("Received response for ID token request", testAppender.events.get(1).getMessage()); - assertEquals(3, testAppender.events.get(1).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(1).getKeyValuePairs()) { + assertEquals( + "Received response for ID token request", testAppender.getEvents().get(1).getMessage()); + assertEquals(3, testAppender.getEvents().get(1).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(1).getKeyValuePairs()) { assertTrue( kvp.key.equals("response.headers") || kvp.key.equals("response.status") || kvp.key.equals("response.status.message")); } - assertEquals("Response payload", testAppender.events.get(2).getMessage()); - assertEquals(1, testAppender.events.get(2).getKeyValuePairs().size()); + assertEquals("Response payload", testAppender.getEvents().get(2).getMessage()); + assertEquals(1, testAppender.getEvents().get(2).getKeyValuePairs().size()); testAppender.stop(); + testAppender.clearEvents(); } @Test() @@ -281,12 +307,12 @@ void impersonatedCredentials_refreshAccessToken_success() assertEquals( DEFAULT_IMPERSONATION_URL, mockTransportFactory.getTransport().getRequest().getUrl()); - assertEquals(3, testAppender.events.size()); + assertEquals(3, testAppender.getEvents().size()); assertEquals( - "Sending request to refresh access token", testAppender.events.get(0).getMessage()); - assertEquals(4, testAppender.events.get(0).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(0).getKeyValuePairs()) { + "Sending request to refresh access token", testAppender.getEvents().get(0).getMessage()); + assertEquals(4, testAppender.getEvents().get(0).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(0).getKeyValuePairs()) { assertTrue( kvp.key.equals("request.headers") || kvp.key.equals("request.payload") @@ -297,18 +323,19 @@ void impersonatedCredentials_refreshAccessToken_success() } } assertEquals( - "Received response for refresh access token", testAppender.events.get(1).getMessage()); - assertEquals(3, testAppender.events.get(1).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(1).getKeyValuePairs()) { + "Received response for refresh access token", testAppender.getEvents().get(1).getMessage()); + assertEquals(3, testAppender.getEvents().get(1).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(1).getKeyValuePairs()) { assertTrue( kvp.key.equals("response.headers") || kvp.key.equals("response.status") || kvp.key.equals("response.status.message")); } - assertEquals("Response payload for access token", testAppender.events.get(2).getMessage()); - assertEquals(2, testAppender.events.get(2).getKeyValuePairs().size()); + assertEquals("Response payload for access token", testAppender.getEvents().get(2).getMessage()); + assertEquals(2, testAppender.getEvents().get(2).getKeyValuePairs().size()); testAppender.stop(); + testAppender.clearEvents(); } @Test @@ -344,11 +371,11 @@ void idTokenWithAudience_withEmail() throws IOException { Payload p = tokenCredential.getIdToken().getJsonWebSignature().getPayload(); assertTrue(p.containsKey("email")); - assertEquals(3, testAppender.events.size()); + assertEquals(3, testAppender.getEvents().size()); - assertEquals("Sending request to get ID token", testAppender.events.get(0).getMessage()); - assertEquals(4, testAppender.events.get(0).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(0).getKeyValuePairs()) { + assertEquals("Sending request to get ID token", testAppender.getEvents().get(0).getMessage()); + assertEquals(4, testAppender.getEvents().get(0).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(0).getKeyValuePairs()) { assertTrue( kvp.key.equals("request.headers") || kvp.key.equals("request.payload") @@ -358,18 +385,21 @@ void idTokenWithAudience_withEmail() throws IOException { assertTrue(isValidJson((String) kvp.value)); } } - assertEquals("Received response for ID token request", testAppender.events.get(1).getMessage()); - assertEquals(3, testAppender.events.get(1).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(1).getKeyValuePairs()) { + assertEquals( + "Received response for ID token request", testAppender.getEvents().get(1).getMessage()); + assertEquals(3, testAppender.getEvents().get(1).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(1).getKeyValuePairs()) { assertTrue( kvp.key.equals("response.headers") || kvp.key.equals("response.status") || kvp.key.equals("response.status.message")); } - assertEquals("Response payload for ID token request", testAppender.events.get(2).getMessage()); - assertEquals(1, testAppender.events.get(2).getKeyValuePairs().size()); + assertEquals( + "Response payload for ID token request", testAppender.getEvents().get(2).getMessage()); + assertEquals(1, testAppender.getEvents().get(2).getKeyValuePairs().size()); testAppender.stop(); + testAppender.clearEvents(); } @Test @@ -397,13 +427,13 @@ void sign_sameAs() throws IOException { assertArrayEquals(expectedSignature, targetCredentials.sign(expectedSignature)); - assertEquals(3, testAppender.events.size()); + assertEquals(3, testAppender.getEvents().size()); assertEquals( "Sending request to get signature to sign the blob", - testAppender.events.get(0).getMessage()); - assertEquals(4, testAppender.events.get(0).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(0).getKeyValuePairs()) { + testAppender.getEvents().get(0).getMessage()); + assertEquals(4, testAppender.getEvents().get(0).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(0).getKeyValuePairs()) { assertTrue( kvp.key.equals("request.headers") || kvp.key.equals("request.payload") @@ -415,18 +445,19 @@ void sign_sameAs() throws IOException { } assertEquals( "Received response for signature to sign the blob", - testAppender.events.get(1).getMessage()); - assertEquals(3, testAppender.events.get(1).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(1).getKeyValuePairs()) { + testAppender.getEvents().get(1).getMessage()); + assertEquals(3, testAppender.getEvents().get(1).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(1).getKeyValuePairs()) { assertTrue( kvp.key.equals("response.headers") || kvp.key.equals("response.status") || kvp.key.equals("response.status.message")); } - assertEquals("Response payload for sign blob", testAppender.events.get(2).getMessage()); - assertEquals(1, testAppender.events.get(2).getKeyValuePairs().size()); + assertEquals("Response payload for sign blob", testAppender.getEvents().get(2).getMessage()); + assertEquals(1, testAppender.getEvents().get(2).getKeyValuePairs().size()); testAppender.stop(); + testAppender.clearEvents(); } @Test @@ -440,9 +471,9 @@ void getRequestMetadata_hasAccessToken() throws IOException { TestUtils.assertContainsBearerToken(metadata, ACCESS_TOKEN); - assertEquals(3, testAppender.events.size()); + assertEquals(3, testAppender.getEvents().size()); - ILoggingEvent accessTokenRequest = testAppender.events.get(0); + ILoggingEvent accessTokenRequest = testAppender.getEvents().get(0); assertEquals("Sending request to refresh access token", accessTokenRequest.getMessage()); assertEquals(3, accessTokenRequest.getKeyValuePairs().size()); for (KeyValuePair kvp : accessTokenRequest.getKeyValuePairs()) { @@ -454,7 +485,7 @@ void getRequestMetadata_hasAccessToken() throws IOException { assertTrue(isValidJson((String) kvp.value)); } } - ILoggingEvent accessTokenResponse = testAppender.events.get(1); + ILoggingEvent accessTokenResponse = testAppender.getEvents().get(1); assertEquals("Received response for refresh access token", accessTokenResponse.getMessage()); assertEquals(3, accessTokenResponse.getKeyValuePairs().size()); for (KeyValuePair kvp : accessTokenResponse.getKeyValuePairs()) { @@ -463,11 +494,12 @@ void getRequestMetadata_hasAccessToken() throws IOException { || kvp.key.equals("response.status") || kvp.key.equals("response.status.message")); } - ILoggingEvent accessTokenPayload = testAppender.events.get(2); + ILoggingEvent accessTokenPayload = testAppender.getEvents().get(2); assertEquals("Response payload for access token", accessTokenPayload.getMessage()); assertEquals(3, accessTokenPayload.getKeyValuePairs().size()); testAppender.stop(); + testAppender.clearEvents(); } @Test @@ -491,11 +523,11 @@ void idTokenWithAudience_full() throws IOException { ArrayMap googleClaim = (ArrayMap) p.get("google"); assertTrue(googleClaim.containsKey("compute_engine")); - assertEquals(3, testAppender.events.size()); + assertEquals(3, testAppender.getEvents().size()); - assertEquals("Sending request to get ID token", testAppender.events.get(0).getMessage()); - assertEquals(3, testAppender.events.get(0).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(0).getKeyValuePairs()) { + assertEquals("Sending request to get ID token", testAppender.getEvents().get(0).getMessage()); + assertEquals(3, testAppender.getEvents().get(0).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(0).getKeyValuePairs()) { assertTrue( kvp.key.equals("request.headers") || kvp.key.equals("request.method") @@ -504,21 +536,23 @@ void idTokenWithAudience_full() throws IOException { assertTrue(isValidJson((String) kvp.value)); } } - assertEquals("Received response for ID token request", testAppender.events.get(1).getMessage()); - assertEquals(3, testAppender.events.get(1).getKeyValuePairs().size()); - for (KeyValuePair kvp : testAppender.events.get(1).getKeyValuePairs()) { + assertEquals( + "Received response for ID token request", testAppender.getEvents().get(1).getMessage()); + assertEquals(3, testAppender.getEvents().get(1).getKeyValuePairs().size()); + for (KeyValuePair kvp : testAppender.getEvents().get(1).getKeyValuePairs()) { assertTrue( kvp.key.equals("response.headers") || kvp.key.equals("response.status") || kvp.key.equals("response.status.message")); } - assertEquals("Response Payload for ID token", testAppender.events.get(2).getMessage()); - assertEquals(1, testAppender.events.get(2).getKeyValuePairs().size()); - assertEquals("idToken", testAppender.events.get(2).getKeyValuePairs().get(0).key); + assertEquals("Response Payload for ID token", testAppender.getEvents().get(2).getMessage()); + assertEquals(1, testAppender.getEvents().get(2).getKeyValuePairs().size()); + assertEquals("idToken", testAppender.getEvents().get(2).getKeyValuePairs().get(0).key); assertEquals( ComputeEngineCredentialsTest.FULL_ID_TOKEN, - testAppender.events.get(2).getKeyValuePairs().get(0).value); + testAppender.getEvents().get(2).getKeyValuePairs().get(0).value); testAppender.stop(); + testAppender.clearEvents(); } } diff --git a/oauth2_http/javatests/com/google/auth/oauth2/LoggingUtilsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/LoggingUtilsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/LoggingUtilsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/LoggingUtilsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MetricsUtilsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/MetricsUtilsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/MetricsUtilsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/MetricsUtilsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MockExecutor.java b/oauth2_http/src/test/java/com/google/auth/oauth2/MockExecutor.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/MockExecutor.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/MockExecutor.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MockExternalAccountCredentialsTransport.java b/oauth2_http/src/test/java/com/google/auth/oauth2/MockExternalAccountCredentialsTransport.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/MockExternalAccountCredentialsTransport.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/MockExternalAccountCredentialsTransport.java diff --git a/oauth2_http/src/test/java/com/google/auth/oauth2/MockHttpTransportFactory.java b/oauth2_http/src/test/java/com/google/auth/oauth2/MockHttpTransportFactory.java new file mode 100644 index 000000000..27e06257e --- /dev/null +++ b/oauth2_http/src/test/java/com/google/auth/oauth2/MockHttpTransportFactory.java @@ -0,0 +1,46 @@ +/* + * Copyright 2023 Google LLC + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package com.google.auth.oauth2; + +import com.google.api.client.http.HttpTransport; +import com.google.api.client.testing.http.MockHttpTransport; +import com.google.auth.http.HttpTransportFactory; + +public class MockHttpTransportFactory implements HttpTransportFactory { + + MockHttpTransport transport = new MockHttpTransport(); + + @Override + public HttpTransport create() { + return transport; + } +} diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MockIAMCredentialsServiceTransport.java b/oauth2_http/src/test/java/com/google/auth/oauth2/MockIAMCredentialsServiceTransport.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/MockIAMCredentialsServiceTransport.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/MockIAMCredentialsServiceTransport.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MockIAMCredentialsServiceTransportFactory.java b/oauth2_http/src/test/java/com/google/auth/oauth2/MockIAMCredentialsServiceTransportFactory.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/MockIAMCredentialsServiceTransportFactory.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/MockIAMCredentialsServiceTransportFactory.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MockMetadataServerTransport.java b/oauth2_http/src/test/java/com/google/auth/oauth2/MockMetadataServerTransport.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/MockMetadataServerTransport.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/MockMetadataServerTransport.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MockRequestMetadataCallback.java b/oauth2_http/src/test/java/com/google/auth/oauth2/MockRequestMetadataCallback.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/MockRequestMetadataCallback.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/MockRequestMetadataCallback.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MockStsTransport.java b/oauth2_http/src/test/java/com/google/auth/oauth2/MockStsTransport.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/MockStsTransport.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/MockStsTransport.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MockTokenCheckingTransport.java b/oauth2_http/src/test/java/com/google/auth/oauth2/MockTokenCheckingTransport.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/MockTokenCheckingTransport.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/MockTokenCheckingTransport.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/MockTokenServerTransport.java b/oauth2_http/src/test/java/com/google/auth/oauth2/MockTokenServerTransport.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/MockTokenServerTransport.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/MockTokenServerTransport.java diff --git a/oauth2_http/src/test/java/com/google/auth/oauth2/MockTokenServerTransportFactory.java b/oauth2_http/src/test/java/com/google/auth/oauth2/MockTokenServerTransportFactory.java new file mode 100644 index 000000000..f1902b699 --- /dev/null +++ b/oauth2_http/src/test/java/com/google/auth/oauth2/MockTokenServerTransportFactory.java @@ -0,0 +1,45 @@ +/* + * Copyright 2023 Google LLC + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package com.google.auth.oauth2; + +import com.google.api.client.http.HttpTransport; +import com.google.auth.http.HttpTransportFactory; + +public class MockTokenServerTransportFactory implements HttpTransportFactory { + + public MockTokenServerTransport transport = new MockTokenServerTransport(); + + @Override + public HttpTransport create() { + return transport; + } +} diff --git a/oauth2_http/javatests/com/google/auth/oauth2/OAuth2CredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/OAuth2CredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/OAuth2CredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/OAuth2CredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/OAuth2CredentialsWithRefreshTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/OAuth2CredentialsWithRefreshTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/OAuth2CredentialsWithRefreshTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/OAuth2CredentialsWithRefreshTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/OAuth2UtilsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/OAuth2UtilsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/OAuth2UtilsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/OAuth2UtilsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/OAuthExceptionTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/OAuthExceptionTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/OAuthExceptionTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/OAuthExceptionTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/PluggableAuthCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/PluggableAuthCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthExceptionTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/PluggableAuthExceptionTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthExceptionTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/PluggableAuthExceptionTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthHandlerTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/PluggableAuthHandlerTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/PluggableAuthHandlerTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/PluggableAuthHandlerTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/SecureSessionAgentConfigTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/SecureSessionAgentConfigTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/SecureSessionAgentConfigTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/SecureSessionAgentConfigTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/SecureSessionAgentTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/SecureSessionAgentTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/SecureSessionAgentTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/SecureSessionAgentTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ServiceAccountCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/ServiceAccountCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/ServiceAccountCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/ServiceAccountCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ServiceAccountJwtAccessCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/ServiceAccountJwtAccessCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/Slf4jUtilsLogbackTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/Slf4jUtilsLogbackTest.java similarity index 88% rename from oauth2_http/javatests/com/google/auth/oauth2/Slf4jUtilsLogbackTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/Slf4jUtilsLogbackTest.java index fd8ad94af..73e1a3e56 100644 --- a/oauth2_http/javatests/com/google/auth/oauth2/Slf4jUtilsLogbackTest.java +++ b/oauth2_http/src/test/java/com/google/auth/oauth2/Slf4jUtilsLogbackTest.java @@ -77,11 +77,11 @@ void testLogWithMDC_slf4jLogger() { contextMap.put("key2", "value2"); Slf4jUtils.logWithMDC(LOGGER, Level.DEBUG, contextMap, "test message"); - assertEquals(1, testAppender.events.size()); - assertEquals("test message", testAppender.events.get(0).getMessage()); + assertEquals(1, testAppender.getEvents().size()); + assertEquals("test message", testAppender.getEvents().get(0).getMessage()); // Verify MDC content - ILoggingEvent event = testAppender.events.get(0); + ILoggingEvent event = testAppender.getEvents().get(0); assertEquals(2, event.getMDCPropertyMap().size()); assertEquals(ch.qos.logback.classic.Level.DEBUG, event.getLevel()); assertEquals("value1", event.getMDCPropertyMap().get("key1")); @@ -95,8 +95,8 @@ void testLogWithMDC_INFO() { TestAppender testAppender = setupTestLogger(); Slf4jUtils.logWithMDC(LOGGER, Level.INFO, new HashMap<>(), "test message"); - assertEquals(1, testAppender.events.size()); - assertEquals(ch.qos.logback.classic.Level.INFO, testAppender.events.get(0).getLevel()); + assertEquals(1, testAppender.getEvents().size()); + assertEquals(ch.qos.logback.classic.Level.INFO, testAppender.getEvents().get(0).getLevel()); testAppender.stop(); } @@ -105,7 +105,7 @@ void testLogWithMDC_TRACE_notEnabled() { TestAppender testAppender = setupTestLogger(); Slf4jUtils.logWithMDC(LOGGER, Level.TRACE, new HashMap<>(), "test message"); - assertEquals(0, testAppender.events.size()); + assertEquals(0, testAppender.getEvents().size()); testAppender.stop(); } @@ -114,8 +114,8 @@ void testLogWithMDC_WARN() { TestAppender testAppender = setupTestLogger(); Slf4jUtils.logWithMDC(LOGGER, Level.WARN, new HashMap<>(), "test message"); - assertEquals(1, testAppender.events.size()); - assertEquals(ch.qos.logback.classic.Level.WARN, testAppender.events.get(0).getLevel()); + assertEquals(1, testAppender.getEvents().size()); + assertEquals(ch.qos.logback.classic.Level.WARN, testAppender.getEvents().get(0).getLevel()); testAppender.stop(); } @@ -124,8 +124,8 @@ void testLogWithMDC_ERROR() { TestAppender testAppender = setupTestLogger(); Slf4jUtils.logWithMDC(LOGGER, Level.ERROR, new HashMap<>(), "test message"); - assertEquals(1, testAppender.events.size()); - assertEquals(ch.qos.logback.classic.Level.ERROR, testAppender.events.get(0).getLevel()); + assertEquals(1, testAppender.getEvents().size()); + assertEquals(ch.qos.logback.classic.Level.ERROR, testAppender.getEvents().get(0).getLevel()); testAppender.stop(); } @@ -145,8 +145,8 @@ void testLogGenericData() { when(loggerProvider.getLogger()).thenReturn(LOGGER); LoggingUtils.logResponsePayload(data, loggerProvider, "test generic data"); - assertEquals(1, testAppender.events.size()); - List keyValuePairs = testAppender.events.get(0).getKeyValuePairs(); + assertEquals(1, testAppender.getEvents().size()); + List keyValuePairs = testAppender.getEvents().get(0).getKeyValuePairs(); assertEquals(2, keyValuePairs.size()); for (KeyValuePair kvp : keyValuePairs) { assertTrue( @@ -180,11 +180,11 @@ void testLogRequest() throws IOException { when(loggerProvider.getLogger()).thenReturn(LOGGER); LoggingUtils.logRequest(request, loggerProvider, "test log request"); - assertEquals(1, testAppender.events.size()); - assertEquals("test log request", testAppender.events.get(0).getMessage()); - List keyValuePairs = testAppender.events.get(0).getKeyValuePairs(); + assertEquals(1, testAppender.getEvents().size()); + assertEquals("test log request", testAppender.getEvents().get(0).getMessage()); + List keyValuePairs = testAppender.getEvents().get(0).getKeyValuePairs(); assertEquals(4, keyValuePairs.size()); - for (KeyValuePair kvp : testAppender.events.get(0).getKeyValuePairs()) { + for (KeyValuePair kvp : testAppender.getEvents().get(0).getKeyValuePairs()) { assertTrue( kvp.key.equals("request.headers") || kvp.key.equals("request.payload") diff --git a/oauth2_http/javatests/com/google/auth/oauth2/Slf4jUtilsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/Slf4jUtilsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/Slf4jUtilsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/Slf4jUtilsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/StsRequestHandlerTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/StsRequestHandlerTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/StsRequestHandlerTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/StsRequestHandlerTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/TestAppender.java b/oauth2_http/src/test/java/com/google/auth/oauth2/TestAppender.java similarity index 94% rename from oauth2_http/javatests/com/google/auth/oauth2/TestAppender.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/TestAppender.java index aef72daa7..e77cc6e48 100644 --- a/oauth2_http/javatests/com/google/auth/oauth2/TestAppender.java +++ b/oauth2_http/src/test/java/com/google/auth/oauth2/TestAppender.java @@ -38,7 +38,7 @@ /** Logback appender used to set up tests. */ class TestAppender extends AppenderBase { - public List events = new ArrayList<>(); + private final List events = new ArrayList<>(); @Override protected void append(ILoggingEvent eventObject) { @@ -47,6 +47,10 @@ protected void append(ILoggingEvent eventObject) { events.add(eventObject); } + List getEvents() { + return events; + } + public void clearEvents() { events.clear(); } diff --git a/oauth2_http/src/test/java/com/google/auth/oauth2/TestEnvironmentProvider.java b/oauth2_http/src/test/java/com/google/auth/oauth2/TestEnvironmentProvider.java new file mode 100644 index 000000000..4a6b87a76 --- /dev/null +++ b/oauth2_http/src/test/java/com/google/auth/oauth2/TestEnvironmentProvider.java @@ -0,0 +1,50 @@ +/* + * Copyright 2021 Google LLC + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package com.google.auth.oauth2; + +import java.util.HashMap; +import java.util.Map; + +final class TestEnvironmentProvider implements EnvironmentProvider { + + private final Map environmentVariables = new HashMap<>(); + + @Override + public String getEnv(String name) { + return environmentVariables.get(name); + } + + public TestEnvironmentProvider setEnv(String name, String value) { + environmentVariables.put(name, value); + return this; + } +} diff --git a/oauth2_http/javatests/com/google/auth/oauth2/TestUtils.java b/oauth2_http/src/test/java/com/google/auth/oauth2/TestUtils.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/TestUtils.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/TestUtils.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/TokenVerifierTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/TokenVerifierTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/TokenVerifierTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/TokenVerifierTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/UserAuthorizerTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/UserAuthorizerTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/UserAuthorizerTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/UserAuthorizerTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/UserCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/UserCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/UserCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/UserCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/functional/FTComputeEngineCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/functional/FTComputeEngineCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/functional/FTComputeEngineCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/functional/FTComputeEngineCredentialsTest.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/functional/FTQuotaProjectId.java b/oauth2_http/src/test/java/com/google/auth/oauth2/functional/FTQuotaProjectId.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/functional/FTQuotaProjectId.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/functional/FTQuotaProjectId.java diff --git a/oauth2_http/javatests/com/google/auth/oauth2/functional/FTServiceAccountCredentialsTest.java b/oauth2_http/src/test/java/com/google/auth/oauth2/functional/FTServiceAccountCredentialsTest.java similarity index 100% rename from oauth2_http/javatests/com/google/auth/oauth2/functional/FTServiceAccountCredentialsTest.java rename to oauth2_http/src/test/java/com/google/auth/oauth2/functional/FTServiceAccountCredentialsTest.java diff --git a/oauth2_http/testresources/aws_security_credentials.json b/oauth2_http/src/test/resources/aws_security_credentials.json similarity index 100% rename from oauth2_http/testresources/aws_security_credentials.json rename to oauth2_http/src/test/resources/aws_security_credentials.json diff --git a/oauth2_http/testresources/cert.pem b/oauth2_http/src/test/resources/cert.pem similarity index 100% rename from oauth2_http/testresources/cert.pem rename to oauth2_http/src/test/resources/cert.pem diff --git a/oauth2_http/testresources/client_secret.json b/oauth2_http/src/test/resources/client_secret.json similarity index 100% rename from oauth2_http/testresources/client_secret.json rename to oauth2_http/src/test/resources/client_secret.json diff --git a/oauth2_http/testresources/federated_keys.json b/oauth2_http/src/test/resources/federated_keys.json similarity index 100% rename from oauth2_http/testresources/federated_keys.json rename to oauth2_http/src/test/resources/federated_keys.json diff --git a/oauth2_http/testresources/iap_keys.json b/oauth2_http/src/test/resources/iap_keys.json similarity index 100% rename from oauth2_http/testresources/iap_keys.json rename to oauth2_http/src/test/resources/iap_keys.json diff --git a/oauth2_http/src/test/resources/junit-platform.properties b/oauth2_http/src/test/resources/junit-platform.properties new file mode 100644 index 000000000..82de190bf --- /dev/null +++ b/oauth2_http/src/test/resources/junit-platform.properties @@ -0,0 +1,2 @@ +junit.jupiter.execution.parallel.enabled = true +junit.jupiter.execution.parallel.mode.default = concurrent \ No newline at end of file diff --git a/oauth2_http/testresources/legacy_federated_keys.json b/oauth2_http/src/test/resources/legacy_federated_keys.json similarity index 100% rename from oauth2_http/testresources/legacy_federated_keys.json rename to oauth2_http/src/test/resources/legacy_federated_keys.json diff --git a/oauth2_http/testresources/mtlsCertAndKey.pem b/oauth2_http/src/test/resources/mtlsCertAndKey.pem similarity index 100% rename from oauth2_http/testresources/mtlsCertAndKey.pem rename to oauth2_http/src/test/resources/mtlsCertAndKey.pem diff --git a/oauth2_http/testresources/mtls_context_aware_metadata.json b/oauth2_http/src/test/resources/mtls_context_aware_metadata.json similarity index 100% rename from oauth2_http/testresources/mtls_context_aware_metadata.json rename to oauth2_http/src/test/resources/mtls_context_aware_metadata.json diff --git a/oauth2_http/testresources/service_account_keys.json b/oauth2_http/src/test/resources/service_account_keys.json similarity index 100% rename from oauth2_http/testresources/service_account_keys.json rename to oauth2_http/src/test/resources/service_account_keys.json diff --git a/oauth2_http/testresources/trust_chain_with_leaf.pem b/oauth2_http/src/test/resources/trust_chain_with_leaf.pem similarity index 100% rename from oauth2_http/testresources/trust_chain_with_leaf.pem rename to oauth2_http/src/test/resources/trust_chain_with_leaf.pem diff --git a/oauth2_http/testresources/trust_chain_without_leaf.pem b/oauth2_http/src/test/resources/trust_chain_without_leaf.pem similarity index 100% rename from oauth2_http/testresources/trust_chain_without_leaf.pem rename to oauth2_http/src/test/resources/trust_chain_without_leaf.pem diff --git a/oauth2_http/testresources/trust_chain_wrong_order.pem b/oauth2_http/src/test/resources/trust_chain_wrong_order.pem similarity index 100% rename from oauth2_http/testresources/trust_chain_wrong_order.pem rename to oauth2_http/src/test/resources/trust_chain_wrong_order.pem diff --git a/oauth2_http/testresources/x509_intermediate_certificate.pem b/oauth2_http/src/test/resources/x509_intermediate_certificate.pem similarity index 100% rename from oauth2_http/testresources/x509_intermediate_certificate.pem rename to oauth2_http/src/test/resources/x509_intermediate_certificate.pem diff --git a/oauth2_http/testresources/x509_leaf_certificate.pem b/oauth2_http/src/test/resources/x509_leaf_certificate.pem similarity index 100% rename from oauth2_http/testresources/x509_leaf_certificate.pem rename to oauth2_http/src/test/resources/x509_leaf_certificate.pem