| 123456789101112131415161718192021222324252627282930313233343536 |
- using System.Web;
- using System.Web.Mvc;
- using Microsoft.Owin.Security;
- namespace WeOnlineApp.Controllers.Results
- {
- public class ChallengeResult : HttpUnauthorizedResult
- {
- public ChallengeResult(string provider, string redirectUri)
- : this(provider, redirectUri, null)
- {
- }
- public ChallengeResult(string provider, string redirectUri, string userId)
- {
- LoginProvider = provider;
- RedirectUri = redirectUri;
- UserId = userId;
- }
- public string LoginProvider { get; set; }
- public string RedirectUri { get; set; }
- public string UserId { get; set; }
- public override void ExecuteResult(ControllerContext context)
- {
- var properties = new AuthenticationProperties() { RedirectUri = RedirectUri };
- if (UserId != null)
- {
- properties.Dictionary["XsrfId"] = UserId;
- }
- context.HttpContext.GetOwinContext().Authentication.Challenge(properties, LoginProvider);
- }
- }
- }
|