src/main/java/com/googlesource/gerrit/plugins/oauth/DexOAuthService.java [81:109]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private String parseJwt(String input) throws UnsupportedEncodingException {
    String[] parts = input.split("\\.");
    Preconditions.checkState(parts.length == 3);
    Preconditions.checkNotNull(parts[1]);
    return new String(Base64.decodeBase64(parts[1]), StandardCharsets.UTF_8.name());
  }

  @Override
  public OAuthUserInfo getUserInfo(OAuthToken token) throws IOException {
    JsonElement tokenJson = JSON.newGson().fromJson(token.getRaw(), JsonElement.class);
    JsonObject tokenObject = tokenJson.getAsJsonObject();
    JsonElement id_token = tokenObject.get("id_token");

    String jwt;
    try {
      jwt = parseJwt(id_token.getAsString());
    } catch (UnsupportedEncodingException e) {
      throw new IOException(
          String.format(
              "%s support is required to interact with JWTs", StandardCharsets.UTF_8.name()),
          e);
    }

    JsonElement claimJson = JSON.newGson().fromJson(jwt, JsonElement.class);

    // Dex does not support basic profile currently (2017-09), extracting info
    // from access token claim

    JsonObject claimObject = claimJson.getAsJsonObject();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/main/java/com/googlesource/gerrit/plugins/oauth/KeycloakOAuthService.java [80:104]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private String parseJwt(String input) throws UnsupportedEncodingException {
    String[] parts = input.split("\\.");
    Preconditions.checkState(parts.length == 3);
    Preconditions.checkNotNull(parts[1]);
    return new String(Base64.decodeBase64(parts[1]), StandardCharsets.UTF_8.name());
  }

  @Override
  public OAuthUserInfo getUserInfo(OAuthToken token) throws IOException {
    JsonElement tokenJson = JSON.newGson().fromJson(token.getRaw(), JsonElement.class);
    JsonObject tokenObject = tokenJson.getAsJsonObject();
    JsonElement id_token = tokenObject.get("id_token");
    String jwt;
    try {
      jwt = parseJwt(id_token.getAsString());
    } catch (UnsupportedEncodingException e) {
      throw new IOException(
          String.format(
              "%s support is required to interact with JWTs", StandardCharsets.UTF_8.name()),
          e);
    }

    JsonElement claimJson = JSON.newGson().fromJson(jwt, JsonElement.class);

    JsonObject claimObject = claimJson.getAsJsonObject();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



