public void WhenGetClientWithUnknownUserName_ThenReturnsNull()
            {
                manager.Setup(uam => uam.GetClientApplication(It.IsAny <string>()))
                .Returns((IClientApplication)null);

                IClientDescription result = store.GetClient("foo");

                Assert.Null(result);
            }
Beispiel #2
0
        // Lookup client given an identifier
        public IClientDescription GetClient(string clientIdentifier)
        {
            IClientDescription client = _clientRepository.GetById(clientIdentifier);

            if (client == null)
            {
                throw new ArgumentOutOfRangeException("clientIdentifier");
            }
            return(client);
        }
Beispiel #3
0
            public void WhenGetClientWithKnownClientIdentifier_ThenReturnsClient()
            {
                var description = new Mock <IClientDescription>();

                clientStore.Setup(cs => cs.GetClient(It.IsAny <string>()))
                .Returns(description.Object);

                IClientDescription result = server.GetClient("foo");

                Assert.NotNull(description.Object);
            }
            public void WhenGetClientProfileWithKnownUserName_ThenReturnsUserAuthInfo()
            {
                var userAccount = new ClientApplication
                {
                    Id = "fooid",
                    ClientIdentifier = "foo",
                    ClientSecret     = "bar",
                    Name             = "bar2",
                };

                manager.Setup(uam => uam.GetClientApplicationByClientIdentifier(It.IsAny <string>()))
                .Returns(userAccount);

                IClientDescription result = store.GetClient("foo");

                Assert.Equal(ClientType.Confidential, result.ClientType);
                Assert.Null(result.DefaultCallback);
                Assert.True(result.HasNonEmptySecret);
                Assert.True(result.IsValidClientSecret("bar"));
            }