summaryrefslogtreecommitdiffstats
path: root/samples/ProviderPortal/user.aspx.cs
diff options
context:
space:
mode:
Diffstat (limited to 'samples/ProviderPortal/user.aspx.cs')
-rw-r--r--samples/ProviderPortal/user.aspx.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/samples/ProviderPortal/user.aspx.cs b/samples/ProviderPortal/user.aspx.cs
index 5400200..744cae5 100644
--- a/samples/ProviderPortal/user.aspx.cs
+++ b/samples/ProviderPortal/user.aspx.cs
@@ -1,5 +1,5 @@
using System;
-using System.Configuration;
+using DotNetOpenId.Provider;
/// <summary>
/// This page is a required as part of the service discovery phase of the openid protocol (step 1).
@@ -18,4 +18,15 @@ public partial class user : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
usernameLabel.Text = Request.QueryString["username"];
}
+
+ protected void IdentityEndpoint20_NormalizeUri(object sender, IdentityEndpointNormalizationEventArgs e) {
+ // This sample Provider has a custom policy for normalizing URIs, which is that the whole
+ // path of the URI be lowercase except for the first letter of the username.
+ UriBuilder normalized = new UriBuilder(e.UserSuppliedIdentifier);
+ string username = Request.QueryString["username"].TrimEnd('/').ToLowerInvariant();
+ username = username.Substring(0, 1).ToUpperInvariant() + username.Substring(1);
+ normalized.Path = "/user/" + username;
+ normalized.Scheme = "http"; // for a real Provider, this should be HTTPS if supported.
+ e.NormalizedIdentifier = normalized.Uri;
+ }
}