2017-01-06 10:02:36 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Web.Http;
|
|
|
|
|
|
2017-04-02 04:11:35 -04:00
|
|
|
|
namespace securecall.Results
|
2017-01-06 10:02:36 -05:00
|
|
|
|
{
|
|
|
|
|
public class ChallengeResult : IHttpActionResult
|
|
|
|
|
{
|
|
|
|
|
public ChallengeResult(string loginProvider, ApiController controller)
|
|
|
|
|
{
|
|
|
|
|
LoginProvider = loginProvider;
|
|
|
|
|
Request = controller.Request;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string LoginProvider { get; set; }
|
|
|
|
|
public HttpRequestMessage Request { get; set; }
|
|
|
|
|
|
|
|
|
|
public Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
Request.GetOwinContext().Authentication.Challenge(LoginProvider);
|
|
|
|
|
|
|
|
|
|
HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Unauthorized);
|
|
|
|
|
response.RequestMessage = Request;
|
|
|
|
|
return Task.FromResult(response);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|