summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--projecttemplates/MvcRelyingParty/Code/Extensions.cs17
-rw-r--r--projecttemplates/MvcRelyingParty/Controllers/AccountController.cs11
-rw-r--r--projecttemplates/MvcRelyingParty/Controllers/HomeController.cs4
-rw-r--r--projecttemplates/MvcRelyingParty/MvcRelyingParty.csproj2
-rw-r--r--projecttemplates/MvcRelyingParty/Views/Home/PrivacyPolicy.aspx13
5 files changed, 38 insertions, 9 deletions
diff --git a/projecttemplates/MvcRelyingParty/Code/Extensions.cs b/projecttemplates/MvcRelyingParty/Code/Extensions.cs
new file mode 100644
index 0000000..4af5413
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Code/Extensions.cs
@@ -0,0 +1,17 @@
+namespace MvcRelyingParty {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Web;
+ using System.Web.Mvc;
+
+ internal static class Extensions {
+ internal static Uri ActionFull(this UrlHelper urlHelper, string actionName) {
+ return new Uri(HttpContext.Current.Request.Url, urlHelper.Action(actionName));
+ }
+
+ internal static Uri ActionFull(this UrlHelper urlHelper, string actionName, string controllerName) {
+ return new Uri(HttpContext.Current.Request.Url, urlHelper.Action(actionName, controllerName));
+ }
+ }
+}
diff --git a/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs b/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs
index 48f2e53..4cf3d71 100644
--- a/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs
+++ b/projecttemplates/MvcRelyingParty/Controllers/AccountController.cs
@@ -64,14 +64,6 @@
}
/// <summary>
- /// Gets the URL that the Provider should return the user to after authenticating.
- /// </summary>
- /// <value>An absolute URL.</value>
- public Uri ReturnTo {
- get { return new Uri(Request.Url, Url.Action("LogOnReturnTo")); }
- }
-
- /// <summary>
/// Prepares a web page to help the user supply his login information.
/// </summary>
/// <returns>The action result.</returns>
@@ -92,7 +84,7 @@
Identifier userSuppliedIdentifier;
if (Identifier.TryParse(openid_identifier, out userSuppliedIdentifier)) {
try {
- var request = this.RelyingParty.CreateRequest(openid_identifier, this.Realm, this.ReturnTo);
+ var request = this.RelyingParty.CreateRequest(openid_identifier, this.Realm, 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.
@@ -107,6 +99,7 @@
request.AddExtension(new ClaimsRequest {
Email = DemandLevel.Require,
FullName = DemandLevel.Request,
+ PolicyUrl = Url.ActionFull("PrivacyPolicy", "Home"),
});
return request.RedirectingResponse.AsActionResult();
diff --git a/projecttemplates/MvcRelyingParty/Controllers/HomeController.cs b/projecttemplates/MvcRelyingParty/Controllers/HomeController.cs
index 261aa37..7182862 100644
--- a/projecttemplates/MvcRelyingParty/Controllers/HomeController.cs
+++ b/projecttemplates/MvcRelyingParty/Controllers/HomeController.cs
@@ -16,5 +16,9 @@
public ActionResult About() {
return View();
}
+
+ public ActionResult PrivacyPolicy() {
+ return View();
+ }
}
}
diff --git a/projecttemplates/MvcRelyingParty/MvcRelyingParty.csproj b/projecttemplates/MvcRelyingParty/MvcRelyingParty.csproj
index 2cc8360..9311b82 100644
--- a/projecttemplates/MvcRelyingParty/MvcRelyingParty.csproj
+++ b/projecttemplates/MvcRelyingParty/MvcRelyingParty.csproj
@@ -59,6 +59,7 @@
<Reference Include="System.Web.Mobile" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Code\Extensions.cs" />
<Compile Include="Code\FormsAuthenticationService.cs" />
<Compile Include="Code\OpenIdRelyingPartyService.cs" />
<Compile Include="Controllers\AccountController.cs" />
@@ -84,6 +85,7 @@
<Content Include="GettingStarted.htm" />
<Content Include="Global.asax" />
<Content Include="Setup.aspx" />
+ <Content Include="Views\Home\PrivacyPolicy.aspx" />
<Content Include="Web.config" />
<Content Include="Content\Site.css" />
<Content Include="Scripts\jquery-1.3.2.js" />
diff --git a/projecttemplates/MvcRelyingParty/Views/Home/PrivacyPolicy.aspx b/projecttemplates/MvcRelyingParty/Views/Home/PrivacyPolicy.aspx
new file mode 100644
index 0000000..34b2e59
--- /dev/null
+++ b/projecttemplates/MvcRelyingParty/Views/Home/PrivacyPolicy.aspx
@@ -0,0 +1,13 @@
+<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
+
+<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
+ Privacy Policy
+</asp:Content>
+<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
+ <h2>
+ Privacy Policy
+ </h2>
+ <p>
+ [placeholder]
+ </p>
+</asp:Content>