public bool TryAuthenticate(string key, string secret, out ApiClientIdentity authenticatedApiClientIdentity)
        {
            authenticatedApiClientIdentity = null;
            ApiClientSecret apiClientSecret;

            try
            {
                apiClientSecret = _apiClientSecretProvider.GetSecret(key);
            }
            catch (ArgumentException)
            {
                return(false);
            }

            if (!_secretVerifier.VerifySecret(key, secret, apiClientSecret))
            {
                return(false);
            }

            authenticatedApiClientIdentity = _apiClientIdentityProvider.GetApiClientIdentity(key);
            return(true);
        }
Esempio n. 2
0
 protected override void Act()
 {
     _apiClientSecretProvider.GetSecret("InvalidKey");
 }
Esempio n. 3
0
 protected override void Act()
 {
     _apiClientSecretProvider.GetSecret(null);
 }
Esempio n. 4
0
 protected override void Act()
 {
     _apiClientSecretProvider.GetSecret(string.Empty);
 }
Esempio n. 5
0
 protected override void Act()
 {
     _actualApiClientSecret = _apiClientSecretProvider.GetSecret(_testClient.Key);
 }