code: protected boolean redirectMatches(String requestedRedirect, String redirectUri) {
          try {
              URL req = new URL(requestedRedirect);
              URL reg = new URL(redirectUri);
  
              int requestedPort = req.getPort() != -1 ? req.getPort() : req.getDefaultPort();
              int registeredPort = reg.getPort() != -1 ? reg.getPort() : reg.getDefaultPort();
  
              boolean portsMatch = matchPorts ? (registeredPort == requestedPort) : true;
  
              if (reg.getProtocol().equals(req.getProtocol()) &&
                      hostMatches(reg.getHost(), req.getHost()) &&
                      portsMatch) {
                  return StringUtils.cleanPath(req.getPath()).startsWith(StringUtils.cleanPath(reg.getPath()));
              }
          }
          catch (MalformedURLException e) {
          }
          return requestedRedirect.equals(redirectUri);
      }
docs: Whether the requested redirect URI "matches" the specified redirect URI. For a URL, this implementation tests if
  the user requested redirect starts with the registered redirect, so it would have the same host and root path if
  it is an HTTP URL. The port is also matched.
  <p>
  For other (non-URL) cases, such as for some implicit clients, the redirect_uri must be an exact match.
  
  @param requestedRedirect The requested redirect URI.
  @param redirectUri The registered redirect URI.
  @return Whether the requested redirect URI "matches" the specified redirect URI.