From ac660f4178b58b4f8c479db7ffc6449080fd109a Mon Sep 17 00:00:00 2001 From: Dan Sanche Date: Thu, 31 Jan 2019 15:29:40 -0800 Subject: [PATCH 01/11] added jwt sample --- endpoints/getting-started/clients/pom.xml | 50 +++++++++++++++++ .../src/main/java/com/example/app/Sample.java | 54 +++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 endpoints/getting-started/clients/pom.xml create mode 100644 endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java diff --git a/endpoints/getting-started/clients/pom.xml b/endpoints/getting-started/clients/pom.xml new file mode 100644 index 00000000000..a47d62a2aa2 --- /dev/null +++ b/endpoints/getting-started/clients/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + com.example + example + 1.0-SNAPSHOT + jar + + + 1.8 + 1.8 + + + + + com.google.api-client + google-api-client + 1.28.0 + + + com.auth0 + java-jwt + 3.7.0 + + + + src + + + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + com.example.app.Sample + + + + + + + diff --git a/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java b/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java new file mode 100644 index 00000000000..703a85806e4 --- /dev/null +++ b/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java @@ -0,0 +1,54 @@ +package com.example.app; + +import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; + +import javax.crypto.spec.SecretKeySpec; +import javax.xml.bind.DatatypeConverter; +import java.security.Key; +import java.io.FileInputStream; +import java.security.interfaces.RSAPrivateKey; + + +import java.util.Date; +import java.util.concurrent.TimeUnit; + +import com.auth0.jwt.algorithms.Algorithm; +import com.auth0.jwt.JWT; +import com.auth0.jwt.JWTCreator; + + +import java.io.FileNotFoundException; +import java.io.IOException; + +public class Sample { + + +// [START endpoints_generate_jwt_sa] + public static String generateJWT(String saKeyfile, String saEmail, String audience, + int expiryLength) throws FileNotFoundException, IOException { + + Date now = new Date(); + Date expiration = new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(expiryLength)); + + JWTCreator.Builder token = JWT.create() + .withIssuedAt(now) + .withExpiresAt(expiration) + .withIssuer(saEmail) + .withAudience(audience) + .withSubject(saEmail) + .withClaim("email", saEmail); + + // sign jwt + GoogleCredential credential = GoogleCredential.fromStream(new FileInputStream(saKeyfile)); + RSAPrivateKey privateKey = (RSAPrivateKey) credential.getServiceAccountPrivateKey(); + Algorithm algorithm = Algorithm.RSA256(null, privateKey); + return token.sign(algorithm); + } +// [END endpoints_generate_jwt_sa] + + public static void main(String[] args) throws Exception { + String jwt = generateJWT("/app/key.json", "iss", "sub", 100); + System.out.println(jwt); + } + +} From 789d4b0692b27303d48f5931082608afe7e05f98 Mon Sep 17 00:00:00 2001 From: Dan Sanche Date: Thu, 31 Jan 2019 15:50:02 -0800 Subject: [PATCH 02/11] added make request function --- .../src/main/java/com/example/app/Sample.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java b/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java index 703a85806e4..60f702b48a5 100644 --- a/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java +++ b/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java @@ -20,6 +20,10 @@ import java.io.FileNotFoundException; import java.io.IOException; + +import java.net.*; +import java.io.*; + public class Sample { @@ -46,6 +50,25 @@ public static String generateJWT(String saKeyfile, String saEmail, String audien } // [END endpoints_generate_jwt_sa] + +// [START endpoints_jwt_request] + public static String makeJWTRequest(String singedJWT, URL url) throws IOException, ProtocolException{ + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setRequestMethod("GET"); + con.setRequestProperty("Content-Type", "application/json"); + con.setRequestProperty("Authorization", "Bearer " + singedJWT); + + BufferedReader rd = new BufferedReader(new InputStreamReader(con.getInputStream())); + String line; + StringBuilder result = new StringBuilder(); + while ((line = rd.readLine()) != null) { + result.append(line); + } + rd.close(); + return result.toString(); + } +// [END endpoints_jwt_request] + public static void main(String[] args) throws Exception { String jwt = generateJWT("/app/key.json", "iss", "sub", 100); System.out.println(jwt); From baf8c876b5728199cf4d8d0043af27393b6e4dc0 Mon Sep 17 00:00:00 2001 From: Dan Sanche Date: Thu, 31 Jan 2019 15:58:51 -0800 Subject: [PATCH 03/11] removed * import --- .../clients/src/main/java/com/example/app/Sample.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java b/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java index 60f702b48a5..47a5c67bfff 100644 --- a/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java +++ b/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java @@ -21,8 +21,11 @@ import java.io.IOException; -import java.net.*; -import java.io.*; +import java.net.URL; +import java.net.HttpURLConnection; +import java.net.ProtocolException; +import java.io.BufferedReader; +import java.io.InputStreamReader; public class Sample { From 8fb81caa5cc4f115699e93f9db29277c0c61aef3 Mon Sep 17 00:00:00 2001 From: Dan Sanche Date: Thu, 31 Jan 2019 16:10:59 -0800 Subject: [PATCH 04/11] use arguments for main function --- .../clients/src/main/java/com/example/app/Sample.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java b/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java index 47a5c67bfff..690acce24ab 100644 --- a/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java +++ b/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java @@ -73,8 +73,16 @@ public static String makeJWTRequest(String singedJWT, URL url) throws IOExceptio // [END endpoints_jwt_request] public static void main(String[] args) throws Exception { - String jwt = generateJWT("/app/key.json", "iss", "sub", 100); + String keyPath = args[0]; + URL host = new URL(args[1]); + String audience = args[2]; + String saEmail = args[3]; + + String jwt = generateJWT(keyPath, saEmail, audience, 3600); System.out.println(jwt); + + String response = makeJWTRequest(jwt, host); + System.out.println(response); } } From 62b972fb7e5424fc9d0aaf8f19a7ffd4bf4f3a6d Mon Sep 17 00:00:00 2001 From: Dan Sanche Date: Thu, 31 Jan 2019 16:20:44 -0800 Subject: [PATCH 05/11] added region tag for auth info server --- .../src/main/java/com/example/endpoints/AuthInfoServlet.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/endpoints/getting-started/src/main/java/com/example/endpoints/AuthInfoServlet.java b/endpoints/getting-started/src/main/java/com/example/endpoints/AuthInfoServlet.java index 60ab50ec354..5ec58b038e1 100644 --- a/endpoints/getting-started/src/main/java/com/example/endpoints/AuthInfoServlet.java +++ b/endpoints/getting-started/src/main/java/com/example/endpoints/AuthInfoServlet.java @@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +// [START endpoints_auth_info_backend] /** * A servlet that returns authentication information. * See openapi.yaml for authentication mechanisms (e.g. JWT tokens, Google ID token). @@ -57,3 +58,4 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc } } } +// [END endpoints_auth_info_backend] From a844bec619e4616041cee774c2db1e8addb68b42 Mon Sep 17 00:00:00 2001 From: Dan Sanche Date: Mon, 4 Feb 2019 13:52:45 -0800 Subject: [PATCH 06/11] added comments --- .../src/main/java/com/example/app/Sample.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java b/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java index 690acce24ab..67a2135ffa5 100644 --- a/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java +++ b/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java @@ -31,17 +31,28 @@ public class Sample { // [START endpoints_generate_jwt_sa] + /* + * Generates a signed JSON Web Token using a Google API Service Account + * utilizes com.auth0.jwt + */ public static String generateJWT(String saKeyfile, String saEmail, String audience, int expiryLength) throws FileNotFoundException, IOException { Date now = new Date(); Date expiration = new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(expiryLength)); + // build jwt JWTCreator.Builder token = JWT.create() .withIssuedAt(now) + // expires after 'expirary_length' seconds. .withExpiresAt(expiration) + // must match 'issuer' in the security configuration in your + // swagger spec (e.g. service account email). It can be any string .withIssuer(saEmail) + // must be either your Endpoints service name, or match the value + // specified as the 'x-google-audience' in the OpenAPI document. .withAudience(audience) + // subject and email should match the service account's email .withSubject(saEmail) .withClaim("email", saEmail); @@ -55,6 +66,9 @@ public static String generateJWT(String saKeyfile, String saEmail, String audien // [START endpoints_jwt_request] + /* + * Makes an authorized request to the endpoint + */ public static String makeJWTRequest(String singedJWT, URL url) throws IOException, ProtocolException{ HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); From 5441897566a301e1bb4b97b4b3512ac65c54c0eb Mon Sep 17 00:00:00 2001 From: Dan Sanche Date: Mon, 4 Feb 2019 14:07:31 -0800 Subject: [PATCH 07/11] renames file --- endpoints/getting-started/clients/pom.xml | 2 +- .../main/java/com/example/app/{Sample.java => JWTClient.java} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename endpoints/getting-started/clients/src/main/java/com/example/app/{Sample.java => JWTClient.java} (99%) diff --git a/endpoints/getting-started/clients/pom.xml b/endpoints/getting-started/clients/pom.xml index a47d62a2aa2..e48a087a99a 100644 --- a/endpoints/getting-started/clients/pom.xml +++ b/endpoints/getting-started/clients/pom.xml @@ -40,7 +40,7 @@ exec-maven-plugin 1.2.1 - com.example.app.Sample + com.example.app.JWTClient diff --git a/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java b/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java similarity index 99% rename from endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java rename to endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java index 67a2135ffa5..94f086156f3 100644 --- a/endpoints/getting-started/clients/src/main/java/com/example/app/Sample.java +++ b/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java @@ -27,7 +27,7 @@ import java.io.BufferedReader; import java.io.InputStreamReader; -public class Sample { +public class JWTClient { // [START endpoints_generate_jwt_sa] From b15d7652c7aa1edaa7a5973c115bc2aa481165d3 Mon Sep 17 00:00:00 2001 From: Dan Sanche Date: Wed, 6 Feb 2019 17:26:57 -0800 Subject: [PATCH 08/11] addressed checkstyle issues --- .../main/java/com/example/app/JWTClient.java | 67 ++++++++++--------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java b/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java index 94f086156f3..a7fd0d1cb3f 100644 --- a/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java +++ b/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java @@ -2,9 +2,6 @@ import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; -import javax.crypto.spec.SecretKeySpec; -import javax.xml.bind.DatatypeConverter; -import java.security.Key; import java.io.FileInputStream; import java.security.interfaces.RSAPrivateKey; @@ -27,66 +24,74 @@ import java.io.BufferedReader; import java.io.InputStreamReader; +/** + * JWTClient shows how a client can authenticate with a Cloud Endpoints service + */ public class JWTClient { - // [START endpoints_generate_jwt_sa] - /* + /** * Generates a signed JSON Web Token using a Google API Service Account - * utilizes com.auth0.jwt + * utilizes com.auth0.jwt. */ - public static String generateJWT(String saKeyfile, String saEmail, String audience, - int expiryLength) throws FileNotFoundException, IOException { + public static String generateJWT(final String saKeyfile, final String saEmail, + final String audience, final int expiryLength) + throws FileNotFoundException, IOException { Date now = new Date(); - Date expiration = new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(expiryLength)); + Date expTime = new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(expiryLength)); // build jwt JWTCreator.Builder token = JWT.create() - .withIssuedAt(now) - // expires after 'expirary_length' seconds. - .withExpiresAt(expiration) - // must match 'issuer' in the security configuration in your - // swagger spec (e.g. service account email). It can be any string - .withIssuer(saEmail) - // must be either your Endpoints service name, or match the value - // specified as the 'x-google-audience' in the OpenAPI document. - .withAudience(audience) - // subject and email should match the service account's email - .withSubject(saEmail) - .withClaim("email", saEmail); + .withIssuedAt(now) + // expires after 'expirary_length' seconds. + .withExpiresAt(expTime) + // must match 'issuer' in the security configuration in your + // swagger spec (e.g. service account email). It can be any string + .withIssuer(saEmail) + // must be either your Endpoints service name, or match the value + // specified as the 'x-google-audience' in the OpenAPI document. + .withAudience(audience) + // subject and email should match the service account's email + .withSubject(saEmail) + .withClaim("email", saEmail); // sign jwt - GoogleCredential credential = GoogleCredential.fromStream(new FileInputStream(saKeyfile)); - RSAPrivateKey privateKey = (RSAPrivateKey) credential.getServiceAccountPrivateKey(); - Algorithm algorithm = Algorithm.RSA256(null, privateKey); + FileInputStream stream = new FileInputStream(saKeyfile); + GoogleCredential cred = GoogleCredential.fromStream(stream); + RSAPrivateKey key = (RSAPrivateKey) cred.getServiceAccountPrivateKey(); + Algorithm algorithm = Algorithm.RSA256(null, key); return token.sign(algorithm); } // [END endpoints_generate_jwt_sa] // [START endpoints_jwt_request] - /* - * Makes an authorized request to the endpoint + /** + * Makes an authorized request to the endpoint. */ - public static String makeJWTRequest(String singedJWT, URL url) throws IOException, ProtocolException{ + public static String makeJWTRequest(final String singedJWT, final URL url) + throws IOException, ProtocolException { + HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("Content-Type", "application/json"); con.setRequestProperty("Authorization", "Bearer " + singedJWT); - BufferedReader rd = new BufferedReader(new InputStreamReader(con.getInputStream())); + InputStreamReader reader = new InputStreamReader(con.getInputStream()); + BufferedReader buffReader = new BufferedReader(reader); + String line; StringBuilder result = new StringBuilder(); - while ((line = rd.readLine()) != null) { + while ((line = buffReader.readLine()) != null) { result.append(line); } - rd.close(); + buffReader.close(); return result.toString(); } // [END endpoints_jwt_request] - public static void main(String[] args) throws Exception { + public static void main(final String[] args) throws Exception { String keyPath = args[0]; URL host = new URL(args[1]); String audience = args[2]; From 38f53a8fa559c18bba322abbd745281cf5b34fe8 Mon Sep 17 00:00:00 2001 From: Dan Sanche Date: Wed, 6 Feb 2019 17:27:11 -0800 Subject: [PATCH 09/11] added copyright header --- .../src/main/java/com/example/app/JWTClient.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java b/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java index a7fd0d1cb3f..d610c85975c 100644 --- a/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java +++ b/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java @@ -1,3 +1,19 @@ +/* + * Copyright 2018 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.example.app; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; From 0abb29714aa793f1a909ee4fa73e6bd4babe2725 Mon Sep 17 00:00:00 2001 From: Dan Sanche Date: Fri, 8 Feb 2019 11:46:03 -0800 Subject: [PATCH 10/11] addressed PR comments --- endpoints/getting-started/clients/pom.xml | 14 +++- .../main/java/com/example/app/JWTClient.java | 81 +++++++------------ 2 files changed, 44 insertions(+), 51 deletions(-) diff --git a/endpoints/getting-started/clients/pom.xml b/endpoints/getting-started/clients/pom.xml index e48a087a99a..c2949fb2582 100644 --- a/endpoints/getting-started/clients/pom.xml +++ b/endpoints/getting-started/clients/pom.xml @@ -6,6 +6,18 @@ example 1.0-SNAPSHOT jar + + + + + com.google.cloud.samples + shared-configuration + 1.0.10 + + 1.8 @@ -40,7 +52,7 @@ exec-maven-plugin 1.2.1 - com.example.app.JWTClient + com.example.app.JwtClient diff --git a/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java b/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java index d610c85975c..c03ace24151 100644 --- a/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java +++ b/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 Google LLC. + * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,83 +16,78 @@ package com.example.app; +import com.auth0.jwt.JWT; +import com.auth0.jwt.JWTCreator; +import com.auth0.jwt.algorithms.Algorithm; import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; +import java.io.BufferedReader; import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.ProtocolException; +import java.net.URL; import java.security.interfaces.RSAPrivateKey; - - import java.util.Date; import java.util.concurrent.TimeUnit; -import com.auth0.jwt.algorithms.Algorithm; -import com.auth0.jwt.JWT; -import com.auth0.jwt.JWTCreator; - - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.net.URL; -import java.net.HttpURLConnection; -import java.net.ProtocolException; -import java.io.BufferedReader; -import java.io.InputStreamReader; - /** * JWTClient shows how a client can authenticate with a Cloud Endpoints service */ -public class JWTClient { +public class JwtClient { -// [START endpoints_generate_jwt_sa] + // [START endpoints_generate_jwt_sa] /** * Generates a signed JSON Web Token using a Google API Service Account * utilizes com.auth0.jwt. */ - public static String generateJWT(final String saKeyfile, final String saEmail, - final String audience, final int expiryLength) - throws FileNotFoundException, IOException { + public static String generateJwt(final String saKeyfile, final String saEmail, + final String audience, final int expiryLength) + throws FileNotFoundException, IOException { Date now = new Date(); Date expTime = new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(expiryLength)); - // build jwt + // Build the JWT payload JWTCreator.Builder token = JWT.create() .withIssuedAt(now) - // expires after 'expirary_length' seconds. + // Expires after 'expiraryLength' seconds .withExpiresAt(expTime) - // must match 'issuer' in the security configuration in your - // swagger spec (e.g. service account email). It can be any string + // Must match 'issuer' in the security configuration in your + // swagger spec (e.g. service account email) .withIssuer(saEmail) - // must be either your Endpoints service name, or match the value - // specified as the 'x-google-audience' in the OpenAPI document. + // Must be either your Endpoints service name, or match the value + // specified as the 'x-google-audience' in the OpenAPI document .withAudience(audience) - // subject and email should match the service account's email + // Subject and email should match the service account's email .withSubject(saEmail) .withClaim("email", saEmail); - // sign jwt + // Sign the JWT with a service account FileInputStream stream = new FileInputStream(saKeyfile); GoogleCredential cred = GoogleCredential.fromStream(stream); RSAPrivateKey key = (RSAPrivateKey) cred.getServiceAccountPrivateKey(); Algorithm algorithm = Algorithm.RSA256(null, key); return token.sign(algorithm); } -// [END endpoints_generate_jwt_sa] + // [END endpoints_generate_jwt_sa] -// [START endpoints_jwt_request] + // [START endpoints_jwt_request] /** * Makes an authorized request to the endpoint. */ - public static String makeJWTRequest(final String singedJWT, final URL url) - throws IOException, ProtocolException { + public static String makeJwtRequest(final String singedJwt, final URL url) + throws IOException, ProtocolException { HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("Content-Type", "application/json"); - con.setRequestProperty("Authorization", "Bearer " + singedJWT); + con.setRequestProperty("Authorization", "Bearer " + singedJwt); InputStreamReader reader = new InputStreamReader(con.getInputStream()); BufferedReader buffReader = new BufferedReader(reader); @@ -100,24 +95,10 @@ public static String makeJWTRequest(final String singedJWT, final URL url) String line; StringBuilder result = new StringBuilder(); while ((line = buffReader.readLine()) != null) { - result.append(line); + result.append(line); } buffReader.close(); return result.toString(); } -// [END endpoints_jwt_request] - - public static void main(final String[] args) throws Exception { - String keyPath = args[0]; - URL host = new URL(args[1]); - String audience = args[2]; - String saEmail = args[3]; - - String jwt = generateJWT(keyPath, saEmail, audience, 3600); - System.out.println(jwt); - - String response = makeJWTRequest(jwt, host); - System.out.println(response); - } - + // [END endpoints_jwt_request] } From 510d311c135310c9cf0c55251f95d8d064121f03 Mon Sep 17 00:00:00 2001 From: Dan Sanche Date: Fri, 8 Feb 2019 11:59:27 -0800 Subject: [PATCH 11/11] renamed class to be consistent with python --- endpoints/getting-started/clients/pom.xml | 2 +- .../com/example/app/{JWTClient.java => GoogleJwtClient.java} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename endpoints/getting-started/clients/src/main/java/com/example/app/{JWTClient.java => GoogleJwtClient.java} (99%) diff --git a/endpoints/getting-started/clients/pom.xml b/endpoints/getting-started/clients/pom.xml index c2949fb2582..1e552e43c35 100644 --- a/endpoints/getting-started/clients/pom.xml +++ b/endpoints/getting-started/clients/pom.xml @@ -52,7 +52,7 @@ exec-maven-plugin 1.2.1 - com.example.app.JwtClient + com.example.app.GoogleJwtClient diff --git a/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java b/endpoints/getting-started/clients/src/main/java/com/example/app/GoogleJwtClient.java similarity index 99% rename from endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java rename to endpoints/getting-started/clients/src/main/java/com/example/app/GoogleJwtClient.java index c03ace24151..53ad742c8f7 100644 --- a/endpoints/getting-started/clients/src/main/java/com/example/app/JWTClient.java +++ b/endpoints/getting-started/clients/src/main/java/com/example/app/GoogleJwtClient.java @@ -38,7 +38,7 @@ /** * JWTClient shows how a client can authenticate with a Cloud Endpoints service */ -public class JwtClient { +public class GoogleJwtClient { // [START endpoints_generate_jwt_sa] /**