public bool CheckAuthentication(string id, string secret) { var authorizationCaches = _auths.Where(p => p.AppID.Equals(id)); if (authorizationCaches.Count() != 0 && !authorizationCaches.First().IsKeyExpired() && !authorizationCaches.First().IsAuthorizationExpired&& authorizationCaches.First().RSAKeys.Any(p => p.ClientIp.Equals(_serviceContext.ClientIP))) { var decryptedSecret = _decryptor.DecryptHttpSecret(secret, authorizationCaches.First().GetPrivateKey()); if (authorizationCaches.First().IsValid(decryptedSecret, _encryptor)) { return(true); } } return(false); }