/**
   * @param key
   * @param authenticationResult
   */
  public static void addAuthenticationResultToCache(
      String key, AuthenticationResult authenticationResult) {

    AuthenticationResultCacheKey cacheKey = new AuthenticationResultCacheKey(key);
    AuthenticationResultCacheEntry cacheEntry = new AuthenticationResultCacheEntry();
    cacheEntry.setResult(authenticationResult);
    AuthenticationResultCache.getInstance().addToCache(cacheKey, cacheEntry);
  }
  private AuthenticationResult getAuthenticationResultFromCache(String sessionDataKey) {

    AuthenticationResultCacheKey authResultCacheKey =
        new AuthenticationResultCacheKey(sessionDataKey);
    CacheEntry cacheEntry =
        AuthenticationResultCache.getInstance(0).getValueFromCache(authResultCacheKey);
    AuthenticationResult authResult = null;

    if (cacheEntry != null) {
      AuthenticationResultCacheEntry authResultCacheEntry =
          (AuthenticationResultCacheEntry) cacheEntry;
      authResult = authResultCacheEntry.getResult();
    } else {
      log.error("Cannot find AuthenticationResult from the cache");
    }

    return authResult;
  }