diff options
4 files changed, 27 insertions, 2 deletions
diff --git a/projecttemplates/MvcRelyingParty/Code/OpenIdRelyingPartyService.cs b/projecttemplates/MvcRelyingParty/Code/OpenIdRelyingPartyService.cs index 5e6a03d..448aced 100644 --- a/projecttemplates/MvcRelyingParty/Code/OpenIdRelyingPartyService.cs +++ b/projecttemplates/MvcRelyingParty/Code/OpenIdRelyingPartyService.cs @@ -15,6 +15,8 @@ IEnumerable<IAuthenticationRequest> CreateRequests(Identifier userSuppliedIdentifier, Realm realm, Uri returnTo); IAuthenticationResponse GetResponse(); + + IAuthenticationResponse GetResponse(HttpRequestInfo request); } /// <summary> @@ -54,6 +56,10 @@ return relyingParty.GetResponse(); } + public IAuthenticationResponse GetResponse(HttpRequestInfo request) { + return relyingParty.GetResponse(request); + } + #endregion } } diff --git a/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs b/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs index f6f4275..e5a5e7a 100644 --- a/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs +++ b/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; + using System.Net; using System.Security.Principal; using System.Web; using System.Web.Mvc; @@ -128,8 +129,20 @@ /// hack attempts and result in errors when validation is turned on. /// </remarks> [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post), ValidateInput(false)] - public ActionResult LogOnReturnTo() { - var response = this.RelyingParty.GetResponse(); + public ActionResult LogOnReturnTo(string openid_openidAuthData) { + IAuthenticationResponse response; + if (!string.IsNullOrEmpty(openid_openidAuthData)) { + var auth = new Uri(openid_openidAuthData); + var headers = new WebHeaderCollection(); + foreach (string header in Request.Headers) { + headers[header] = Request.Headers[header]; + } + // Always say it's a GET since the payload is all in the URL, even the large ones. + HttpRequestInfo clientResponseInfo = new HttpRequestInfo("GET", auth, auth.PathAndQuery, headers, null); + response = this.RelyingParty.GetResponse(clientResponseInfo); + } else { + response = this.RelyingParty.GetResponse(); + } if (response != null) { switch (response.Status) { case AuthenticationStatus.Authenticated: diff --git a/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx b/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx index 9fe8f8b..70729eb 100644 --- a/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx +++ b/projecttemplates/MvcRelyingParty/Views/Account/LogOn.aspx @@ -81,6 +81,11 @@ window.dnoa_internal.callback = function (argument, resultFunction, errorCallback) { alert('we thought this was unused'); }; + window.postLoginAssertion = function (positiveAssertion) { + $('#openid_openidAuthData')[0].setAttribute('value', positiveAssertion); + document.forms[0].action = '<%= Url.Action("LogOnReturnTo") %>'; + document.forms[0].submit(); + }; //]]>--></script> </asp:Content> <asp:Content ContentPlaceHolderID="Head" runat="server"> diff --git a/src/DotNetOpenAuth/DotNetOpenAuth.csproj b/src/DotNetOpenAuth/DotNetOpenAuth.csproj index 80487fc..4db7029 100644 --- a/src/DotNetOpenAuth/DotNetOpenAuth.csproj +++ b/src/DotNetOpenAuth/DotNetOpenAuth.csproj @@ -530,6 +530,7 @@ http://opensource.org/licenses/ms-pl.html <Compile Include="OpenId\RelyingParty\AuthenticationRequest.cs" /> <Compile Include="OpenId\RelyingParty\AuthenticationRequestMode.cs" /> <Compile Include="OpenId\RelyingParty\IProviderEndpoint.cs" /> + <Compile Include="OpenId\RelyingParty\RelyingPartyUtilities.cs" /> <Compile Include="OpenId\RelyingParty\SelectorButtonContract.cs" /> <Compile Include="OpenId\RelyingParty\SelectorProviderButton.cs" /> <Compile Include="OpenId\RelyingParty\SelectorOpenIdButton.cs" /> |