summaryrefslogtreecommitdiffstats
path: root/samples/OpenIdProviderMvc/Controllers/OpenIdController.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-09-29 16:31:11 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2012-09-29 16:31:11 -0700
commit951ff6271a3a064bfc6f7809222fe13bef72426d (patch)
tree67c41418622a9979cdbc1c3b65e401959015419f /samples/OpenIdProviderMvc/Controllers/OpenIdController.cs
parent90cbeeca143a9485d354d66632d3f75c593974e6 (diff)
parent5ceb75f6632a70c564b4556500b9c3e5a98bfa73 (diff)
downloadDotNetOpenAuth-951ff6271a3a064bfc6f7809222fe13bef72426d.zip
DotNetOpenAuth-951ff6271a3a064bfc6f7809222fe13bef72426d.tar.gz
DotNetOpenAuth-951ff6271a3a064bfc6f7809222fe13bef72426d.tar.bz2
Merge branch 'v4.0' into v4.1
Diffstat (limited to 'samples/OpenIdProviderMvc/Controllers/OpenIdController.cs')
-rw-r--r--samples/OpenIdProviderMvc/Controllers/OpenIdController.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/samples/OpenIdProviderMvc/Controllers/OpenIdController.cs b/samples/OpenIdProviderMvc/Controllers/OpenIdController.cs
index 4782e94..bd6de1b 100644
--- a/samples/OpenIdProviderMvc/Controllers/OpenIdController.cs
+++ b/samples/OpenIdProviderMvc/Controllers/OpenIdController.cs
@@ -2,6 +2,7 @@ namespace OpenIdProviderMvc.Controllers {
using System;
using System.Collections.Generic;
using System.Linq;
+ using System.Net;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
@@ -94,6 +95,11 @@ namespace OpenIdProviderMvc.Controllers {
return response;
}
+ if (!ProviderEndpoint.PendingAuthenticationRequest.IsDirectedIdentity &&
+ !this.UserControlsIdentifier(ProviderEndpoint.PendingAuthenticationRequest)) {
+ return this.Redirect(this.Url.Action("LogOn", "Account", new { returnUrl = this.Request.Url }));
+ }
+
this.ViewData["Realm"] = ProviderEndpoint.PendingRequest.Realm;
return this.View();
@@ -101,6 +107,13 @@ namespace OpenIdProviderMvc.Controllers {
[HttpPost, Authorize, ValidateAntiForgeryToken]
public ActionResult AskUserResponse(bool confirmed) {
+ if (!ProviderEndpoint.PendingAuthenticationRequest.IsDirectedIdentity &&
+ !this.UserControlsIdentifier(ProviderEndpoint.PendingAuthenticationRequest))
+ {
+ // The user shouldn't have gotten this far without controlling the identifier we'd send an assertion for.
+ return new HttpStatusCodeResult((int)HttpStatusCode.BadRequest);
+ }
+
if (ProviderEndpoint.PendingAnonymousRequest != null) {
ProviderEndpoint.PendingAnonymousRequest.IsApproved = confirmed;
} else if (ProviderEndpoint.PendingAuthenticationRequest != null) {