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)); }
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>()); }
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); }
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); }
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); }
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>()); }
public async Task <Response <string> > Logout(AuthenticationTokenRequest request) { HttpRequestMessage message = BuildRequestMessage(request, "usercredentials", HttpMethod.Delete); return(await SendRequestAsync <string>(message)); }