GoogleAuth { static boolean checkAudience(String audience, List<String> allowedAudiences, String clientId) { if (Strings.isWhitelisted(audience, allowedAudiences)) { return true; } if (!Strings.isEmptyOrWhitespace(audience) && audience.equals(clientId)) { return true; } return false; }  static String getAuthToken(HttpServletRequest request); static boolean isJwt(String token); static boolean isOAuth2Token(String token); static TokenInfo getTokenInfoRemote(String token);  }
@Test public void testCheckAudience() { assertFalse(GoogleAuth.checkAudience(AUDIENCE1, ImmutableList.<String>of(), CLIENT_ID1)); assertFalse(GoogleAuth.checkAudience(AUDIENCE1, null, CLIENT_ID1)); assertFalse(GoogleAuth.checkAudience("", AUDIENCE_LIST, CLIENT_ID1)); assertFalse(GoogleAuth.checkAudience(null, AUDIENCE_LIST, CLIENT_ID1)); assertTrue(GoogleAuth.checkAudience(AUDIENCE1, AUDIENCE_LIST, CLIENT_ID1)); assertFalse(GoogleAuth.checkAudience(AUDIENCE2, AUDIENCE_LIST, CLIENT_ID1)); assertTrue(GoogleAuth.checkAudience(CLIENT_ID1, AUDIENCE_LIST, CLIENT_ID1)); }