diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-03-13 10:34:01 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-03-13 10:34:01 -0800 |
commit | 6413dd76486e75f0c2525919eb2b1b63d2b01c20 (patch) | |
tree | 9c8326cb6d89d3440655d2074977dccc24c14a6a /src | |
parent | 5607212bfe276f8ed8304ea03e26c8e4fc9952a5 (diff) | |
download | DotNetOpenAuth-6413dd76486e75f0c2525919eb2b1b63d2b01c20.zip DotNetOpenAuth-6413dd76486e75f0c2525919eb2b1b63d2b01c20.tar.gz DotNetOpenAuth-6413dd76486e75f0c2525919eb2b1b63d2b01c20.tar.bz2 |
MVC project template now preloads discovery results for OP buttons.
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth/Messaging/MessagingUtilities.cs | 28 | ||||
-rw-r--r-- | src/DotNetOpenAuth/Mvc/OpenIdAjaxOptions.cs | 5 | ||||
-rw-r--r-- | src/DotNetOpenAuth/Mvc/OpenIdHelper.cs | 4 |
3 files changed, 23 insertions, 14 deletions
diff --git a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs index 8ae228d..7367c01 100644 --- a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs +++ b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs @@ -176,6 +176,20 @@ namespace DotNetOpenAuth.Messaging { } /// <summary> + /// Flattens the specified sequence of sequences. + /// </summary> + /// <typeparam name="T">The type of element contained in the sequence.</typeparam> + /// <param name="sequence">The sequence of sequences to flatten.</param> + /// <returns>A sequence of the contained items.</returns> + public static IEnumerable<T> Flatten<T>(this IEnumerable<IEnumerable<T>> sequence) { + foreach (IEnumerable<T> subsequence in sequence) { + foreach (T item in subsequence) { + yield return item; + } + } + } + + /// <summary> /// Sends a multipart HTTP POST request (useful for posting files) but doesn't call GetResponse on it. /// </summary> /// <param name="request">The HTTP request.</param> @@ -473,20 +487,6 @@ namespace DotNetOpenAuth.Messaging { } /// <summary> - /// Flattens the specified sequence of sequences. - /// </summary> - /// <typeparam name="T">The type of element contained in the sequence.</typeparam> - /// <param name="sequence">The sequence of sequences to flatten.</param> - /// <returns>A sequence of the contained items.</returns> - internal static IEnumerable<T> Flatten<T>(this IEnumerable<IEnumerable<T>> sequence) { - foreach (IEnumerable<T> subsequence in sequence) { - foreach (T item in subsequence) { - yield return item; - } - } - } - - /// <summary> /// Tests whether two arrays are equal in contents and ordering. /// </summary> /// <typeparam name="T">The type of elements in the arrays.</typeparam> diff --git a/src/DotNetOpenAuth/Mvc/OpenIdAjaxOptions.cs b/src/DotNetOpenAuth/Mvc/OpenIdAjaxOptions.cs index a412ef2..9956966 100644 --- a/src/DotNetOpenAuth/Mvc/OpenIdAjaxOptions.cs +++ b/src/DotNetOpenAuth/Mvc/OpenIdAjaxOptions.cs @@ -41,6 +41,11 @@ namespace DotNetOpenAuth.Mvc { public int FormIndex { get; set; } /// <summary> + /// Gets or sets the preloaded discovery results. + /// </summary> + public string PreloadedDiscoveryResults { get; set; } + + /// <summary> /// Gets or sets a value indicating whether to print diagnostic trace messages in the browser. /// </summary> public bool ShowDiagnosticTrace { get; set; } diff --git a/src/DotNetOpenAuth/Mvc/OpenIdHelper.cs b/src/DotNetOpenAuth/Mvc/OpenIdHelper.cs index 55af17d..03d2a07 100644 --- a/src/DotNetOpenAuth/Mvc/OpenIdHelper.cs +++ b/src/DotNetOpenAuth/Mvc/OpenIdHelper.cs @@ -124,6 +124,10 @@ window.openid_trace = {1}; // causes lots of messages"; OpenIdRelyingPartyAjaxControlBase.MaxPositiveAssertionLifetimeJsName, assertionLifetimeInMilliseconds.ToString(CultureInfo.InvariantCulture)); + if (additionalOptions.PreloadedDiscoveryResults != null) { + blockBuilder.WriteLine(additionalOptions.PreloadedDiscoveryResults); + } + string discoverUrl = VirtualPathUtility.AppendTrailingSlash(HttpContext.Current.Request.ApplicationPath) + html.RouteCollection["OpenIdDiscover"].GetVirtualPath(html.ViewContext.RequestContext, new RouteValueDictionary(new { identifier = "xxx" })).VirtualPath; string blockFormat = @" {0} = function (argument, resultFunction, errorCallback) {{ jQuery.ajax({{ |