@Test public void serviceUri() throws Exception { GoogleAuthLibraryCallCredentials callCredentials = new GoogleAuthLibraryCallCredentials(credentials); callCredentials.applyRequestMetadata( new RequestInfoImpl("example.com:443"), executor, applier); verify(credentials).getRequestMetadata(eq(new URI("https: callCredentials.applyRequestMetadata( new RequestInfoImpl("example.com:123"), executor, applier); verify(credentials).getRequestMetadata(eq(new URI("https: }
private static URI serviceUri(String authority, MethodDescriptor<?, ?> method) throws StatusException { final String scheme = "https"; final int defaultPort = 443; String path = "/" + MethodDescriptor.extractFullServiceName(method.getFullMethodName()); URI uri; try { uri = new URI(scheme, authority, path, null, null); } catch (URISyntaxException e) { throw Status.UNAUTHENTICATED.withDescription("Unable to construct service URI for auth") .withCause(e).asException(); } if (uri.getPort() == defaultPort) { uri = removePort(uri); } return uri; }
GoogleAuthLibraryCallCredentials extends CallCredentials2 { private static URI serviceUri(String authority, MethodDescriptor<?, ?> method) throws StatusException { final String scheme = "https"; final int defaultPort = 443; String path = "/" + MethodDescriptor.extractFullServiceName(method.getFullMethodName()); URI uri; try { uri = new URI(scheme, authority, path, null, null); } catch (URISyntaxException e) { throw Status.UNAUTHENTICATED.withDescription("Unable to construct service URI for auth") .withCause(e).asException(); } if (uri.getPort() == defaultPort) { uri = removePort(uri); } return uri; } }
GoogleAuthLibraryCallCredentials extends CallCredentials2 { private static URI serviceUri(String authority, MethodDescriptor<?, ?> method) throws StatusException { final String scheme = "https"; final int defaultPort = 443; String path = "/" + MethodDescriptor.extractFullServiceName(method.getFullMethodName()); URI uri; try { uri = new URI(scheme, authority, path, null, null); } catch (URISyntaxException e) { throw Status.UNAUTHENTICATED.withDescription("Unable to construct service URI for auth") .withCause(e).asException(); } if (uri.getPort() == defaultPort) { uri = removePort(uri); } return uri; } GoogleAuthLibraryCallCredentials(Credentials creds); @VisibleForTesting  GoogleAuthLibraryCallCredentials(Credentials creds, JwtHelper jwtHelper); }
GoogleAuthLibraryCallCredentials extends CallCredentials2 { private static URI serviceUri(String authority, MethodDescriptor<?, ?> method) throws StatusException { final String scheme = "https"; final int defaultPort = 443; String path = "/" + MethodDescriptor.extractFullServiceName(method.getFullMethodName()); URI uri; try { uri = new URI(scheme, authority, path, null, null); } catch (URISyntaxException e) { throw Status.UNAUTHENTICATED.withDescription("Unable to construct service URI for auth") .withCause(e).asException(); } if (uri.getPort() == defaultPort) { uri = removePort(uri); } return uri; } GoogleAuthLibraryCallCredentials(Credentials creds); @VisibleForTesting  GoogleAuthLibraryCallCredentials(Credentials creds, JwtHelper jwtHelper); @Override void thisUsesUnstableApi(); @Override void applyRequestMetadata(
      RequestInfo info, Executor appExecutor, final MetadataApplier applier); }
GoogleAuthLibraryCallCredentials extends CallCredentials2 { private static URI serviceUri(String authority, MethodDescriptor<?, ?> method) throws StatusException { final String scheme = "https"; final int defaultPort = 443; String path = "/" + MethodDescriptor.extractFullServiceName(method.getFullMethodName()); URI uri; try { uri = new URI(scheme, authority, path, null, null); } catch (URISyntaxException e) { throw Status.UNAUTHENTICATED.withDescription("Unable to construct service URI for auth") .withCause(e).asException(); } if (uri.getPort() == defaultPort) { uri = removePort(uri); } return uri; } GoogleAuthLibraryCallCredentials(Credentials creds); @VisibleForTesting  GoogleAuthLibraryCallCredentials(Credentials creds, JwtHelper jwtHelper); @Override void thisUsesUnstableApi(); @Override void applyRequestMetadata(
      RequestInfo info, Executor appExecutor, final MetadataApplier applier);  }