diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-02-26 20:38:31 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-02-26 20:38:31 -0800 |
commit | e769dd8bbc744bc896454a5e5b64251d9dc13b2a (patch) | |
tree | c780ad6cb158902fd2391d69e1274cd1410d09ac | |
parent | a1553f37eee3a0a05aae214692f5ef2e60a6a870 (diff) | |
download | DotNetOpenAuth-e769dd8bbc744bc896454a5e5b64251d9dc13b2a.zip DotNetOpenAuth-e769dd8bbc744bc896454a5e5b64251d9dc13b2a.tar.gz DotNetOpenAuth-e769dd8bbc744bc896454a5e5b64251d9dc13b2a.tar.bz2 |
Added some more scripts toward getting the OpenIdSelector working in MVC.
5 files changed, 142 insertions, 104 deletions
diff --git a/projecttemplates/MvcRelyingParty/Code/OpenIdRelyingPartyService.cs b/projecttemplates/MvcRelyingParty/Code/OpenIdRelyingPartyService.cs index 2300e48..5e6a03d 100644 --- a/projecttemplates/MvcRelyingParty/Code/OpenIdRelyingPartyService.cs +++ b/projecttemplates/MvcRelyingParty/Code/OpenIdRelyingPartyService.cs @@ -5,10 +5,15 @@ using System.Web; using DotNetOpenAuth.OpenId; using DotNetOpenAuth.OpenId.RelyingParty; + using DotNetOpenAuth.Messaging; public interface IOpenIdRelyingParty { + Channel Channel { get; } + IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo); + IEnumerable<IAuthenticationRequest> CreateRequests(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo); + IAuthenticationResponse GetResponse(); } @@ -33,10 +38,18 @@ #region IOpenIdRelyingParty Members + public Channel Channel { + get { return relyingParty.Channel; } + } + public IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo) { return relyingParty.CreateRequest(userSuppliedIdentifier, realm, returnTo); } + public IEnumerable<IAuthenticationRequest> CreateRequests(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo) { + return relyingParty.CreateRequests(userSuppliedIdentifier, realm, returnTo); + } + public IAuthenticationResponse GetResponse() { return relyingParty.GetResponse(); } diff --git a/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs b/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs index 0fa8a9a..52f8831 100644 --- a/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs +++ b/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs @@ -152,6 +152,50 @@ return RedirectToAction("Index", "Home"); } + public JsonResult Discover(string identifier) { + if (!this.Request.IsAjaxRequest()) { + throw new InvalidOperationException(); + } + + // We prepare a JSON object with this interface: + // class jsonResponse { + // string claimedIdentifier; + // Array requests; // never null + // string error; // null if no error + // } + // Each element in the requests array looks like this: + // class jsonAuthRequest { + // string endpoint; // URL to the OP endpoint + // string immediate; // URL to initiate an immediate request + // string setup; // URL to initiate a setup request. + // } + IEnumerable<IAuthenticationRequest> requests = this.RelyingParty.CreateRequests(identifier, Realm.AutoDetect, Url.ActionFull("LogOnReturnTo")).CacheGeneratedResults(); + if (requests.Any()) { + return new JsonResult { + Data = new { + claimedIdentifier = requests.First().ClaimedIdentifier, + requests = requests.Select(req => new { + endpoint = req.Provider.Uri.AbsoluteUri, + immediate = GetRedirectUrl(req, true), + setup = GetRedirectUrl(req, false), + }).ToArray() + }, + }; + } else { + return new JsonResult { + Data = new { + requests = new object [0], + error = "No OpenID endpoint found", + } + }; + } + } + + private Uri GetRedirectUrl(IAuthenticationRequest request, bool immediate) { + request.Mode = immediate ? AuthenticationRequestMode.Immediate : AuthenticationRequestMode.Setup; + return request.RedirectingResponse.GetDirectUriRequest(this.RelyingParty.Channel); + } + [Authorize] public ActionResult Edit() { return View(GetAccountInfoModel()); diff --git a/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx b/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx index 4a2c58a..60bbc79 100644 --- a/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx +++ b/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx @@ -61,6 +61,14 @@ loader.insert(); } } catch (e) { } + window.aspnetapppath = '/'; + window.dnoa_internal.maxPositiveAssertionLifetime = 5 * 60 * 1000; + window.dnoa_internal.callbackAsync = function (argument, resultFunction, errorCallback) { + // TODO: this should invoke AccountController.Discover(argument) + }; + window.dnoa_internal.callback = function (argument, resultFunction, errorCallback) { + // TODO: this should invoke AccountController.Discover(argument) + }; //]]>--></script> </asp:Content> <asp:Content ContentPlaceHolderID="Head" runat="server"> diff --git a/projecttemplates/MvcRelyingParty/Web.config b/projecttemplates/MvcRelyingParty/Web.config index 706b0a1..6af9772 100644 --- a/projecttemplates/MvcRelyingParty/Web.config +++ b/projecttemplates/MvcRelyingParty/Web.config @@ -9,46 +9,43 @@ --> <configuration> <configSections> - <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false" /> - <section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true" /> + <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> + <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false"/> + <section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true"/> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> - <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /> - <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> - <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> - <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> + <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/> + <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> + <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> + <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> </sectionGroup> </sectionGroup> </sectionGroup> </configSections> - <!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names), which is necessary for OpenID urls with unicode characters in the domain/host name. It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. --> <uri> - <idn enabled="All" /> - <iriParsing enabled="true" /> + <idn enabled="All"/> + <iriParsing enabled="true"/> </uri> - <system.net> - <defaultProxy enabled="true" /> + <defaultProxy enabled="true"/> <settings> <!-- This setting causes .NET to check certificate revocation lists (CRL) before trusting HTTPS certificates. But this setting tends to not be allowed in shared hosting environments. --> - <servicePointManager checkCertificateRevocationList="true" /> + <servicePointManager checkCertificateRevocationList="true"/> </settings> </system.net> - <!-- this is an optional configuration section where aspects of dotnetopenauth can be customized --> <dotNetOpenAuth> <messaging> <untrustedWebRequest> <whitelistHosts> - <!--<add name="localhost" />--> + <add name="localhost"/> </whitelistHosts> </untrustedWebRequest> </messaging> @@ -57,7 +54,7 @@ <behaviors> <!-- The following OPTIONAL behavior allows RPs to use SREG only, but be compatible with OPs that use Attribute Exchange (in various formats). --> - <add type="DotNetOpenAuth.OpenId.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth" /> + <add type="DotNetOpenAuth.OpenId.Behaviors.AXFetchAsSregTransform, DotNetOpenAuth"/> </behaviors> <store type="RelyingPartyLogic.RelyingPartyApplicationDbStore, RelyingPartyLogic"/> </relyingParty> @@ -68,93 +65,88 @@ </serviceProvider> </oauth> <!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. --> - <reporting enabled="true" /> + <reporting enabled="true"/> </dotNetOpenAuth> - <!-- log4net is a 3rd party (free) logger library that DotNetOpenAuth will use if present but does not require. --> <log4net> <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender"> - <bufferSize value="100" /> - <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <connectionString value="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\WebFormsRelyingParty.mdf;Integrated Security=True;User Instance=True" /> - <commandText value="INSERT INTO [Log] ([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)" /> + <bufferSize value="100"/> + <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> + <connectionString value="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\WebFormsRelyingParty.mdf;Integrated Security=True;User Instance=True"/> + <commandText value="INSERT INTO [Log] ([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)"/> <parameter> - <parameterName value="@log_date" /> - <dbType value="DateTime" /> - <layout type="log4net.Layout.RawTimeStampLayout" /> + <parameterName value="@log_date"/> + <dbType value="DateTime"/> + <layout type="log4net.Layout.RawTimeStampLayout"/> </parameter> <parameter> - <parameterName value="@thread" /> - <dbType value="String" /> - <size value="255" /> + <parameterName value="@thread"/> + <dbType value="String"/> + <size value="255"/> <layout type="log4net.Layout.PatternLayout"> - <conversionPattern value="%thread" /> + <conversionPattern value="%thread"/> </layout> </parameter> <parameter> - <parameterName value="@log_level" /> - <dbType value="String" /> - <size value="50" /> + <parameterName value="@log_level"/> + <dbType value="String"/> + <size value="50"/> <layout type="log4net.Layout.PatternLayout"> - <conversionPattern value="%level" /> + <conversionPattern value="%level"/> </layout> </parameter> <parameter> - <parameterName value="@logger" /> - <dbType value="String" /> - <size value="255" /> + <parameterName value="@logger"/> + <dbType value="String"/> + <size value="255"/> <layout type="log4net.Layout.PatternLayout"> - <conversionPattern value="%logger" /> + <conversionPattern value="%logger"/> </layout> </parameter> <parameter> - <parameterName value="@message" /> - <dbType value="String" /> - <size value="4000" /> + <parameterName value="@message"/> + <dbType value="String"/> + <size value="4000"/> <layout type="log4net.Layout.PatternLayout"> - <conversionPattern value="%message" /> + <conversionPattern value="%message"/> </layout> </parameter> <parameter> - <parameterName value="@exception" /> - <dbType value="String" /> - <size value="2000" /> - <layout type="log4net.Layout.ExceptionLayout" /> + <parameterName value="@exception"/> + <dbType value="String"/> + <size value="2000"/> + <layout type="log4net.Layout.ExceptionLayout"/> </parameter> </appender> <!-- Setup the root category, add the appenders and set the default level --> <root> - <level value="WARN" /> - <appender-ref ref="AdoNetAppender" /> + <level value="WARN"/> + <appender-ref ref="AdoNetAppender"/> </root> <!-- Specify the level for some specific categories --> <logger name="DotNetOpenAuth"> - <level value="WARN" /> + <level value="WARN"/> </logger> <logger name="DotNetOpenAuth.OpenId"> - <level value="INFO" /> + <level value="INFO"/> </logger> <logger name="DotNetOpenAuth.OAuth"> - <level value="INFO" /> + <level value="INFO"/> </logger> </log4net> - <appSettings/> - <connectionStrings> <!-- Remember to keep this connection string in sync with the one (if any) that appears in the log4net section. --> - <add name="DatabaseEntities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MvcRelyingParty.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" /> + <add name="DatabaseEntities" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MvcRelyingParty.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient"/> </connectionStrings> - <system.web> - <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> - <compilation debug="false"> + <compilation debug="true"> <assemblies> <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> @@ -164,26 +156,23 @@ <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> - <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> + <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <remove assembly="DotNetOpenAuth.Contracts"/> </assemblies> </compilation> - <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Forms"> - <forms loginUrl="~/Account/LogOn" timeout="2880" name="MvcRelyingParty" /> + <forms loginUrl="~/Account/LogOn" timeout="2880" name="MvcRelyingParty"/> </authentication> - <roleManager enabled="true" defaultProvider="Database"> <providers> - <add name="Database" type="RelyingPartyLogic.DataRoleProvider, RelyingPartyLogic" /> + <add name="Database" type="RelyingPartyLogic.DataRoleProvider, RelyingPartyLogic"/> </providers> </roleManager> - <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs @@ -196,13 +185,11 @@ <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> - <pages> <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </controls> - <namespaces> <add namespace="System.Web.Mvc"/> <add namespace="System.Web.Mvc.Ajax"/> @@ -212,7 +199,6 @@ <add namespace="System.Collections.Generic"/> </namespaces> </pages> - <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> @@ -220,71 +206,57 @@ <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </httpHandlers> - <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> - <add name="OAuthAuthenticationModule" type="RelyingPartyLogic.OAuthAuthenticationModule, RelyingPartyLogic" /> + <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> + <add name="OAuthAuthenticationModule" type="RelyingPartyLogic.OAuthAuthenticationModule, RelyingPartyLogic"/> <add name="Database" type="RelyingPartyLogic.Database, RelyingPartyLogic"/> </httpModules> - </system.web> - <system.codedom> <compilers> - <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" - type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerVersion" value="v3.5"/> <providerOption name="WarnAsError" value="false"/> </compiler> - - <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" - type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <providerOption name="CompilerVersion" value="v3.5"/> <providerOption name="OptionInfer" value="true"/> <providerOption name="WarnAsError" value="false"/> </compiler> </compilers> </system.codedom> - <system.web.extensions/> - <!-- The system.webServer section is required for running ASP.NET AJAX under Internet Information Services 7.0. It is not necessary for previous version of IIS. --> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> - <modules runAllManagedModulesForAllRequests="true"> - <remove name="ScriptModule" /> - <remove name="UrlRoutingModule" /> + <remove name="ScriptModule"/> + <remove name="UrlRoutingModule"/> <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> - <add name="OAuthAuthenticationModule" type="RelyingPartyLogic.OAuthAuthenticationModule, RelyingPartyLogic" /> + <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> + <add name="OAuthAuthenticationModule" type="RelyingPartyLogic.OAuthAuthenticationModule, RelyingPartyLogic"/> <add name="Database" type="RelyingPartyLogic.Database, RelyingPartyLogic"/> </modules> - <handlers> <remove name="WebServiceHandlerFactory-Integrated"/> - <remove name="ScriptHandlerFactory" /> - <remove name="ScriptHandlerFactoryAppServices" /> - <remove name="ScriptResource" /> - <remove name="MvcHttpHandler" /> - <remove name="UrlRoutingHandler" /> - <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" - type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" - type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> + <remove name="ScriptHandlerFactory"/> + <remove name="ScriptHandlerFactoryAppServices"/> + <remove name="ScriptResource"/> + <remove name="MvcHttpHandler"/> + <remove name="UrlRoutingHandler"/> + <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> + <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> + <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> - <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </handlers> </system.webServer> - <runtime> - <legacyHMACWarning enabled="0" /> - + <legacyHMACWarning enabled="0"/> <!-- If you target ASP.NET MVC 2, uncomment this so that MVC 1 components such as DotNetOpenAuth will work with it. <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> @@ -293,14 +265,13 @@ </dependentAssembly> </assemblyBinding>--> </runtime> - <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="DataApiBehavior"> - <serviceMetadata httpGetEnabled="true" /> - <serviceDebug includeExceptionDetailInFaults="true" /> - <serviceAuthorization serviceAuthorizationManagerType="OAuthAuthorizationManager, __code" principalPermissionMode="Custom" /> + <serviceMetadata httpGetEnabled="true"/> + <serviceDebug includeExceptionDetailInFaults="true"/> + <serviceAuthorization serviceAuthorizationManagerType="OAuthAuthorizationManager, __code" principalPermissionMode="Custom"/> </behavior> </serviceBehaviors> </behaviors> @@ -309,7 +280,6 @@ </service>--> </services> </system.serviceModel> - <!-- Protect certain user pages from delegated (OAuth) clients. --> <location path="Account"> <system.web> diff --git a/src/DotNetOpenAuth/Messaging/OutgoingWebResponse.cs b/src/DotNetOpenAuth/Messaging/OutgoingWebResponse.cs index cf22bb2..c0fb06c 100644 --- a/src/DotNetOpenAuth/Messaging/OutgoingWebResponse.cs +++ b/src/DotNetOpenAuth/Messaging/OutgoingWebResponse.cs @@ -183,12 +183,15 @@ namespace DotNetOpenAuth.Messaging { /// would transmit the message that normally would be transmitted via a user agent redirect. /// </summary> /// <param name="channel">The channel to use for encoding.</param> - /// <returns>The URL that would transmit the original message.</returns> + /// <returns> + /// The URL that would transmit the original message. This URL may exceed the normal 2K limit, + /// and should therefore be broken up manually and POSTed as form fields when it exceeds this length. + /// </returns> /// <remarks> /// This is useful for desktop applications that will spawn a user agent to transmit the message /// rather than cause a redirect. /// </remarks> - internal Uri GetDirectUriRequest(Channel channel) { + public Uri GetDirectUriRequest(Channel channel) { Contract.Requires<ArgumentNullException>(channel != null); var message = this.OriginalMessage as IDirectedProtocolMessage; |