public static Task <bool> SignOutUserAsync(this ConnectorClient connectorClient, IActivity activity, string connectionName) { var userId = activity.From.Id; var client = new OAuthApiClient(new MicrosoftAppCredentials()); return(client.SignOutUserAsync(userId, connectionName)); }
public static Task <TokenResponse> GetUserTokenAsync(this ConnectorClient connectorClient, IActivity activity, string connectionName, string magicCode) { var userId = activity.From.Id; var client = new OAuthApiClient(new MicrosoftAppCredentials()); return(client.GetUserTokenAsync(userId, connectionName, magicCode)); }
public void SetUp() { httpMessageHandlerMock .Protected() .Setup <Task <HttpResponseMessage> >( "SendAsync", ItExpr.IsAny <HttpRequestMessage>(), ItExpr.IsAny <CancellationToken>() ) // prepare the expected response of the mocked http call .ReturnsAsync(new HttpResponseMessage() { StatusCode = HttpStatusCode.BadRequest, Content = new StringContent( "{\"access_token\": \"token\",\"token_type\": \"bearer\",\"expires_in\": 3600,\"resource\": \"https://resource\",\"refresh_token\": \"refresh_token\",\"refresh_token_expires_in\": 28799,\"scope\": \"openid\",\"id_token\": \"token_id\"}"), }) .Verifiable(); _optionsMock.Setup(x => x.CurrentValue).Returns(new OAuthOptions() { Secret = "secret", ResourceUrl = "resourceUrl", Password = "******", ClientId = "clientId", Username = "******", OAuthUrl = "oauthurl" }); // use real http client with mocked handler here _httpClient = new HttpClient(httpMessageHandlerMock.Object) { BaseAddress = new Uri("http://test.com/"), }; _sut = new OAuthApiClient(_httpClient, _optionsMock.Object); }
public PersonTimesApiClient(Uri baseUri, OAuthApiClient oauthClient) : base(baseUri, oauthClient) { Timeout = TimeSpan.FromMinutes(10); }
public RegistrationsApiClient(Uri baseUri, OAuthApiClient oauthClient) : base(baseUri, oauthClient) { }
public CompetitionsApiClient(Uri baseUri, OAuthApiClient oauthClient) : base(baseUri, oauthClient) { }
public OAuth2ClientHandler(OAuthApiClient oauthApiClient) { _oauthApiClient = oauthApiClient; }
public RecordTimesApiClient(Uri baseUri, OAuthApiClient oauthClient) : base(baseUri, oauthClient) { }