diff options
-rw-r--r-- | samples/OpenIdProviderMvc/Views/Account/LogOn.aspx | 13 | ||||
-rw-r--r-- | samples/OpenIdProviderMvc/Web.config | 3 | ||||
-rw-r--r-- | samples/RelyingPartyMvc/Controllers/UserController.cs | 12 | ||||
-rw-r--r-- | samples/RelyingPartyMvc/Properties/AssemblyInfo.cs | 2 | ||||
-rw-r--r-- | samples/RelyingPartyMvc/Web.config | 3 |
5 files changed, 25 insertions, 8 deletions
diff --git a/samples/OpenIdProviderMvc/Views/Account/LogOn.aspx b/samples/OpenIdProviderMvc/Views/Account/LogOn.aspx index ca27b6a..abe420a 100644 --- a/samples/OpenIdProviderMvc/Views/Account/LogOn.aspx +++ b/samples/OpenIdProviderMvc/Views/Account/LogOn.aspx @@ -7,7 +7,8 @@ <asp:Content ID="loginContent" ContentPlaceHolderID="MainContent" runat="server"> <h2>Log On</h2> <p> - Please enter your username and password. <%= Html.ActionLink("Register", "Register") %> if you don't have an account. + Please enter your username and password. + <%--<%= Html.ActionLink("Register", "Register") %> if you don't have an account.--%> </p> <%= Html.ValidationSummary("Login was unsuccessful. Please correct the errors and try again.") %> @@ -34,4 +35,14 @@ </fieldset> </div> <% } %> + + <p>Credentials to try (each with their own OpenID)</p> + <table> + <tr><td>Username</td><td>Password</td></tr> + <tr><td>bob</td><td>test</td></tr> + <tr><td>bob1</td><td>test</td></tr> + <tr><td>bob2</td><td>test</td></tr> + <tr><td>bob3</td><td>test</td></tr> + <tr><td>bob4</td><td>test</td></tr> + </table> </asp:Content> diff --git a/samples/OpenIdProviderMvc/Web.config b/samples/OpenIdProviderMvc/Web.config index d6416d8..52a7e4b 100644 --- a/samples/OpenIdProviderMvc/Web.config +++ b/samples/OpenIdProviderMvc/Web.config @@ -68,7 +68,8 @@ ASP.NET to identify an incoming user. --> <authentication mode="Forms"> - <forms loginUrl="~/Account/LogOn" timeout="2880"/> + <forms loginUrl="~/Account/LogOn" timeout="2880" name="ProviderMvcSession"/> + <!-- named cookie prevents conflicts with other samples --> </authentication> <membership defaultProvider="AspNetReadOnlyXmlMembershipProvider"> <providers> diff --git a/samples/RelyingPartyMvc/Controllers/UserController.cs b/samples/RelyingPartyMvc/Controllers/UserController.cs index bebdaa5..ba94efe 100644 --- a/samples/RelyingPartyMvc/Controllers/UserController.cs +++ b/samples/RelyingPartyMvc/Controllers/UserController.cs @@ -32,7 +32,7 @@ return View("Login"); } - public ActionResult Authenticate() { + public ActionResult Authenticate(string returnUrl) { var openid = new OpenIdRelyingParty(); var response = openid.GetResponse(); if (response == null) { @@ -40,7 +40,7 @@ Identifier id; if (Identifier.TryParse(Request.Form["openid_identifier"], out id)) { try { - openid.CreateRequest(Request.Form["openid_identifier"]).RedirectToProvider(); + return openid.CreateRequest(Request.Form["openid_identifier"]).RedirectingResponse.AsActionResult(); } catch (ProtocolException ex) { ViewData["Message"] = ex.Message; return View("Login"); @@ -54,8 +54,12 @@ switch (response.Status) { case AuthenticationStatus.Authenticated: Session["FriendlyIdentifier"] = response.FriendlyIdentifierForDisplay; - FormsAuthentication.RedirectFromLoginPage(response.ClaimedIdentifier, false); - break; + FormsAuthentication.SetAuthCookie(response.ClaimedIdentifier, false); + if (!string.IsNullOrEmpty(returnUrl)) { + return Redirect(returnUrl); + } else { + return RedirectToAction("Index", "Home"); + } case AuthenticationStatus.Canceled: ViewData["Message"] = "Canceled at provider"; return View("Login"); diff --git a/samples/RelyingPartyMvc/Properties/AssemblyInfo.cs b/samples/RelyingPartyMvc/Properties/AssemblyInfo.cs index c0ec42d..483a4a1 100644 --- a/samples/RelyingPartyMvc/Properties/AssemblyInfo.cs +++ b/samples/RelyingPartyMvc/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RelyingPartyMvc")] -[assembly: AssemblyCopyright("Copyright © 2008")] +[assembly: AssemblyCopyright("Copyright © Andrew Arnott 2008")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/samples/RelyingPartyMvc/Web.config b/samples/RelyingPartyMvc/Web.config index 02eb8c2..32d146c 100644 --- a/samples/RelyingPartyMvc/Web.config +++ b/samples/RelyingPartyMvc/Web.config @@ -75,7 +75,8 @@ ASP.NET to identify an incoming user. --> <authentication mode="Forms"> - <forms defaultUrl="/Home" loginUrl="/User/Login"/> + <forms defaultUrl="/Home" loginUrl="/User/Login" name="RelyingPartyMvcSession"/> + <!-- named cookie prevents conflicts with other samples --> </authentication> <!-- The <customErrors> section enables configuration |