Example #1
0
        public async Task <Response <List <UserProfileBrief> > > GetAllUsers(AuthenticationTokenRequest request)
        {
            HttpRequestMessage httpRequestMessage = BuildRequestMessage(request, "users", HttpMethod.Get);

            httpRequestMessage.Headers.Add("Authorization-Token", request.AuthenticationToken);

            return(await SendRequestAsync <List <UserProfileBrief> >(httpRequestMessage));
        }
Example #2
0
        public override void Given()
        {
            _token = "token";
            _authenticationTokenRequest = new AuthenticationTokenRequest {
                authToken = _token
            };

            _request = MockFor <IFubuRequest>();
            _request.Stub(a => a.Get <AuthenticationTokenRequest>()).Return(_authenticationTokenRequest);

            _request.Stub(a => a.Get <ICurrentSDKUser>()).Return(MockFor <ICurrentSDKUser>());
        }
Example #3
0
        protected async System.Threading.Tasks.Task SignIn(User user)
        {
            var args = new AuthenticationTokenRequest
            {
                UserName = user.UserName,
            };

            var uri      = new Uri("TestAuthentication/Token", UriKind.Relative);
            var response = await this.PostAsJsonAsync(uri, args);

            var signInResponse = await this.ReadAsAsync <AuthenticationTokenResponse>(response);

            this.HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", signInResponse.Token);
        }
Example #4
0
        public async void NoPassword()
        {
            var args = new AuthenticationTokenRequest
            {
                UserName = "******"
            };

            var uri      = new Uri("Authentication/Token", UriKind.Relative);
            var response = await this.PostAsJsonAsync(uri, args);

            var siginInResponse = await this.ReadAsAsync <AuthenticationTokenResponse>(response);

            Assert.False(siginInResponse.Authenticated);
        }
Example #5
0
        public async void CorrectUserAndPassword()
        {
            var args = new AuthenticationTokenRequest
            {
                UserName = "******",
                Password = "******"
            };

            var uri      = new Uri("Authentication/Token", UriKind.Relative);
            var response = await this.PostAsJsonAsync(uri, args);

            var siginInResponse = await this.ReadAsAsync <AuthenticationTokenResponse>(response);

            Assert.True(siginInResponse.Authenticated);
        }
Example #6
0
        public async void Successful()
        {
            var args = new AuthenticationTokenRequest
            {
                UserName = "******",
                Password = "******"
            };

            var signInUri = new Uri("Authentication/Token", UriKind.Relative);

            await this.PostAsJsonAsync(signInUri, args);

            var signOutUri = new Uri("Authentication/SignOut", UriKind.Relative);

            await this.PostAsJsonAsync(signOutUri, null);
        }
        public override void Given()
        {
            _token = "token";
            _authenticationTokenRequest = new AuthenticationTokenRequest {
                authToken = _token
            };

            _request = MockFor <IFubuRequest>();
            _request.Stub(a => a.Get <AuthenticationTokenRequest>()).Return(_authenticationTokenRequest);

            _request.Stub(a => a.Get <ICurrentSDKUser>()).Return(MockFor <ICurrentSDKUser>());

            var services = new StructureMapServiceLocator(_services.Container);

            _context = new FubuRequestContext(services, MockFor <IHttpRequest>(), _request, MockFor <IOutputWriter>(), MockFor <FubuCore.Logging.ILogger>());
        }
Example #8
0
        public async Task <Response <string> > Logout(AuthenticationTokenRequest request)
        {
            HttpRequestMessage message = BuildRequestMessage(request, "usercredentials", HttpMethod.Delete);

            return(await SendRequestAsync <string>(message));
        }