private boolean deleteTokenCacheItem( String authority, String itemAuthority, String resource, String clientId, String userId, boolean isMultipleResourceRefreshToken) { final AuthenticationContext authContext; try { authContext = getOrCreateContext(authority); } catch (Exception e) { callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, e.getMessage())); return true; } String key = CacheKey.createCacheKey( itemAuthority, resource, clientId, isMultipleResourceRefreshToken, userId); authContext.getCache().removeItem(key); callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK)); return true; }
/** * Static utility for creating the cacheKey. * * @param opName An operation name. * @param request A request object of this operation. * @param accessorCache A CachableValueAccessor for accessing the Cached value. * @return A CacheKey for the given request object. * @throws ServiceException Exception during CacheKey generation. */ public static CacheKey generateCacheKey( String opName, Object request, CachableValueAccessor accessorCache) throws ServiceException { CacheKey key = CacheKey.createCacheKey(opName); evaluateAccessor(request, accessorCache, key, true); return key; }