Example #1
0
  private String[] getReferrer() {
    String referrer = uriInfo.getQueryParameters().getFirst("referrer");
    if (referrer == null) {
      return null;
    }

    String referrerUri = uriInfo.getQueryParameters().getFirst("referrer_uri");

    ClientModel referrerClient = realm.getClientByClientId(referrer);
    if (referrerClient != null) {
      if (referrerUri != null) {
        referrerUri = RedirectUtils.verifyRedirectUri(uriInfo, referrerUri, realm, referrerClient);
      } else {
        referrerUri =
            ResolveRelative.resolveRelativeUri(
                uriInfo.getRequestUri(), client.getRootUrl(), referrerClient.getBaseUrl());
      }

      if (referrerUri != null) {
        return new String[] {referrer, referrerUri};
      }
    } else if (referrerUri != null) {
      referrerClient = realm.getClientByClientId(referrer);
      if (client != null) {
        referrerUri = RedirectUtils.verifyRedirectUri(uriInfo, referrerUri, realm, referrerClient);

        if (referrerUri != null) {
          return new String[] {referrer, referrerUri};
        }
      }
    }

    return null;
  }
Example #2
0
 @Override
 public String getBaseUrl() {
   if (updated != null) return updated.getBaseUrl();
   return cached.getBaseUrl();
 }