diff options
Diffstat (limited to 'samples')
-rw-r--r-- | samples/RelyingPartyPortal/Code/State.cs | 8 | ||||
-rw-r--r-- | samples/RelyingPartyPortal/Default.aspx | 1 | ||||
-rw-r--r-- | samples/RelyingPartyPortal/MembersOnly/Default.aspx | 1 | ||||
-rw-r--r-- | samples/RelyingPartyPortal/RelyingPartyPortal.csproj | 1 | ||||
-rw-r--r-- | samples/RelyingPartyPortal/Site.Master | 25 | ||||
-rw-r--r-- | samples/RelyingPartyPortal/images/openid_login.gif | bin | 0 -> 237 bytes | |||
-rw-r--r-- | samples/RelyingPartyPortal/login.aspx.cs | 4 | ||||
-rw-r--r-- | samples/RelyingPartyPortal/logout.aspx | 12 |
8 files changed, 41 insertions, 11 deletions
diff --git a/samples/RelyingPartyPortal/Code/State.cs b/samples/RelyingPartyPortal/Code/State.cs index 642780c..234c7ac 100644 --- a/samples/RelyingPartyPortal/Code/State.cs +++ b/samples/RelyingPartyPortal/Code/State.cs @@ -5,8 +5,16 @@ using DotNetOpenId.Extensions.SimpleRegistration; /// Strong-typed bag of session state.
/// </summary>
public class State {
+ public static void Clear() {
+ ProfileFields = null;
+ FriendlyLoginName = null;
+ }
public static ClaimsResponse ProfileFields {
get { return HttpContext.Current.Session["ProfileFields"] as ClaimsResponse; }
set { HttpContext.Current.Session["ProfileFields"] = value; }
}
+ public static string FriendlyLoginName {
+ get { return HttpContext.Current.Session["FriendlyUsername"] as string; }
+ set { HttpContext.Current.Session["FriendlyUsername"] = value; }
+ }
}
diff --git a/samples/RelyingPartyPortal/Default.aspx b/samples/RelyingPartyPortal/Default.aspx index 1fb831f..bdb9b27 100644 --- a/samples/RelyingPartyPortal/Default.aspx +++ b/samples/RelyingPartyPortal/Default.aspx @@ -10,5 +10,4 @@ <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/MembersOnly/Default.aspx"
Text="Members Only" />
area. (This will trigger a login demo). </p>
- <asp:LoginStatus ID="LoginStatus1" runat="server" />
</asp:Content>
diff --git a/samples/RelyingPartyPortal/MembersOnly/Default.aspx b/samples/RelyingPartyPortal/MembersOnly/Default.aspx index c9b43e8..9c3652d 100644 --- a/samples/RelyingPartyPortal/MembersOnly/Default.aspx +++ b/samples/RelyingPartyPortal/MembersOnly/Default.aspx @@ -8,7 +8,6 @@ Congratulations, <b><asp:LoginName ID="LoginName1" runat="server" /></b>.
You have completed the OpenID login process.
</p>
- <asp:LoginStatus ID="LoginStatus1" runat="server" />
<% if (State.ProfileFields != null) { %>
<p>
diff --git a/samples/RelyingPartyPortal/RelyingPartyPortal.csproj b/samples/RelyingPartyPortal/RelyingPartyPortal.csproj index 4a0d795..9799cac 100644 --- a/samples/RelyingPartyPortal/RelyingPartyPortal.csproj +++ b/samples/RelyingPartyPortal/RelyingPartyPortal.csproj @@ -108,6 +108,7 @@ <Content Include="styles.css" />
</ItemGroup>
<ItemGroup>
+ <Content Include="images\openid_login.gif" />
<Content Include="Site.Master" />
<Content Include="TracePage.aspx" />
</ItemGroup>
diff --git a/samples/RelyingPartyPortal/Site.Master b/samples/RelyingPartyPortal/Site.Master index 944cc70..bbb7bc3 100644 --- a/samples/RelyingPartyPortal/Site.Master +++ b/samples/RelyingPartyPortal/Site.Master @@ -1,6 +1,17 @@ <%@ Master Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<script runat="server">
+ protected void Page_Load(object sender, EventArgs e) {
+ friendlyUsername.Text = State.FriendlyLoginName;
+ }
+
+ protected void LoginStatus1_LoggedOut(object sender, EventArgs e) {
+ State.Clear();
+ }
+</script>
+
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>OpenID Relying Party, by DotNetOpenId</title>
@@ -9,9 +20,17 @@ </head>
<body>
<form id="form1" runat="server">
- <div><a href="http://dotnetopenid.googlecode.com">
- <img runat="server" src="~/images/dotnetopenid_tiny.gif" title="Jump to the project web site."
- alt="DotNetOpenId" border='0' /></a> </div>
+ <span style="float: right">
+ <asp:Image runat="server" ID="openIdUsernameImage" ImageUrl="~/images/openid_login.gif"
+ EnableViewState="false" />
+ <asp:Label runat="server" ID="friendlyUsername" Text="" EnableViewState="false" />
+ <asp:LoginStatus ID="LoginStatus1" runat="server" OnLoggedOut="LoginStatus1_LoggedOut" />
+ </span>
+ <div>
+ <a href="http://dotnetopenid.googlecode.com">
+ <img runat="server" src="~/images/dotnetopenid_tiny.gif" title="Jump to the project web site."
+ alt="DotNetOpenId" border='0' /></a>
+ </div>
<div>
<asp:ContentPlaceHolder ID="Main" runat="server" />
</div>
diff --git a/samples/RelyingPartyPortal/images/openid_login.gif b/samples/RelyingPartyPortal/images/openid_login.gif Binary files differnew file mode 100644 index 0000000..cde836c --- /dev/null +++ b/samples/RelyingPartyPortal/images/openid_login.gif diff --git a/samples/RelyingPartyPortal/login.aspx.cs b/samples/RelyingPartyPortal/login.aspx.cs index a3c062d..0713c7a 100644 --- a/samples/RelyingPartyPortal/login.aspx.cs +++ b/samples/RelyingPartyPortal/login.aspx.cs @@ -1,6 +1,7 @@ using System;
using System.Web.UI;
using DotNetOpenId.RelyingParty;
+using DotNetOpenId.Extensions.SimpleRegistration;
public partial class login : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
@@ -13,7 +14,8 @@ public partial class login : System.Web.UI.Page { /// Note, that straight after login, forms auth will redirect the user to their original page. So this page may never be rendererd.
/// </summary>
protected void OpenIdLogin1_LoggedIn(object sender, OpenIdEventArgs e) {
- State.ProfileFields = e.ProfileFields;
+ State.FriendlyLoginName = e.Response.FriendlyIdentifierForDisplay;
+ State.ProfileFields = e.Response.GetExtension<ClaimsResponse>();
}
protected void OpenIdLogin1_Failed(object sender, OpenIdEventArgs e) {
loginFailedLabel.Visible = true;
diff --git a/samples/RelyingPartyPortal/logout.aspx b/samples/RelyingPartyPortal/logout.aspx index ce4fdf8..40b655c 100644 --- a/samples/RelyingPartyPortal/logout.aspx +++ b/samples/RelyingPartyPortal/logout.aspx @@ -3,9 +3,11 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
-protected void Page_Load(object sender, EventArgs e)
-{
- System.Web.Security.FormsAuthentication.SignOut();
- Response.Redirect("~/");
-}
+ protected void Page_Load(object sender, EventArgs e) {
+ State.FriendlyLoginName = null;
+ State.ProfileFields = null;
+ System.Web.Security.FormsAuthentication.SignOut();
+ Response.Redirect("~/");
+ }
</script>
+
|