Пример #1
0
        public void InvalidFormatNonceWhenUserSigninRequestThrows()
        {
            IList <IPayloadClaimsManager> nonceClaimBehaviors = new List <IPayloadClaimsManager>
            {
                InvalidNoncePayloadClaim.WithClaimBehavior(() => "gXjyhrYqannHUA$LLV&7guTHmF&1X5JB$Uobx3@!rPn9&x4BzE"),
                InvalidNoncePayloadClaim.WithClaimBehavior(() => $"{Guid.NewGuid()}-{Guid.NewGuid()}-{Guid.NewGuid()}")
            };

            foreach (IPayloadClaimsManager behavior in nonceClaimBehaviors)
            {
                ServiceLocator.Instance.RegisterPayloadClaimsManager(behavior);
                AspenException exception = Assert.Throws <AspenException>(() => GetDelegatedClient());
                Assert.That(exception.EventId, Is.EqualTo("15852"));
                Assert.That(exception.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));
                StringAssert.IsMatch("'Nonce' debe coincidir con el patrón", exception.Message);
            }
        }
Пример #2
0
        public void NullOrEmptyNonceWhenUserSigninRequestThrows()
        {
            IList <IPayloadClaimsManager> nonceClaimBehaviors = new List <IPayloadClaimsManager>()
            {
                InvalidNoncePayloadClaim.WithClaimBehavior(() => null),
                InvalidNoncePayloadClaim.WithClaimBehavior(() => string.Empty),
                InvalidNoncePayloadClaim.WithClaimBehavior(() => "     ")
            };

            foreach (IPayloadClaimsManager behavior in nonceClaimBehaviors)
            {
                ServiceLocator.Instance.RegisterPayloadClaimsManager(behavior);
                AspenException exception = Assert.Throws <AspenException>(() => GetDelegatedClient());
                Assert.That(exception.EventId, Is.EqualTo("15852"));
                Assert.That(exception.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));
                StringAssert.IsMatch("'Nonce' no puede ser nulo ni vacío", exception.Message);
            }
        }
        public void NullOrEmptyNonceWhenSignedRequestThrows()
        {
            IAutonomousApp client = this.GetAutonomousClient();
            IList <IPayloadClaimsManager> payloadBehaviors = new List <IPayloadClaimsManager>()
            {
                InvalidNoncePayloadClaim.WithClaimBehavior(() => null),
                InvalidNoncePayloadClaim.WithClaimBehavior(() => string.Empty),
                InvalidNoncePayloadClaim.WithClaimBehavior(() => "     ")
            };

            foreach (IPayloadClaimsManager behavior in payloadBehaviors)
            {
                ServiceLocator.Instance.RegisterPayloadClaimsManager(behavior);
                AspenException exception = Assert.Throws <AspenException>(() => client.Settings.GetDocTypes());
                Assert.That(exception.EventId, Is.EqualTo("15852"));
                Assert.That(exception.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));
                StringAssert.IsMatch("'Nonce' no puede ser nulo ni vacío", exception.Message);
            }
        }