public async Task <NonceContract> CreateAsync( int userId, NonceTypeEnum nonceType ) { var nonceContract = new NonceContract { UserId = userId, Type = nonceType, }; using (var nonceResponse = await m_authorizationServiceHttpClient.SendRequestAsync(HttpMethod.Post, $"{BasePath}create", nonceContract)) { return(await m_authorizationServiceHttpClient.GetDeserializedModelAsync <NonceContract>(nonceResponse)); } }
public bool IsNonceKeyValid(string nonce, int userId, NonceTypeEnum nonceType) { if (nonce == null) { throw new ArgumentException(); } if (m_memoryCache.TryGetValue(nonce, out NonceContract nonceContract)) { var isValid = nonceContract.UserId == userId && nonceContract.Type == nonceType; m_memoryCache.Remove(nonce); return(isValid); } return(false); }
public bool IsNonceKeyValid(string nonce, NonceTypeEnum nonceType) { return(IsNonceKeyValid(nonce, 0, nonceType)); }