summaryrefslogtreecommitdiffstats
path: root/samples/OpenIdProviderWebForms/user.aspx.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-04-03 17:00:05 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-04-03 17:00:05 -0700
commit8254a5ca1ced42181eb33e1282cfab5e429b0243 (patch)
tree7efd0efb5d555d57aec6eb9059a50a59eceb98b7 /samples/OpenIdProviderWebForms/user.aspx.cs
parenta124b5a041853c0d9f52244f43740c94bd6f4f3c (diff)
parent22873cc61615aaa01734857b0567e4878b2e325c (diff)
downloadDotNetOpenAuth-8254a5ca1ced42181eb33e1282cfab5e429b0243.zip
DotNetOpenAuth-8254a5ca1ced42181eb33e1282cfab5e429b0243.tar.gz
DotNetOpenAuth-8254a5ca1ced42181eb33e1282cfab5e429b0243.tar.bz2
Merge branch 'v3.0' into master
Diffstat (limited to 'samples/OpenIdProviderWebForms/user.aspx.cs')
-rw-r--r--samples/OpenIdProviderWebForms/user.aspx.cs18
1 files changed, 4 insertions, 14 deletions
diff --git a/samples/OpenIdProviderWebForms/user.aspx.cs b/samples/OpenIdProviderWebForms/user.aspx.cs
index f530f15..5cd84c9 100644
--- a/samples/OpenIdProviderWebForms/user.aspx.cs
+++ b/samples/OpenIdProviderWebForms/user.aspx.cs
@@ -1,33 +1,23 @@
namespace OpenIdProviderWebForms {
using System;
using DotNetOpenAuth.OpenId.Provider;
+ using OpenIdProviderWebForms.Code;
/// <summary>
/// This page is a required as part of the service discovery phase of the openid protocol (step 1).
/// </summary>
/// <remarks>
- /// <para>How does a url like http://www.myserver.com/user/bob map to http://www.myserver.com/user.aspx?username=bob ?
- /// Check out gobal.asax and the URLRewriter class. Essentially there's a little framework that allows for URLRewrting using the HttpContext.Current.RewritePath method.</para>
- /// <para>A url such as http://www.myserver.com/user/bob which is entered on the consumer side will cause this page to be invoked.
- /// This page must be parsed by the openid compatible consumer and the url of the openid server is extracted from href in: rel="openid.server" href="?".
- /// It is the responsibility of the consumer to redirect the user to this url.</para>
/// <para>The XRDS (or Yadis) content is also rendered to provide the consumer with an alternative discovery mechanism. The Yadis protocol allows the consumer
/// to provide the user with a more flexible range of authentication mechanisms (which ever has been defined in xrds.aspx). See http://en.wikipedia.org/wiki/Yadis.</para>
/// </remarks>
public partial class user : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
- this.usernameLabel.Text = Request.QueryString["username"];
+ this.usernameLabel.Text = Util.ExtractUserName(Page.Request.Url);
}
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;
+ string username = Util.ExtractUserName(Page.Request.Url);
+ e.NormalizedIdentifier = new Uri(Util.BuildIdentityUrl(username));
}
}
} \ No newline at end of file