public static MockHttpMessageHandler AddFailureTokenEndpointResponse( this MockHttpManager httpManager, string error, string authority = TestConstants.AuthorityCommonTenant, string correlationId = null) { var handler = new MockHttpMessageHandler() { ExpectedUrl = authority + "oauth2/v2.0/token", ExpectedMethod = HttpMethod.Post, ResponseMessage = MockHelpers.CreateFailureTokenResponseMessage( error, correlationId: correlationId) }; httpManager.AddMockHandler(handler); return(handler); }
public static void AddSuccessfulTokenResponseWithHttpTelemetryMockHandlerForPost( this MockHttpManager httpManager, string authority, IDictionary <string, string> bodyParameters = null, IDictionary <string, string> queryParameters = null, IDictionary <string, string> httpTelemetryHeaders = null, bool foci = false) { httpManager.AddMockHandler( new MockHttpMessageHandler() { ExpectedUrl = authority + "oauth2/v2.0/token", ExpectedMethod = HttpMethod.Post, ExpectedPostData = bodyParameters, ExpectedQueryParams = queryParameters, ResponseMessage = MockHelpers.CreateSuccessTokenResponseMessage(foci), HttpTelemetryHeaders = httpTelemetryHeaders }); }
public static MockHttpMessageHandler AddSuccessTokenResponseMockHandlerForPost( this MockHttpManager httpManager, string authority = TestConstants.AuthorityCommonTenant, IDictionary <string, string> bodyParameters = null, IDictionary <string, string> queryParameters = null, bool foci = false, HttpResponseMessage responseMessage = null) { var handler = new MockHttpMessageHandler() { ExpectedUrl = authority + "oauth2/v2.0/token", ExpectedMethod = HttpMethod.Post, ExpectedPostData = bodyParameters, ExpectedQueryParams = queryParameters, ResponseMessage = responseMessage ?? MockHelpers.CreateSuccessTokenResponseMessage(foci) }; httpManager.AddMockHandler(handler); return(handler); }
public static void AddInstanceDiscoveryMockHandler(this MockHttpManager httpManager, string url) { httpManager.AddMockHandler(MockHelpers.CreateInstanceDiscoveryMockHandler(MsalTestConstants.GetDiscoveryEndpoint(url))); }