/// <summary> /// /// </summary> /// <param name="Period"></param> /// <param name="LoggerProviderName"></param> /// <param name="LogLevel"></param> /// <returns></returns> public FeedResult RssFeed(string Period, string LoggerProviderName, string LogLevel) { string defaultPeriod = Session["Period"] == null ? "This Week" : Session["Period"].ToString(); string defaultLoggerProviderName = Session["LoggerProviderName"] == null ? "All" : Session["LoggerProviderName"].ToString(); string defaultLogLevel = Session["LogLevel"] == null ? "Error" : Session["LogLevel"].ToString(); Period = (Period == null) ? defaultPeriod : Period; LoggerProviderName = (LoggerProviderName == null) ? defaultLoggerProviderName : LoggerProviderName; LogLevel = (LogLevel == null) ? defaultLogLevel : LogLevel; TimePeriod timePeriod = TimePeriodHelper.GetUtcTimePeriod(Period); // Grab ALL entries for the feed (DO NOT PAGE feed DATA!!!) IPagedList <LogEvent> chartEntries = loggingRepository.GetByDateRangeAndType(0, Int32.MaxValue, timePeriod.Start, timePeriod.End, LoggerProviderName, LogLevel); var postItems = chartEntries.Select(p => new SyndicationItem(string.Format("{0} - {1} - {2}", p.LogDate, p.Level, p.LoggerProviderName), p.Message, new Uri(Url.AbsoluteAction("Details", new { LoggerProviderName = p.LoggerProviderName, Id = p.Id })))); Uri feedAlternateLink = Url.ActionFull("Index", "Logging"); var feed = new SyndicationFeed("MVC Logging Demo -> Log Reporting", string.Format("Log Provider: {0}, Log Level : {1}, From {2} to {3} ({4})", LoggerProviderName, LogLevel, timePeriod.Start.ToShortDateString(), timePeriod.End.ToShortDateString(), Period), feedAlternateLink, postItems) { Language = "en-US" }; return(new FeedResult(new Rss20FeedFormatter(feed))); }
/// <summary> /// Preloads discovery results for the OP buttons we display on the selector in the ViewData. /// </summary> private void PreloadDiscoveryResults() { this.ViewData["PreloadedDiscoveryResults"] = this.RelyingParty.PreloadDiscoveryResults( Realm.AutoDetect, Url.ActionFull("PopUpReturnTo"), this.PrivacyPolicyUrl, "https://me.yahoo.com/", "https://www.google.com/accounts/o8/id"); }
/// <summary> /// Preloads discovery results for the OP buttons we display on the selector in the ViewData. /// </summary> /// <returns> /// A task that completes with the asynchronous operation. /// </returns> private async Task PreloadDiscoveryResultsAsync() { this.ViewData["PreloadedDiscoveryResults"] = this.RelyingParty.PreloadDiscoveryResultsAsync( Realm.AutoDetect, Url.ActionFull("PopUpReturnTo"), this.PrivacyPolicyUrl, Response.ClientDisconnectedToken, "https://me.yahoo.com/", "https://www.google.com/accounts/o8/id"); }
/// <summary> /// Performs discovery on a given identifier. /// </summary> /// <param name="identifier">The identifier on which to perform discovery.</param> /// <returns>The JSON result of discovery.</returns> public ActionResult Discover(string identifier) { if (!this.Request.IsAjaxRequest()) { throw new InvalidOperationException(); } return(RelyingParty.AjaxDiscovery( identifier, Realm.AutoDetect, Url.ActionFull("PopUpReturnTo"), this.PrivacyPolicyUrl)); }
/// <summary> /// Performs discovery on a given identifier. /// </summary> /// <param name="identifier">The identifier on which to perform discovery.</param> /// <returns>The JSON result of discovery.</returns> public Task <ActionResult> Discover(string identifier) { if (!this.Request.IsAjaxRequest()) { throw new InvalidOperationException(); } return(this.RelyingParty.AjaxDiscoveryAsync( identifier, Realm.AutoDetect, Url.ActionFull("PopUpReturnTo"), this.PrivacyPolicyUrl, Response.ClientDisconnectedToken)); }
public ActionResult LogOn(string openid_identifier, bool rememberMe, string returnUrl) { Identifier userSuppliedIdentifier; if (Identifier.TryParse(openid_identifier, out userSuppliedIdentifier)) { try { var request = this.RelyingParty.CreateRequest(openid_identifier, Realm.AutoDetect, Url.ActionFull("LogOnReturnTo")); request.SetUntrustedCallbackArgument("rememberMe", rememberMe ? "1" : "0"); // This might be signed so the OP can't send the user to a dangerous URL. // Of course, if that itself was a danger then the site is vulnerable to XSRF attacks anyway. if (!string.IsNullOrEmpty(returnUrl)) { request.SetUntrustedCallbackArgument("returnUrl", returnUrl); } // Ask for the user's email, not because we necessarily need it to do our work, // but so we can display something meaningful to the user as their "username" // when they log in with a PPID from Google, for example. request.AddExtension(new ClaimsRequest { Email = DemandLevel.Require, FullName = DemandLevel.Request, PolicyUrl = Url.ActionFull("PrivacyPolicy", "Home"), }); return(request.RedirectingResponse.AsActionResult()); } catch (ProtocolException ex) { ModelState.AddModelError("OpenID", ex.Message); } } else { ModelState.AddModelError("openid_identifier", "This doesn't look like a valid OpenID."); } return(View()); }
public ActionResult AddAuthenticationToken(string openid_identifier) { Identifier userSuppliedIdentifier; if (Identifier.TryParse(openid_identifier, out userSuppliedIdentifier)) { try { var request = this.RelyingParty.CreateRequest(userSuppliedIdentifier, Realm.AutoDetect, Url.ActionFull("AddAuthenticationTokenReturnTo")); return(request.RedirectingResponse.AsActionResult()); } catch (ProtocolException ex) { ModelState.AddModelError("openid_identifier", ex); } } else { ModelState.AddModelError("openid_identifier", "This doesn't look like a valid OpenID."); } return(View("Edit", GetAccountInfoModel())); }