summaryrefslogtreecommitdiffstats
path: root/samples/RelyingPartyPortal
diff options
context:
space:
mode:
Diffstat (limited to 'samples/RelyingPartyPortal')
-rw-r--r--samples/RelyingPartyPortal/.gitignore3
-rw-r--r--samples/RelyingPartyPortal/Code/CustomStore.cs118
-rw-r--r--samples/RelyingPartyPortal/Code/CustomStoreDataSet.Designer.cs976
-rw-r--r--samples/RelyingPartyPortal/Code/CustomStoreDataSet.cs6
-rw-r--r--samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsc9
-rw-r--r--samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsd45
-rw-r--r--samples/RelyingPartyPortal/Code/CustomStoreDataSet.xss13
-rw-r--r--samples/RelyingPartyPortal/Code/State.cs49
-rw-r--r--samples/RelyingPartyPortal/Code/TracePageAppender.cs13
-rw-r--r--samples/RelyingPartyPortal/Default.aspx35
-rw-r--r--samples/RelyingPartyPortal/Global.asax.cs28
-rw-r--r--samples/RelyingPartyPortal/MembersOnly/Default.aspx38
-rw-r--r--samples/RelyingPartyPortal/PrivacyPolicy.aspx16
-rw-r--r--samples/RelyingPartyPortal/RelyingPartyPortal.csproj66
-rw-r--r--samples/RelyingPartyPortal/Site.Master39
-rw-r--r--samples/RelyingPartyPortal/TracePage.aspx16
-rw-r--r--samples/RelyingPartyPortal/TracePage.aspx.cs19
-rw-r--r--samples/RelyingPartyPortal/TracePage.aspx.designer.cs43
-rw-r--r--samples/RelyingPartyPortal/Web.config76
-rw-r--r--samples/RelyingPartyPortal/ajaxlogin.aspx91
-rw-r--r--samples/RelyingPartyPortal/ajaxlogin.aspx.cs54
-rw-r--r--samples/RelyingPartyPortal/ajaxlogin.aspx.designer.cs106
-rw-r--r--samples/RelyingPartyPortal/images/attention.pngbin0 -> 714 bytes
-rw-r--r--samples/RelyingPartyPortal/images/dotnetopenid_tiny.gifbin0 -> 3548 bytes
-rw-r--r--samples/RelyingPartyPortal/images/openid_login.gifbin0 -> 237 bytes
-rw-r--r--samples/RelyingPartyPortal/login.aspx36
-rw-r--r--samples/RelyingPartyPortal/login.aspx.cs41
-rw-r--r--samples/RelyingPartyPortal/login.aspx.designer.cs19
-rw-r--r--samples/RelyingPartyPortal/loginProgrammatic.aspx15
-rw-r--r--samples/RelyingPartyPortal/loginProgrammatic.aspx.cs96
-rw-r--r--samples/RelyingPartyPortal/loginProgrammatic.aspx.designer.cs68
-rw-r--r--samples/RelyingPartyPortal/logout.aspx12
-rw-r--r--samples/RelyingPartyPortal/styles.css10
-rw-r--r--samples/RelyingPartyPortal/xrds.aspx2
34 files changed, 2025 insertions, 133 deletions
diff --git a/samples/RelyingPartyPortal/.gitignore b/samples/RelyingPartyPortal/.gitignore
index 0986274..b086a60 100644
--- a/samples/RelyingPartyPortal/.gitignore
+++ b/samples/RelyingPartyPortal/.gitignore
@@ -1,4 +1,5 @@
Bin
obj
-*Trace.txt
*.user
+*.log
+StyleCop.Cache
diff --git a/samples/RelyingPartyPortal/Code/CustomStore.cs b/samples/RelyingPartyPortal/Code/CustomStore.cs
new file mode 100644
index 0000000..0083152
--- /dev/null
+++ b/samples/RelyingPartyPortal/Code/CustomStore.cs
@@ -0,0 +1,118 @@
+using System;
+using System.Data;
+using System.Globalization;
+using System.Security.Cryptography;
+using DotNetOpenId;
+using DotNetOpenId.RelyingParty;
+
+namespace ConsumerPortal.Code {
+ /// <summary>
+ /// This custom store serializes all elements to demonstrate peristent and/or shared storage.
+ /// This is common in a web farm, for example.
+ /// </summary>
+ /// <remarks>
+ /// This doesn't actually serialize anything to a persistent store, so restarting the web server
+ /// will still clear everything this store is supposed to remember.
+ /// But we "persist" all associations and nonces into a DataTable to demonstrate
+ /// that using a database is possible.
+ /// </remarks>
+ public class CustomStore : IRelyingPartyApplicationStore {
+ static CustomStoreDataSet dataSet = new CustomStoreDataSet();
+
+ #region IAssociationStore<Uri> Members
+
+ public void StoreAssociation(Uri distinguishingFactor, Association assoc) {
+ var assocRow = dataSet.Association.NewAssociationRow();
+ assocRow.DistinguishingFactor = distinguishingFactor.AbsoluteUri;
+ assocRow.Handle = assoc.Handle;
+ assocRow.Expires = assoc.Expires.ToLocalTime();
+ assocRow.PrivateData = assoc.SerializePrivateData();
+ dataSet.Association.AddAssociationRow(assocRow);
+ }
+
+ public Association GetAssociation(Uri distinguishingFactor) {
+ // properly escape the URL to prevent injection attacks.
+ string value = distinguishingFactor.AbsoluteUri.Replace("'", "''");
+ string filter = string.Format(CultureInfo.InvariantCulture, "{0} = '{1}'",
+ dataSet.Association.DistinguishingFactorColumn.ColumnName, value);
+ string sort = dataSet.Association.ExpiresColumn.ColumnName + " DESC";
+ DataView view = new DataView(dataSet.Association, filter, sort, DataViewRowState.CurrentRows);
+ if (view.Count == 0) return null;
+ var row = (CustomStoreDataSet.AssociationRow)view[0].Row;
+ return Association.Deserialize(row.Handle, row.Expires.ToUniversalTime(), row.PrivateData);
+ }
+
+ public Association GetAssociation(Uri distinguishingFactor, string handle) {
+ var assocRow = dataSet.Association.FindByDistinguishingFactorHandle(distinguishingFactor.AbsoluteUri, handle);
+ return Association.Deserialize(assocRow.Handle, assocRow.Expires, assocRow.PrivateData);
+ }
+
+ public bool RemoveAssociation(Uri distinguishingFactor, string handle) {
+ var row = dataSet.Association.FindByDistinguishingFactorHandle(distinguishingFactor.AbsoluteUri, handle);
+ if (row != null) {
+ dataSet.Association.RemoveAssociationRow(row);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public void ClearExpiredAssociations() {
+ removeExpiredRows(dataSet.Association, dataSet.Association.ExpiresColumn.ColumnName);
+ }
+
+ #endregion
+
+ #region INonceStore Members
+
+ static byte[] secretSigningKey;
+ public byte[] SecretSigningKey {
+ get {
+ if (secretSigningKey == null) {
+ lock (this) {
+ if (secretSigningKey == null) {
+ // initialize in a local variable before setting in field for thread safety.
+ byte[] auth_key = new byte[64];
+ new RNGCryptoServiceProvider().GetBytes(auth_key);
+ CustomStore.secretSigningKey = auth_key;
+ }
+ }
+ }
+ return secretSigningKey;
+ }
+ }
+
+ public bool TryStoreNonce(Nonce nonce) {
+ // IMPORTANT: If actually persisting to a database that can be reached from
+ // different servers/instances of this class at once, it is vitally important
+ // to protect against race condition attacks by one or more of these:
+ // 1) setting a UNIQUE constraint on the nonce CODE in the SQL table
+ // 2) Using a transaction with repeatable reads to guarantee that a check
+ // that verified a nonce did not exist will prevent that nonce from being
+ // added by another process while this process is adding it.
+ // And then you'll want to catch the exception that the SQL database can throw
+ // at you in the result of a race condition somewhere in your web site UI code
+ // and display some message to have the user try to log in again, and possibly
+ // warn them about a replay attack.
+ lock (this) {
+ if (dataSet.Nonce.FindByCode(nonce.Code) != null) return false;
+ dataSet.Nonce.AddNonceRow(nonce.Code, nonce.ExpirationDate.ToLocalTime());
+ return true;
+ }
+ }
+
+ public void ClearExpiredNonces() {
+ removeExpiredRows(dataSet.Nonce, dataSet.Nonce.ExpiresColumn.ColumnName);
+ }
+
+ #endregion
+
+ void removeExpiredRows(DataTable table, string expiredColumnName) {
+ string filter = string.Format(CultureInfo.InvariantCulture, "{0} < #{1}#",
+ expiredColumnName, DateTime.Now);
+ DataView view = new DataView(table, filter, null, DataViewRowState.CurrentRows);
+ for (int i = view.Count - 1; i >= 0; i--)
+ view.Delete(i);
+ }
+ }
+}
diff --git a/samples/RelyingPartyPortal/Code/CustomStoreDataSet.Designer.cs b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.Designer.cs
new file mode 100644
index 0000000..5b7c03e
--- /dev/null
+++ b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.Designer.cs
@@ -0,0 +1,976 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3053
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+#pragma warning disable 1591
+
+namespace ConsumerPortal.Code {
+
+
+ /// <summary>
+ ///Represents a strongly typed in-memory cache of data.
+ ///</summary>
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
+ [global::System.Serializable()]
+ [global::System.ComponentModel.DesignerCategoryAttribute("code")]
+ [global::System.ComponentModel.ToolboxItem(true)]
+ [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")]
+ [global::System.Xml.Serialization.XmlRootAttribute("CustomStoreDataSet")]
+ [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")]
+ public partial class CustomStoreDataSet : global::System.Data.DataSet {
+
+ private AssociationDataTable tableAssociation;
+
+ private NonceDataTable tableNonce;
+
+ private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public CustomStoreDataSet() {
+ this.BeginInit();
+ this.InitClass();
+ global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
+ base.Tables.CollectionChanged += schemaChangedHandler;
+ base.Relations.CollectionChanged += schemaChangedHandler;
+ this.EndInit();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected CustomStoreDataSet(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
+ base(info, context, false) {
+ if ((this.IsBinarySerialized(info, context) == true)) {
+ this.InitVars(false);
+ global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
+ this.Tables.CollectionChanged += schemaChangedHandler1;
+ this.Relations.CollectionChanged += schemaChangedHandler1;
+ return;
+ }
+ string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
+ if ((this.DetermineSchemaSerializationMode(info, context) == global::System.Data.SchemaSerializationMode.IncludeSchema)) {
+ global::System.Data.DataSet ds = new global::System.Data.DataSet();
+ ds.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema)));
+ if ((ds.Tables["Association"] != null)) {
+ base.Tables.Add(new AssociationDataTable(ds.Tables["Association"]));
+ }
+ if ((ds.Tables["Nonce"] != null)) {
+ base.Tables.Add(new NonceDataTable(ds.Tables["Nonce"]));
+ }
+ this.DataSetName = ds.DataSetName;
+ this.Prefix = ds.Prefix;
+ this.Namespace = ds.Namespace;
+ this.Locale = ds.Locale;
+ this.CaseSensitive = ds.CaseSensitive;
+ this.EnforceConstraints = ds.EnforceConstraints;
+ this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add);
+ this.InitVars();
+ }
+ else {
+ this.ReadXmlSchema(new global::System.Xml.XmlTextReader(new global::System.IO.StringReader(strSchema)));
+ }
+ this.GetSerializationData(info, context);
+ global::System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new global::System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
+ base.Tables.CollectionChanged += schemaChangedHandler;
+ this.Relations.CollectionChanged += schemaChangedHandler;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.ComponentModel.Browsable(false)]
+ [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
+ public AssociationDataTable Association {
+ get {
+ return this.tableAssociation;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.ComponentModel.Browsable(false)]
+ [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)]
+ public NonceDataTable Nonce {
+ get {
+ return this.tableNonce;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.ComponentModel.BrowsableAttribute(true)]
+ [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Visible)]
+ public override global::System.Data.SchemaSerializationMode SchemaSerializationMode {
+ get {
+ return this._schemaSerializationMode;
+ }
+ set {
+ this._schemaSerializationMode = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)]
+ public new global::System.Data.DataTableCollection Tables {
+ get {
+ return base.Tables;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)]
+ public new global::System.Data.DataRelationCollection Relations {
+ get {
+ return base.Relations;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override void InitializeDerivedDataSet() {
+ this.BeginInit();
+ this.InitClass();
+ this.EndInit();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public override global::System.Data.DataSet Clone() {
+ CustomStoreDataSet cln = ((CustomStoreDataSet)(base.Clone()));
+ cln.InitVars();
+ cln.SchemaSerializationMode = this.SchemaSerializationMode;
+ return cln;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override bool ShouldSerializeTables() {
+ return false;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override bool ShouldSerializeRelations() {
+ return false;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override void ReadXmlSerializable(global::System.Xml.XmlReader reader) {
+ if ((this.DetermineSchemaSerializationMode(reader) == global::System.Data.SchemaSerializationMode.IncludeSchema)) {
+ this.Reset();
+ global::System.Data.DataSet ds = new global::System.Data.DataSet();
+ ds.ReadXml(reader);
+ if ((ds.Tables["Association"] != null)) {
+ base.Tables.Add(new AssociationDataTable(ds.Tables["Association"]));
+ }
+ if ((ds.Tables["Nonce"] != null)) {
+ base.Tables.Add(new NonceDataTable(ds.Tables["Nonce"]));
+ }
+ this.DataSetName = ds.DataSetName;
+ this.Prefix = ds.Prefix;
+ this.Namespace = ds.Namespace;
+ this.Locale = ds.Locale;
+ this.CaseSensitive = ds.CaseSensitive;
+ this.EnforceConstraints = ds.EnforceConstraints;
+ this.Merge(ds, false, global::System.Data.MissingSchemaAction.Add);
+ this.InitVars();
+ }
+ else {
+ this.ReadXml(reader);
+ this.InitVars();
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override global::System.Xml.Schema.XmlSchema GetSchemaSerializable() {
+ global::System.IO.MemoryStream stream = new global::System.IO.MemoryStream();
+ this.WriteXmlSchema(new global::System.Xml.XmlTextWriter(stream, null));
+ stream.Position = 0;
+ return global::System.Xml.Schema.XmlSchema.Read(new global::System.Xml.XmlTextReader(stream), null);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal void InitVars() {
+ this.InitVars(true);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal void InitVars(bool initTable) {
+ this.tableAssociation = ((AssociationDataTable)(base.Tables["Association"]));
+ if ((initTable == true)) {
+ if ((this.tableAssociation != null)) {
+ this.tableAssociation.InitVars();
+ }
+ }
+ this.tableNonce = ((NonceDataTable)(base.Tables["Nonce"]));
+ if ((initTable == true)) {
+ if ((this.tableNonce != null)) {
+ this.tableNonce.InitVars();
+ }
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ private void InitClass() {
+ this.DataSetName = "CustomStoreDataSet";
+ this.Prefix = "";
+ this.Namespace = "http://tempuri.org/CustomStoreDataSet.xsd";
+ this.EnforceConstraints = true;
+ this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema;
+ this.tableAssociation = new AssociationDataTable();
+ base.Tables.Add(this.tableAssociation);
+ this.tableNonce = new NonceDataTable();
+ base.Tables.Add(this.tableNonce);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ private bool ShouldSerializeAssociation() {
+ return false;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ private bool ShouldSerializeNonce() {
+ return false;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ private void SchemaChanged(object sender, global::System.ComponentModel.CollectionChangeEventArgs e) {
+ if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove)) {
+ this.InitVars();
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
+ CustomStoreDataSet ds = new CustomStoreDataSet();
+ global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
+ global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
+ global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
+ any.Namespace = ds.Namespace;
+ sequence.Items.Add(any);
+ type.Particle = sequence;
+ global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
+ if (xs.Contains(dsSchema.TargetNamespace)) {
+ global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
+ global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
+ try {
+ global::System.Xml.Schema.XmlSchema schema = null;
+ dsSchema.Write(s1);
+ for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
+ schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
+ s2.SetLength(0);
+ schema.Write(s2);
+ if ((s1.Length == s2.Length)) {
+ s1.Position = 0;
+ s2.Position = 0;
+ for (; ((s1.Position != s1.Length)
+ && (s1.ReadByte() == s2.ReadByte())); ) {
+ ;
+ }
+ if ((s1.Position == s1.Length)) {
+ return type;
+ }
+ }
+ }
+ }
+ finally {
+ if ((s1 != null)) {
+ s1.Close();
+ }
+ if ((s2 != null)) {
+ s2.Close();
+ }
+ }
+ }
+ xs.Add(dsSchema);
+ return type;
+ }
+
+ public delegate void AssociationRowChangeEventHandler(object sender, AssociationRowChangeEvent e);
+
+ public delegate void NonceRowChangeEventHandler(object sender, NonceRowChangeEvent e);
+
+ /// <summary>
+ ///Represents the strongly named DataTable class.
+ ///</summary>
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
+ [global::System.Serializable()]
+ [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
+ public partial class AssociationDataTable : global::System.Data.DataTable, global::System.Collections.IEnumerable {
+
+ private global::System.Data.DataColumn columnDistinguishingFactor;
+
+ private global::System.Data.DataColumn columnHandle;
+
+ private global::System.Data.DataColumn columnExpires;
+
+ private global::System.Data.DataColumn columnPrivateData;
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public AssociationDataTable() {
+ this.TableName = "Association";
+ this.BeginInit();
+ this.InitClass();
+ this.EndInit();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal AssociationDataTable(global::System.Data.DataTable table) {
+ this.TableName = table.TableName;
+ if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
+ this.CaseSensitive = table.CaseSensitive;
+ }
+ if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
+ this.Locale = table.Locale;
+ }
+ if ((table.Namespace != table.DataSet.Namespace)) {
+ this.Namespace = table.Namespace;
+ }
+ this.Prefix = table.Prefix;
+ this.MinimumCapacity = table.MinimumCapacity;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected AssociationDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
+ base(info, context) {
+ this.InitVars();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public global::System.Data.DataColumn DistinguishingFactorColumn {
+ get {
+ return this.columnDistinguishingFactor;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public global::System.Data.DataColumn HandleColumn {
+ get {
+ return this.columnHandle;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public global::System.Data.DataColumn ExpiresColumn {
+ get {
+ return this.columnExpires;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public global::System.Data.DataColumn PrivateDataColumn {
+ get {
+ return this.columnPrivateData;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.ComponentModel.Browsable(false)]
+ public int Count {
+ get {
+ return this.Rows.Count;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public AssociationRow this[int index] {
+ get {
+ return ((AssociationRow)(this.Rows[index]));
+ }
+ }
+
+ public event AssociationRowChangeEventHandler AssociationRowChanging;
+
+ public event AssociationRowChangeEventHandler AssociationRowChanged;
+
+ public event AssociationRowChangeEventHandler AssociationRowDeleting;
+
+ public event AssociationRowChangeEventHandler AssociationRowDeleted;
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public void AddAssociationRow(AssociationRow row) {
+ this.Rows.Add(row);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public AssociationRow AddAssociationRow(string DistinguishingFactor, string Handle, System.DateTime Expires, byte[] PrivateData) {
+ AssociationRow rowAssociationRow = ((AssociationRow)(this.NewRow()));
+ object[] columnValuesArray = new object[] {
+ DistinguishingFactor,
+ Handle,
+ Expires,
+ PrivateData};
+ rowAssociationRow.ItemArray = columnValuesArray;
+ this.Rows.Add(rowAssociationRow);
+ return rowAssociationRow;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public AssociationRow FindByDistinguishingFactorHandle(string DistinguishingFactor, string Handle) {
+ return ((AssociationRow)(this.Rows.Find(new object[] {
+ DistinguishingFactor,
+ Handle})));
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public virtual global::System.Collections.IEnumerator GetEnumerator() {
+ return this.Rows.GetEnumerator();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public override global::System.Data.DataTable Clone() {
+ AssociationDataTable cln = ((AssociationDataTable)(base.Clone()));
+ cln.InitVars();
+ return cln;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override global::System.Data.DataTable CreateInstance() {
+ return new AssociationDataTable();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal void InitVars() {
+ this.columnDistinguishingFactor = base.Columns["DistinguishingFactor"];
+ this.columnHandle = base.Columns["Handle"];
+ this.columnExpires = base.Columns["Expires"];
+ this.columnPrivateData = base.Columns["PrivateData"];
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ private void InitClass() {
+ this.columnDistinguishingFactor = new global::System.Data.DataColumn("DistinguishingFactor", typeof(string), null, global::System.Data.MappingType.Element);
+ base.Columns.Add(this.columnDistinguishingFactor);
+ this.columnHandle = new global::System.Data.DataColumn("Handle", typeof(string), null, global::System.Data.MappingType.Element);
+ base.Columns.Add(this.columnHandle);
+ this.columnExpires = new global::System.Data.DataColumn("Expires", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element);
+ base.Columns.Add(this.columnExpires);
+ this.columnPrivateData = new global::System.Data.DataColumn("PrivateData", typeof(byte[]), null, global::System.Data.MappingType.Element);
+ base.Columns.Add(this.columnPrivateData);
+ this.Constraints.Add(new global::System.Data.UniqueConstraint("PrimaryKey", new global::System.Data.DataColumn[] {
+ this.columnDistinguishingFactor,
+ this.columnHandle}, true));
+ this.columnDistinguishingFactor.AllowDBNull = false;
+ this.columnHandle.AllowDBNull = false;
+ this.columnExpires.AllowDBNull = false;
+ this.columnPrivateData.AllowDBNull = false;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public AssociationRow NewAssociationRow() {
+ return ((AssociationRow)(this.NewRow()));
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
+ return new AssociationRow(builder);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override global::System.Type GetRowType() {
+ return typeof(AssociationRow);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
+ base.OnRowChanged(e);
+ if ((this.AssociationRowChanged != null)) {
+ this.AssociationRowChanged(this, new AssociationRowChangeEvent(((AssociationRow)(e.Row)), e.Action));
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
+ base.OnRowChanging(e);
+ if ((this.AssociationRowChanging != null)) {
+ this.AssociationRowChanging(this, new AssociationRowChangeEvent(((AssociationRow)(e.Row)), e.Action));
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
+ base.OnRowDeleted(e);
+ if ((this.AssociationRowDeleted != null)) {
+ this.AssociationRowDeleted(this, new AssociationRowChangeEvent(((AssociationRow)(e.Row)), e.Action));
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
+ base.OnRowDeleting(e);
+ if ((this.AssociationRowDeleting != null)) {
+ this.AssociationRowDeleting(this, new AssociationRowChangeEvent(((AssociationRow)(e.Row)), e.Action));
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public void RemoveAssociationRow(AssociationRow row) {
+ this.Rows.Remove(row);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
+ global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
+ global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
+ CustomStoreDataSet ds = new CustomStoreDataSet();
+ global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
+ any1.Namespace = "http://www.w3.org/2001/XMLSchema";
+ any1.MinOccurs = new decimal(0);
+ any1.MaxOccurs = decimal.MaxValue;
+ any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
+ sequence.Items.Add(any1);
+ global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
+ any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
+ any2.MinOccurs = new decimal(1);
+ any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
+ sequence.Items.Add(any2);
+ global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
+ attribute1.Name = "namespace";
+ attribute1.FixedValue = ds.Namespace;
+ type.Attributes.Add(attribute1);
+ global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
+ attribute2.Name = "tableTypeName";
+ attribute2.FixedValue = "AssociationDataTable";
+ type.Attributes.Add(attribute2);
+ type.Particle = sequence;
+ global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
+ if (xs.Contains(dsSchema.TargetNamespace)) {
+ global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
+ global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
+ try {
+ global::System.Xml.Schema.XmlSchema schema = null;
+ dsSchema.Write(s1);
+ for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
+ schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
+ s2.SetLength(0);
+ schema.Write(s2);
+ if ((s1.Length == s2.Length)) {
+ s1.Position = 0;
+ s2.Position = 0;
+ for (; ((s1.Position != s1.Length)
+ && (s1.ReadByte() == s2.ReadByte())); ) {
+ ;
+ }
+ if ((s1.Position == s1.Length)) {
+ return type;
+ }
+ }
+ }
+ }
+ finally {
+ if ((s1 != null)) {
+ s1.Close();
+ }
+ if ((s2 != null)) {
+ s2.Close();
+ }
+ }
+ }
+ xs.Add(dsSchema);
+ return type;
+ }
+ }
+
+ /// <summary>
+ ///Represents the strongly named DataTable class.
+ ///</summary>
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
+ [global::System.Serializable()]
+ [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")]
+ public partial class NonceDataTable : global::System.Data.DataTable, global::System.Collections.IEnumerable {
+
+ private global::System.Data.DataColumn columnCode;
+
+ private global::System.Data.DataColumn columnExpires;
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public NonceDataTable() {
+ this.TableName = "Nonce";
+ this.BeginInit();
+ this.InitClass();
+ this.EndInit();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal NonceDataTable(global::System.Data.DataTable table) {
+ this.TableName = table.TableName;
+ if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
+ this.CaseSensitive = table.CaseSensitive;
+ }
+ if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
+ this.Locale = table.Locale;
+ }
+ if ((table.Namespace != table.DataSet.Namespace)) {
+ this.Namespace = table.Namespace;
+ }
+ this.Prefix = table.Prefix;
+ this.MinimumCapacity = table.MinimumCapacity;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected NonceDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) :
+ base(info, context) {
+ this.InitVars();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public global::System.Data.DataColumn CodeColumn {
+ get {
+ return this.columnCode;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public global::System.Data.DataColumn ExpiresColumn {
+ get {
+ return this.columnExpires;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.ComponentModel.Browsable(false)]
+ public int Count {
+ get {
+ return this.Rows.Count;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public NonceRow this[int index] {
+ get {
+ return ((NonceRow)(this.Rows[index]));
+ }
+ }
+
+ public event NonceRowChangeEventHandler NonceRowChanging;
+
+ public event NonceRowChangeEventHandler NonceRowChanged;
+
+ public event NonceRowChangeEventHandler NonceRowDeleting;
+
+ public event NonceRowChangeEventHandler NonceRowDeleted;
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public void AddNonceRow(NonceRow row) {
+ this.Rows.Add(row);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public NonceRow AddNonceRow(string Code, System.DateTime Expires) {
+ NonceRow rowNonceRow = ((NonceRow)(this.NewRow()));
+ object[] columnValuesArray = new object[] {
+ Code,
+ Expires};
+ rowNonceRow.ItemArray = columnValuesArray;
+ this.Rows.Add(rowNonceRow);
+ return rowNonceRow;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public NonceRow FindByCode(string Code) {
+ return ((NonceRow)(this.Rows.Find(new object[] {
+ Code})));
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public virtual global::System.Collections.IEnumerator GetEnumerator() {
+ return this.Rows.GetEnumerator();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public override global::System.Data.DataTable Clone() {
+ NonceDataTable cln = ((NonceDataTable)(base.Clone()));
+ cln.InitVars();
+ return cln;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override global::System.Data.DataTable CreateInstance() {
+ return new NonceDataTable();
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal void InitVars() {
+ this.columnCode = base.Columns["Code"];
+ this.columnExpires = base.Columns["Expires"];
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ private void InitClass() {
+ this.columnCode = new global::System.Data.DataColumn("Code", typeof(string), null, global::System.Data.MappingType.Element);
+ base.Columns.Add(this.columnCode);
+ this.columnExpires = new global::System.Data.DataColumn("Expires", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element);
+ base.Columns.Add(this.columnExpires);
+ this.Constraints.Add(new global::System.Data.UniqueConstraint("PrimaryKey", new global::System.Data.DataColumn[] {
+ this.columnCode}, true));
+ this.columnCode.AllowDBNull = false;
+ this.columnCode.Unique = true;
+ this.columnExpires.AllowDBNull = false;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public NonceRow NewNonceRow() {
+ return ((NonceRow)(this.NewRow()));
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) {
+ return new NonceRow(builder);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override global::System.Type GetRowType() {
+ return typeof(NonceRow);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) {
+ base.OnRowChanged(e);
+ if ((this.NonceRowChanged != null)) {
+ this.NonceRowChanged(this, new NonceRowChangeEvent(((NonceRow)(e.Row)), e.Action));
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) {
+ base.OnRowChanging(e);
+ if ((this.NonceRowChanging != null)) {
+ this.NonceRowChanging(this, new NonceRowChangeEvent(((NonceRow)(e.Row)), e.Action));
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) {
+ base.OnRowDeleted(e);
+ if ((this.NonceRowDeleted != null)) {
+ this.NonceRowDeleted(this, new NonceRowChangeEvent(((NonceRow)(e.Row)), e.Action));
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) {
+ base.OnRowDeleting(e);
+ if ((this.NonceRowDeleting != null)) {
+ this.NonceRowDeleting(this, new NonceRowChangeEvent(((NonceRow)(e.Row)), e.Action));
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public void RemoveNonceRow(NonceRow row) {
+ this.Rows.Remove(row);
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
+ global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
+ global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
+ CustomStoreDataSet ds = new CustomStoreDataSet();
+ global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
+ any1.Namespace = "http://www.w3.org/2001/XMLSchema";
+ any1.MinOccurs = new decimal(0);
+ any1.MaxOccurs = decimal.MaxValue;
+ any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
+ sequence.Items.Add(any1);
+ global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
+ any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
+ any2.MinOccurs = new decimal(1);
+ any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
+ sequence.Items.Add(any2);
+ global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
+ attribute1.Name = "namespace";
+ attribute1.FixedValue = ds.Namespace;
+ type.Attributes.Add(attribute1);
+ global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
+ attribute2.Name = "tableTypeName";
+ attribute2.FixedValue = "NonceDataTable";
+ type.Attributes.Add(attribute2);
+ type.Particle = sequence;
+ global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
+ if (xs.Contains(dsSchema.TargetNamespace)) {
+ global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
+ global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
+ try {
+ global::System.Xml.Schema.XmlSchema schema = null;
+ dsSchema.Write(s1);
+ for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
+ schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
+ s2.SetLength(0);
+ schema.Write(s2);
+ if ((s1.Length == s2.Length)) {
+ s1.Position = 0;
+ s2.Position = 0;
+ for (; ((s1.Position != s1.Length)
+ && (s1.ReadByte() == s2.ReadByte())); ) {
+ ;
+ }
+ if ((s1.Position == s1.Length)) {
+ return type;
+ }
+ }
+ }
+ }
+ finally {
+ if ((s1 != null)) {
+ s1.Close();
+ }
+ if ((s2 != null)) {
+ s2.Close();
+ }
+ }
+ }
+ xs.Add(dsSchema);
+ return type;
+ }
+ }
+
+ /// <summary>
+ ///Represents strongly named DataRow class.
+ ///</summary>
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
+ public partial class AssociationRow : global::System.Data.DataRow {
+
+ private AssociationDataTable tableAssociation;
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal AssociationRow(global::System.Data.DataRowBuilder rb) :
+ base(rb) {
+ this.tableAssociation = ((AssociationDataTable)(this.Table));
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public string DistinguishingFactor {
+ get {
+ return ((string)(this[this.tableAssociation.DistinguishingFactorColumn]));
+ }
+ set {
+ this[this.tableAssociation.DistinguishingFactorColumn] = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public string Handle {
+ get {
+ return ((string)(this[this.tableAssociation.HandleColumn]));
+ }
+ set {
+ this[this.tableAssociation.HandleColumn] = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public System.DateTime Expires {
+ get {
+ return ((global::System.DateTime)(this[this.tableAssociation.ExpiresColumn]));
+ }
+ set {
+ this[this.tableAssociation.ExpiresColumn] = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public byte[] PrivateData {
+ get {
+ return ((byte[])(this[this.tableAssociation.PrivateDataColumn]));
+ }
+ set {
+ this[this.tableAssociation.PrivateDataColumn] = value;
+ }
+ }
+ }
+
+ /// <summary>
+ ///Represents strongly named DataRow class.
+ ///</summary>
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
+ public partial class NonceRow : global::System.Data.DataRow {
+
+ private NonceDataTable tableNonce;
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ internal NonceRow(global::System.Data.DataRowBuilder rb) :
+ base(rb) {
+ this.tableNonce = ((NonceDataTable)(this.Table));
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public string Code {
+ get {
+ return ((string)(this[this.tableNonce.CodeColumn]));
+ }
+ set {
+ this[this.tableNonce.CodeColumn] = value;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public System.DateTime Expires {
+ get {
+ return ((global::System.DateTime)(this[this.tableNonce.ExpiresColumn]));
+ }
+ set {
+ this[this.tableNonce.ExpiresColumn] = value;
+ }
+ }
+ }
+
+ /// <summary>
+ ///Row event argument class
+ ///</summary>
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
+ public class AssociationRowChangeEvent : global::System.EventArgs {
+
+ private AssociationRow eventRow;
+
+ private global::System.Data.DataRowAction eventAction;
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public AssociationRowChangeEvent(AssociationRow row, global::System.Data.DataRowAction action) {
+ this.eventRow = row;
+ this.eventAction = action;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public AssociationRow Row {
+ get {
+ return this.eventRow;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public global::System.Data.DataRowAction Action {
+ get {
+ return this.eventAction;
+ }
+ }
+ }
+
+ /// <summary>
+ ///Row event argument class
+ ///</summary>
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
+ public class NonceRowChangeEvent : global::System.EventArgs {
+
+ private NonceRow eventRow;
+
+ private global::System.Data.DataRowAction eventAction;
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public NonceRowChangeEvent(NonceRow row, global::System.Data.DataRowAction action) {
+ this.eventRow = row;
+ this.eventAction = action;
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public NonceRow Row {
+ get {
+ return this.eventRow;
+ }
+ }
+
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public global::System.Data.DataRowAction Action {
+ get {
+ return this.eventAction;
+ }
+ }
+ }
+ }
+}
+
+#pragma warning restore 1591 \ No newline at end of file
diff --git a/samples/RelyingPartyPortal/Code/CustomStoreDataSet.cs b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.cs
new file mode 100644
index 0000000..d53f870
--- /dev/null
+++ b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.cs
@@ -0,0 +1,6 @@
+namespace ConsumerPortal.Code {
+
+
+ public partial class CustomStoreDataSet {
+ }
+}
diff --git a/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsc b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsc
new file mode 100644
index 0000000..551fc56
--- /dev/null
+++ b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsc
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--<autogenerated>
+ This code was generated by a tool.
+ Changes to this file may cause incorrect behavior and will be lost if
+ the code is regenerated.
+</autogenerated>-->
+<DataSetUISetting Version="1.00" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
+ <TableUISettings />
+</DataSetUISetting> \ No newline at end of file
diff --git a/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsd b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsd
new file mode 100644
index 0000000..76b77aa
--- /dev/null
+++ b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xsd
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema id="CustomStoreDataSet" targetNamespace="http://tempuri.org/CustomStoreDataSet.xsd" xmlns:mstns="http://tempuri.org/CustomStoreDataSet.xsd" xmlns="http://tempuri.org/CustomStoreDataSet.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
+ <xs:annotation>
+ <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
+ <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
+ <Connections />
+ <Tables />
+ <Sources />
+ </DataSource>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:element name="CustomStoreDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="CustomStoreDataSet" msprop:Generator_DataSetName="CustomStoreDataSet" msprop:EnableTableAdapterManager="true">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="Association" msprop:Generator_UserTableName="Association" msprop:Generator_RowDeletedName="AssociationRowDeleted" msprop:Generator_RowChangedName="AssociationRowChanged" msprop:Generator_RowClassName="AssociationRow" msprop:Generator_RowChangingName="AssociationRowChanging" msprop:Generator_RowEvArgName="AssociationRowChangeEvent" msprop:Generator_RowEvHandlerName="AssociationRowChangeEventHandler" msprop:Generator_TableClassName="AssociationDataTable" msprop:Generator_TableVarName="tableAssociation" msprop:Generator_RowDeletingName="AssociationRowDeleting" msprop:Generator_TablePropName="Association">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="DistinguishingFactor" msprop:Generator_UserColumnName="DistinguishingFactor" msprop:Generator_ColumnVarNameInTable="columnDistinguishingFactor" msprop:Generator_ColumnPropNameInRow="DistinguishingFactor" msprop:Generator_ColumnPropNameInTable="DistinguishingFactorColumn" type="xs:string" />
+ <xs:element name="Handle" msprop:Generator_UserColumnName="Handle" msprop:Generator_ColumnVarNameInTable="columnHandle" msprop:Generator_ColumnPropNameInRow="Handle" msprop:Generator_ColumnPropNameInTable="HandleColumn" type="xs:string" />
+ <xs:element name="Expires" msprop:Generator_UserColumnName="Expires" msprop:Generator_ColumnVarNameInTable="columnExpires" msprop:Generator_ColumnPropNameInRow="Expires" msprop:Generator_ColumnPropNameInTable="ExpiresColumn" type="xs:dateTime" />
+ <xs:element name="PrivateData" msprop:Generator_UserColumnName="PrivateData" msprop:Generator_ColumnVarNameInTable="columnPrivateData" msprop:Generator_ColumnPropNameInRow="PrivateData" msprop:Generator_ColumnPropNameInTable="PrivateDataColumn" type="xs:base64Binary" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Nonce" msprop:Generator_UserTableName="Nonce" msprop:Generator_RowDeletedName="NonceRowDeleted" msprop:Generator_TableClassName="NonceDataTable" msprop:Generator_RowChangedName="NonceRowChanged" msprop:Generator_RowClassName="NonceRow" msprop:Generator_RowChangingName="NonceRowChanging" msprop:Generator_RowEvArgName="NonceRowChangeEvent" msprop:Generator_RowEvHandlerName="NonceRowChangeEventHandler" msprop:Generator_TablePropName="Nonce" msprop:Generator_TableVarName="tableNonce" msprop:Generator_RowDeletingName="NonceRowDeleting">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Code" msprop:Generator_UserColumnName="Code" msprop:Generator_ColumnPropNameInRow="Code" msprop:Generator_ColumnVarNameInTable="columnCode" msprop:Generator_ColumnPropNameInTable="CodeColumn" type="xs:string" />
+ <xs:element name="Expires" msprop:Generator_UserColumnName="Expires" msprop:Generator_ColumnPropNameInRow="Expires" msprop:Generator_ColumnVarNameInTable="columnExpires" msprop:Generator_ColumnPropNameInTable="ExpiresColumn" type="xs:dateTime" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+ <xs:unique name="PrimaryKey" msdata:PrimaryKey="true">
+ <xs:selector xpath=".//mstns:Association" />
+ <xs:field xpath="mstns:DistinguishingFactor" />
+ <xs:field xpath="mstns:Handle" />
+ </xs:unique>
+ <xs:unique name="Nonce_PrimaryKey" msdata:ConstraintName="PrimaryKey" msdata:PrimaryKey="true">
+ <xs:selector xpath=".//mstns:Nonce" />
+ <xs:field xpath="mstns:Code" />
+ </xs:unique>
+ </xs:element>
+</xs:schema> \ No newline at end of file
diff --git a/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xss b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xss
new file mode 100644
index 0000000..fbe7113
--- /dev/null
+++ b/samples/RelyingPartyPortal/Code/CustomStoreDataSet.xss
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--<autogenerated>
+ This code was generated by a tool to store the dataset designer's layout information.
+ Changes to this file may cause incorrect behavior and will be lost if
+ the code is regenerated.
+</autogenerated>-->
+<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="0" ViewPortY="0" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
+ <Shapes>
+ <Shape ID="DesignTable:Association" ZOrder="2" X="349" Y="83" Height="105" Width="154" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="101" />
+ <Shape ID="DesignTable:Nonce" ZOrder="1" X="604" Y="86" Height="67" Width="150" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="63" />
+ </Shapes>
+ <Connectors />
+</DiagramLayout> \ No newline at end of file
diff --git a/samples/RelyingPartyPortal/Code/State.cs b/samples/RelyingPartyPortal/Code/State.cs
index 65e676c..141115f 100644
--- a/samples/RelyingPartyPortal/Code/State.cs
+++ b/samples/RelyingPartyPortal/Code/State.cs
@@ -1,34 +1,27 @@
-using System;
-using System.Data;
-using System.Configuration;
using System.Web;
-using System.Web.Security;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.Web.UI.WebControls.WebParts;
-using System.Web.UI.HtmlControls;
using DotNetOpenId.Extensions.SimpleRegistration;
+using System.Collections.Generic;
+using DotNetOpenId.Extensions.ProviderAuthenticationPolicy;
/// <summary>
-/// Summary description for State
+/// Strong-typed bag of session state.
/// </summary>
-public class State
-{
- public State()
- {
- }
-
- public static ClaimsResponse ProfileFields
- {
- get
- {
- if (HttpContext.Current .Session["ProfileFields"] == null)
- {
- HttpContext.Current .Session["ProfileFields"] = new ClaimsResponse();
- }
- return (ClaimsResponse)HttpContext.Current .Session["ProfileFields"];
- }
- set { HttpContext.Current .Session["ProfileFields"] = value; }
- }
-
+public class State {
+ public static void Clear() {
+ ProfileFields = null;
+ FriendlyLoginName = null;
+ PapePolicies = 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; }
+ }
+ public static PolicyResponse PapePolicies {
+ get { return HttpContext.Current.Session["PapePolicies"] as PolicyResponse; }
+ set { HttpContext.Current.Session["PapePolicies"] = value; }
+ }
}
diff --git a/samples/RelyingPartyPortal/Code/TracePageAppender.cs b/samples/RelyingPartyPortal/Code/TracePageAppender.cs
new file mode 100644
index 0000000..c10770b
--- /dev/null
+++ b/samples/RelyingPartyPortal/Code/TracePageAppender.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Web;
+using System.IO;
+
+namespace ConsumerPortal.Code {
+ public class TracePageAppender : log4net.Appender.AppenderSkeleton {
+ protected override void Append(log4net.Core.LoggingEvent loggingEvent) {
+ StringWriter sw = new StringWriter(Global.LogMessages);
+ Layout.Format(sw, loggingEvent);
+ }
+ }
+}
diff --git a/samples/RelyingPartyPortal/Default.aspx b/samples/RelyingPartyPortal/Default.aspx
index b303c12..bdb9b27 100644
--- a/samples/RelyingPartyPortal/Default.aspx
+++ b/samples/RelyingPartyPortal/Default.aspx
@@ -1,26 +1,13 @@
-<%@ Page Language="C#" AutoEventWireup="true" %>
+<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.Master" %>
<%@ Register Assembly="DotNetOpenId" Namespace="DotNetOpenId" TagPrefix="openid" %>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head runat="server">
- <title>OpenID Relying Party, by DotNetOpenId</title>
- <openid:XrdsPublisher runat="server" XrdsUrl="~/xrds.aspx" />
-</head>
-<body>
- <form id="form1" runat="server">
- <h1>
- OpenID Relying Party
- </h1>
- <h2>
- Provided by <a href="http://dotnetopenid.googlecode.com">DotNetOpenId</a>
- </h2>
- <p>
- Visit the
- <asp:HyperLink runat="server" NavigateUrl="~/MembersOnly/Default.aspx" Text="Members Only" />
- area. (This will trigger a login demo).
- </p>
- <asp:LoginStatus runat="server" />
- </form>
-</body>
-</html>
+<asp:Content runat="server" ContentPlaceHolderID="head">
+ <openid:XrdsPublisher ID="XrdsPublisher1" runat="server" XrdsUrl="~/xrds.aspx" />
+</asp:Content>
+<asp:Content runat="server" ContentPlaceHolderID="main">
+ <h2>Relying Party </h2>
+ <p>Visit the
+ <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/MembersOnly/Default.aspx"
+ Text="Members Only" />
+ area. (This will trigger a login demo). </p>
+</asp:Content>
diff --git a/samples/RelyingPartyPortal/Global.asax.cs b/samples/RelyingPartyPortal/Global.asax.cs
index 56636a5..eb61da9 100644
--- a/samples/RelyingPartyPortal/Global.asax.cs
+++ b/samples/RelyingPartyPortal/Global.asax.cs
@@ -1,14 +1,24 @@
using System;
using System.Collections.Specialized;
-using System.Diagnostics;
using System.IO;
+using System.Text;
using System.Web;
namespace ConsumerPortal {
public class Global : System.Web.HttpApplication {
- public Global() {
- // since this is a sample, and will often be used with localhost
- DotNetOpenId.UntrustedWebRequest.WhitelistHosts.Add("localhost");
+ internal static StringBuilder LogMessages = new StringBuilder();
+
+ public static log4net.ILog Logger = log4net.LogManager.GetLogger(typeof(Global));
+
+ protected void Application_Start(object sender, EventArgs e) {
+ log4net.Config.XmlConfigurator.Configure();
+ Logger.Info("Sample starting...");
+ }
+
+ protected void Application_End(object sender, EventArgs e) {
+ Logger.Info("Sample shutting down...");
+ // this would be automatic, but in partial trust scenarios it is not.
+ log4net.LogManager.Shutdown();
}
string stripQueryString(Uri uri) {
@@ -19,22 +29,22 @@ namespace ConsumerPortal {
protected void Application_BeginRequest(Object sender, EventArgs e) {
// System.Diagnostics.Debugger.Launch();
- Trace.TraceInformation("Processing {0} on {1} ", Request.HttpMethod, stripQueryString(Request.Url));
+ Logger.DebugFormat("Processing {0} on {1} ", Request.HttpMethod, stripQueryString(Request.Url));
if (Request.QueryString.Count > 0)
- Trace.TraceInformation("Querystring follows: \n{0}", ToString(Request.QueryString));
+ Logger.DebugFormat("Querystring follows: \n{0}", ToString(Request.QueryString));
if (Request.Form.Count > 0)
- Trace.TraceInformation("Posted form follows: \n{0}", ToString(Request.Form));
+ Logger.DebugFormat("Posted form follows: \n{0}", ToString(Request.Form));
}
protected void Application_AuthenticateRequest(Object sender, EventArgs e) {
- Trace.TraceInformation("User {0} authenticated.", HttpContext.Current.User != null ? "IS" : "is NOT");
+ Logger.DebugFormat("User {0} authenticated.", HttpContext.Current.User != null ? "IS" : "is NOT");
}
protected void Application_EndRequest(Object sender, EventArgs e) {
}
protected void Application_Error(Object sender, EventArgs e) {
- Trace.TraceError("An unhandled exception was raised. Details follow: {0}",
+ Logger.ErrorFormat("An unhandled exception was raised. Details follow: {0}",
HttpContext.Current.Server.GetLastError());
}
diff --git a/samples/RelyingPartyPortal/MembersOnly/Default.aspx b/samples/RelyingPartyPortal/MembersOnly/Default.aspx
index 4f384cd..fe87b37 100644
--- a/samples/RelyingPartyPortal/MembersOnly/Default.aspx
+++ b/samples/RelyingPartyPortal/MembersOnly/Default.aspx
@@ -1,22 +1,27 @@
-<%@ Page Language="C#" AutoEventWireup="true" %>
+<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.Master" %>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head runat="server">
- <title>Welcome OpenID User!</title>
-</head>
-<body>
- <form id="form1" runat="server">
- <h1>
+<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main">
+ <h2>
Members Only Area
- </h1>
+ </h2>
<p>
- Congratulations, <b>
- <asp:LoginName ID="LoginName1" runat="server" />
- </b>. You have completed the OpenID login process.
+ 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.PapePolicies != null) { %>
+ <p>A PAPE extension was included in the authentication with this content: </p>
+ <ul>
+ <% if (State.PapePolicies.NistAssuranceLevel != null) {%>
+ <li>Nist: <%=HttpUtility.HtmlEncode(State.PapePolicies.NistAssuranceLevel.Value.ToString())%></li>
+ <% }
+ foreach (string policy in State.PapePolicies.ActualPolicies) { %>
+ <li><%=HttpUtility.HtmlEncode(policy) %></li>
+ <% } %>
+ </ul>
+<% } %>
+
+<% if (State.ProfileFields != null) { %>
<p>
In addition to authenticating you, your OpenID Provider may
have told us something about you using the
@@ -96,6 +101,5 @@
</td>
</tr>
</table>
- </form>
-</body>
-</html>
+<% } %>
+</asp:Content>
diff --git a/samples/RelyingPartyPortal/PrivacyPolicy.aspx b/samples/RelyingPartyPortal/PrivacyPolicy.aspx
index 10e4a0f..3bc12fe 100644
--- a/samples/RelyingPartyPortal/PrivacyPolicy.aspx
+++ b/samples/RelyingPartyPortal/PrivacyPolicy.aspx
@@ -1,15 +1,7 @@
-<%@ Page Language="C#" AutoEventWireup="true" %>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head runat="server">
- <title>Privacy Policy</title>
-</head>
-<body>
- <form id="form1" runat="server">
+<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.Master" %>
+<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main">
+ <h2>Privacy Policy</h2>
<p>
Some privacy policy would go here.
</p>
- </form>
-</body>
-</html>
+</asp:Content> \ No newline at end of file
diff --git a/samples/RelyingPartyPortal/RelyingPartyPortal.csproj b/samples/RelyingPartyPortal/RelyingPartyPortal.csproj
index 925c633..99f36f9 100644
--- a/samples/RelyingPartyPortal/RelyingPartyPortal.csproj
+++ b/samples/RelyingPartyPortal/RelyingPartyPortal.csproj
@@ -2,7 +2,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.21022</ProductVersion>
+ <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{51BCD5E9-E17A-4FB2-BAC8-C156DD7A1CA4}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
@@ -17,7 +17,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -30,6 +30,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\log4net.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
@@ -50,7 +54,25 @@
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="ajaxlogin.aspx.cs">
+ <DependentUpon>ajaxlogin.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="ajaxlogin.aspx.designer.cs">
+ <DependentUpon>ajaxlogin.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Code\CustomStore.cs" />
+ <Compile Include="Code\CustomStoreDataSet.cs">
+ <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
+ <SubType>Component</SubType>
+ </Compile>
+ <Compile Include="Code\CustomStoreDataSet.Designer.cs">
+ <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ </Compile>
<Compile Include="Code\State.cs" />
+ <Compile Include="Code\TracePageAppender.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
@@ -61,6 +83,13 @@
<Compile Include="login.aspx.designer.cs">
<DependentUpon>login.aspx</DependentUpon>
</Compile>
+ <Compile Include="loginProgrammatic.aspx.cs">
+ <DependentUpon>loginProgrammatic.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="loginProgrammatic.aspx.designer.cs">
+ <DependentUpon>loginProgrammatic.aspx</DependentUpon>
+ </Compile>
<Compile Include="m\Login.aspx.cs">
<DependentUpon>Login.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@@ -69,6 +98,13 @@
<DependentUpon>Login.aspx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="TracePage.aspx.cs">
+ <DependentUpon>TracePage.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="TracePage.aspx.designer.cs">
+ <DependentUpon>TracePage.aspx</DependentUpon>
+ </Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\DotNetOpenId\DotNetOpenId.csproj">
@@ -81,9 +117,32 @@
<Content Include="xrds.aspx" />
</ItemGroup>
<ItemGroup>
+ <Content Include="images\dotnetopenid_tiny.gif" />
+ <Content Include="loginProgrammatic.aspx" />
<Content Include="MembersOnly\Default.aspx" />
<Content Include="MembersOnly\Web.config" />
<Content Include="m\Login.aspx" />
+ <Content Include="styles.css" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="ajaxlogin.aspx" />
+ <EmbeddedResource Include="images\attention.png" />
+ <Content Include="images\openid_login.gif" />
+ <Content Include="Site.Master" />
+ <Content Include="TracePage.aspx" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Code\CustomStoreDataSet.xsc">
+ <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
+ </None>
+ <None Include="Code\CustomStoreDataSet.xsd">
+ <Generator>MSDataSetGenerator</Generator>
+ <LastGenOutput>CustomStoreDataSet.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </None>
+ <None Include="Code\CustomStoreDataSet.xss">
+ <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
+ </None>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
@@ -105,6 +164,9 @@
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
+ <UseCustomServer>False</UseCustomServer>
+ <CustomServerUrl>
+ </CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
diff --git a/samples/RelyingPartyPortal/Site.Master b/samples/RelyingPartyPortal/Site.Master
new file mode 100644
index 0000000..bbb7bc3
--- /dev/null
+++ b/samples/RelyingPartyPortal/Site.Master
@@ -0,0 +1,39 @@
+<%@ 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>
+ <link href="styles.css" rel="stylesheet" type="text/css" />
+ <asp:ContentPlaceHolder ID="head" runat="server" />
+</head>
+<body>
+ <form id="form1" runat="server">
+ <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>
+ </form>
+</body>
+</html>
diff --git a/samples/RelyingPartyPortal/TracePage.aspx b/samples/RelyingPartyPortal/TracePage.aspx
new file mode 100644
index 0000000..f9d9a56
--- /dev/null
+++ b/samples/RelyingPartyPortal/TracePage.aspx
@@ -0,0 +1,16 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TracePage.aspx.cs" Inherits="ConsumerPortal.TracePage" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head runat="server">
+ <title></title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <p align="right">
+ <asp:Button runat="server" Text="Clear log" ID="clearLogButton" OnClick="clearLogButton_Click" />
+ </p>
+ <pre><asp:PlaceHolder runat="server" ID="placeHolder1" /></pre>
+ </form>
+</body>
+</html>
diff --git a/samples/RelyingPartyPortal/TracePage.aspx.cs b/samples/RelyingPartyPortal/TracePage.aspx.cs
new file mode 100644
index 0000000..0f5b36a
--- /dev/null
+++ b/samples/RelyingPartyPortal/TracePage.aspx.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace ConsumerPortal {
+ public partial class TracePage : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ placeHolder1.Controls.Add(new Label { Text = Global.LogMessages.ToString() });
+ }
+
+ protected void clearLogButton_Click(object sender, EventArgs e) {
+ Global.LogMessages.Length = 0;
+ // clear the page immediately, and allow for F5 without a Postback warning.
+ Response.Redirect(Request.Url.AbsoluteUri);
+ }
+ }
+}
diff --git a/samples/RelyingPartyPortal/TracePage.aspx.designer.cs b/samples/RelyingPartyPortal/TracePage.aspx.designer.cs
new file mode 100644
index 0000000..8a2ec37
--- /dev/null
+++ b/samples/RelyingPartyPortal/TracePage.aspx.designer.cs
@@ -0,0 +1,43 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3053
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ConsumerPortal {
+
+
+ public partial class TracePage {
+
+ /// <summary>
+ /// form1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ /// <summary>
+ /// clearLogButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button clearLogButton;
+
+ /// <summary>
+ /// placeHolder1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.PlaceHolder placeHolder1;
+ }
+}
diff --git a/samples/RelyingPartyPortal/Web.config b/samples/RelyingPartyPortal/Web.config
index 551cb53..a601644 100644
--- a/samples/RelyingPartyPortal/Web.config
+++ b/samples/RelyingPartyPortal/Web.config
@@ -1,5 +1,37 @@
<?xml version="1.0"?>
<configuration>
+ <configSections>
+ <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false" />
+ <sectionGroup name="dotNetOpenId">
+ <section name="relyingParty" type="DotNetOpenId.Configuration.RelyingPartySection" requirePermission="false" allowLocation="true"/>
+ <section name="provider" type="DotNetOpenId.Configuration.ProviderSection" requirePermission="false" allowLocation="true"/>
+ <section name="untrustedWebRequest" type="DotNetOpenId.Configuration.UntrustedWebRequestSection" requirePermission="false" allowLocation="false"/>
+ </sectionGroup>
+ </configSections>
+
+ <!-- this is an optional configuration section where aspects of dotnetopenid can be customized -->
+ <dotNetOpenId>
+ <relyingParty>
+ <security requireSsl="false" />
+ <!-- Uncomment the following to activate the sample custom store. -->
+ <!--<store type="ConsumerPortal.Code.CustomStore, ConsumerPortal" />-->
+ </relyingParty>
+ <untrustedWebRequest>
+ <whitelistHosts>
+ <!-- since this is a sample, and will often be used with localhost -->
+ <add name="localhost" />
+ </whitelistHosts>
+ </untrustedWebRequest>
+ </dotNetOpenId>
+
+ <!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names),
+ which is necessary for OpenID urls with unicode characters in the domain/host name. -->
+ <uri>
+ <idn enabled="All" />
+ <iriParsing enabled="true" />
+ </uri>
+
<system.web>
<!--<sessionState cookieless="true" />-->
<compilation debug="true"/>
@@ -13,17 +45,37 @@
High: TRACE compilation symbol must NOT be defined
Medium/Low: doesn't work on default machine.config, because WebPermission.Connect is denied.
-->
- <trust level="Full" originUrl=""/>
+ <trust level="High" originUrl=""/>
</system.web>
- <system.diagnostics>
- <switches>
- <add name="OpenID" value="4"/>
- </switches>
- <trace autoflush="true" indentsize="4">
- <listeners>
- <add name="fileLogger" type="System.Diagnostics.TextWriterTraceListener"
- initializeData="openidConsumerTrace.txt" traceOutputOptions="None"/>
- </listeners>
- </trace>
- </system.diagnostics>
+
+ <!-- log4net is a 3rd party (free) logger library that dotnetopenid will use if present but does not require. -->
+ <log4net>
+ <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
+ <file value="RelyingParty.log" />
+ <appendToFile value="true" />
+ <rollingStyle value="Size" />
+ <maxSizeRollBackups value="10" />
+ <maximumFileSize value="100KB" />
+ <staticLogFileName value="true" />
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date (GMT%date{%z}) [%thread] %-5level %logger - %message%newline" />
+ </layout>
+ </appender>
+ <appender name="TracePageAppender" type="ConsumerPortal.Code.TracePageAppender, ConsumerPortal">
+ <layout type="log4net.Layout.PatternLayout">
+ <conversionPattern value="%date (GMT%date{%z}) [%thread] %-5level %logger - %message%newline" />
+ </layout>
+ </appender>
+ <!-- Setup the root category, add the appenders and set the default level -->
+ <root>
+ <level value="INFO" />
+ <!--<appender-ref ref="RollingFileAppender" />-->
+ <appender-ref ref="TracePageAppender" />
+ </root>
+ <!-- Specify the level for some specific categories -->
+ <logger name="DotNetOpenId">
+ <level value="ALL" />
+ </logger>
+ </log4net>
+
</configuration>
diff --git a/samples/RelyingPartyPortal/ajaxlogin.aspx b/samples/RelyingPartyPortal/ajaxlogin.aspx
new file mode 100644
index 0000000..27064f2
--- /dev/null
+++ b/samples/RelyingPartyPortal/ajaxlogin.aspx
@@ -0,0 +1,91 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ajaxlogin.aspx.cs" Inherits="ConsumerPortal.ajaxlogin"
+ ValidateRequest="false" MasterPageFile="~/Site.Master" %>
+
+<%@ Register Assembly="DotNetOpenId" Namespace="DotNetOpenId.RelyingParty" TagPrefix="openid" %>
+<asp:Content runat="server" ContentPlaceHolderID="head">
+<style type="text/css">
+.textbox
+{
+ width: 200px;
+}
+.openidtextbox
+{
+ width: 185px;
+}
+td
+{
+ vertical-align: top;
+}
+</style>
+</asp:Content>
+
+<asp:Content runat="server" ContentPlaceHolderID="Main">
+<script type="text/javascript">
+ function onauthenticated(sender) {
+ var emailBox = document.getElementById('<%= emailAddressBox.ClientID %>');
+ emailBox.disabled = false;
+ emailBox.title = null; // remove tooltip describing why the box was disabled.
+ // the sreg response may not always be included.
+ if (sender.sreg) {
+ // and the email field may not always be included in the sreg response.
+ if (sender.sreg.email) { emailBox.value = sender.sreg.email; }
+ }
+ }
+</script>
+
+ <asp:MultiView runat="server" ID="multiView" ActiveViewIndex='0'>
+ <asp:View runat="server" ID="commentSubmission">
+ <table>
+ <tr>
+ <td>
+ OpenID
+ </td>
+ <td>
+ <openid:OpenIdAjaxTextBox ID="OpenIdAjaxTextBox1" runat="server" CssClass="openidtextbox"
+ OnLoggingIn="OpenIdAjaxTextBox1_LoggingIn"
+ OnLoggedIn="OpenIdAjaxTextBox1_LoggedIn"
+ OnClientAssertionReceived="onauthenticated(sender)"
+ OnUnconfirmedPositiveAssertion="OpenIdAjaxTextBox1_UnconfirmedPositiveAssertion" />
+ <asp:RequiredFieldValidator ID="openidRequiredValidator" runat="server"
+ ControlToValidate="OpenIdAjaxTextBox1" ValidationGroup="openidVG"
+ ErrorMessage="The OpenID field is required." SetFocusOnError="True">
+ <asp:Image runat="server" ImageUrl="~/images/attention.png" ToolTip="This is a required field" />
+ </asp:RequiredFieldValidator>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Email
+ </td>
+ <td>
+ <asp:TextBox runat="server" ID="emailAddressBox" Enabled="false" CssClass="textbox" ToolTip="This field will be enabled after you log in with your OpenID." />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Comments
+ </td>
+ <td>
+ <asp:TextBox runat="server" ID="commentsBox" TextMode="MultiLine" Rows="5" CssClass="textbox" />
+ </td>
+ </tr>
+ <tr>
+ <td />
+ <td>
+ <asp:Button runat="server" Text="Submit" ID="submitButton" OnClick="submitButton_Click" />
+ </td>
+ </tr>
+ </table>
+ </asp:View>
+ <asp:View runat="server" ID="commentSubmitted">
+ <p>Congratulations,
+ <asp:Label runat="server" ID="emailLabel" />! Your comment was received (and discarded...
+ this is just a demo after all).</p>
+ <asp:LinkButton runat="server" Text="Go back and change something in the comment"
+ OnClick="editComment_Click" />
+ </asp:View>
+ <asp:View runat="server" ID="commentFailed">
+ <p>Your comment submission failed.</p>
+ </asp:View>
+ </asp:MultiView>
+</asp:Content>
diff --git a/samples/RelyingPartyPortal/ajaxlogin.aspx.cs b/samples/RelyingPartyPortal/ajaxlogin.aspx.cs
new file mode 100644
index 0000000..6fac846
--- /dev/null
+++ b/samples/RelyingPartyPortal/ajaxlogin.aspx.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Web.UI.WebControls;
+using DotNetOpenId.Extensions.SimpleRegistration;
+using DotNetOpenId.RelyingParty;
+
+namespace ConsumerPortal {
+ public partial class ajaxlogin : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ if (!IsPostBack) {
+ OpenIdAjaxTextBox1.Focus();
+ }
+ }
+
+ protected void OpenIdAjaxTextBox1_LoggingIn(object sender, OpenIdEventArgs e) {
+ e.Request.AddExtension(new ClaimsRequest {
+ Email = DemandLevel.Request,
+ });
+ }
+
+ protected void OpenIdAjaxTextBox1_LoggedIn(object sender, OpenIdEventArgs e) {
+ Label label = ((Label)commentSubmitted.FindControl("emailLabel"));
+ label.Text = e.Response.FriendlyIdentifierForDisplay;
+
+ // We COULD get the sreg extension response here for the email, but since we let the user
+ // potentially change the email in the HTML form, we'll use that instead.
+ //var claims = OpenIdAjaxTextBox1.AuthenticationResponse.GetExtension<ClaimsResponse>();
+ if (emailAddressBox.Text.Length > 0) {
+ label.Text += " (" + emailAddressBox.Text + ")";
+ }
+ }
+
+ protected void submitButton_Click(object sender, EventArgs e) {
+ if (!Page.IsValid) return;
+ if (OpenIdAjaxTextBox1.AuthenticationResponse != null) {
+ if (OpenIdAjaxTextBox1.AuthenticationResponse.Status == AuthenticationStatus.Authenticated) {
+ // Save comment here!
+ multiView.ActiveViewIndex = 1;
+ } else {
+ multiView.ActiveViewIndex = 2;
+ }
+ }
+ }
+
+ protected void editComment_Click(object sender, EventArgs e) {
+ multiView.ActiveViewIndex = 0;
+ }
+
+ protected void OpenIdAjaxTextBox1_UnconfirmedPositiveAssertion(object sender, OpenIdEventArgs e) {
+ // This is where we register extensions that we want to have available in javascript
+ // on the browser.
+ OpenIdAjaxTextBox1.RegisterClientScriptExtension<ClaimsResponse>("sreg");
+ }
+ }
+}
diff --git a/samples/RelyingPartyPortal/ajaxlogin.aspx.designer.cs b/samples/RelyingPartyPortal/ajaxlogin.aspx.designer.cs
new file mode 100644
index 0000000..7b6ddf0
--- /dev/null
+++ b/samples/RelyingPartyPortal/ajaxlogin.aspx.designer.cs
@@ -0,0 +1,106 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3053
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ConsumerPortal {
+
+
+ public partial class ajaxlogin {
+
+ /// <summary>
+ /// multiView control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.MultiView multiView;
+
+ /// <summary>
+ /// commentSubmission control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.View commentSubmission;
+
+ /// <summary>
+ /// OpenIdAjaxTextBox1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::DotNetOpenId.RelyingParty.OpenIdAjaxTextBox OpenIdAjaxTextBox1;
+
+ /// <summary>
+ /// openidRequiredValidator control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.RequiredFieldValidator openidRequiredValidator;
+
+ /// <summary>
+ /// emailAddressBox control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.TextBox emailAddressBox;
+
+ /// <summary>
+ /// commentsBox control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.TextBox commentsBox;
+
+ /// <summary>
+ /// submitButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button submitButton;
+
+ /// <summary>
+ /// commentSubmitted control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.View commentSubmitted;
+
+ /// <summary>
+ /// emailLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label emailLabel;
+
+ /// <summary>
+ /// commentFailed control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.View commentFailed;
+ }
+}
diff --git a/samples/RelyingPartyPortal/images/attention.png b/samples/RelyingPartyPortal/images/attention.png
new file mode 100644
index 0000000..8003700
--- /dev/null
+++ b/samples/RelyingPartyPortal/images/attention.png
Binary files differ
diff --git a/samples/RelyingPartyPortal/images/dotnetopenid_tiny.gif b/samples/RelyingPartyPortal/images/dotnetopenid_tiny.gif
new file mode 100644
index 0000000..c4ed4f5
--- /dev/null
+++ b/samples/RelyingPartyPortal/images/dotnetopenid_tiny.gif
Binary files differ
diff --git a/samples/RelyingPartyPortal/images/openid_login.gif b/samples/RelyingPartyPortal/images/openid_login.gif
new file mode 100644
index 0000000..cde836c
--- /dev/null
+++ b/samples/RelyingPartyPortal/images/openid_login.gif
Binary files differ
diff --git a/samples/RelyingPartyPortal/login.aspx b/samples/RelyingPartyPortal/login.aspx
index 8fbf6e5..ba1579a 100644
--- a/samples/RelyingPartyPortal/login.aspx
+++ b/samples/RelyingPartyPortal/login.aspx
@@ -1,28 +1,32 @@
-<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="login.aspx.cs" Inherits="login" ValidateRequest="false" %>
+<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="login.aspx.cs" Inherits="login"
+ ValidateRequest="false" MasterPageFile="~/Site.Master" %>
<%@ Register Assembly="DotNetOpenId" Namespace="DotNetOpenId.RelyingParty" TagPrefix="cc1" %>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title>Login</title>
-</head>
-<body>
- <form id="Form1" runat="server">
- <h2>
- Login Page </h2>
+<asp:Content runat="server" ContentPlaceHolderID="Main">
+ <h2>Login Page </h2>
<cc1:OpenIdLogin ID="OpenIdLogin1" runat="server" CssClass="openid_login" RequestCountry="Request"
RequestEmail="Request" RequestGender="Require" RequestPostalCode="Require" RequestTimeZone="Require"
- RememberMeVisible="True" PolicyUrl="~/PrivacyPolicy.aspx" TabIndex="1" OnLoggedIn="OpenIdLogin1_LoggedIn"
+ RememberMeVisible="True" PolicyUrl="~/PrivacyPolicy.aspx" TabIndex="1"
+ OnLoggedIn="OpenIdLogin1_LoggedIn" OnLoggingIn="OpenIdLogin1_LoggingIn"
OnCanceled="OpenIdLogin1_Canceled" OnFailed="OpenIdLogin1_Failed" OnSetupRequired="OpenIdLogin1_SetupRequired" />
- <asp:CheckBox ID="immediateCheckBox" runat="server" Text="Immediate mode" />
+ <fieldset title="Knobs">
+ <asp:CheckBox ID="requireSslCheckBox" runat="server"
+ Text="RequireSsl (high security) mode"
+ oncheckedchanged="requireSslCheckBox_CheckedChanged" /><br />
+ <asp:CheckBox ID="immediateCheckBox" runat="server" Text="Immediate mode" /><br />
+ <asp:CheckBoxList runat="server" ID="papePolicies">
+ <asp:ListItem Text="Request phishing resistant authentication" Value="http://schemas.openid.net/pape/policies/2007/06/phishing-resistant" />
+ <asp:ListItem Text="Request multi-factor authentication" Value="http://schemas.openid.net/pape/policies/2007/06/multi-factor" />
+ <asp:ListItem Text="Request physical multi-factor authentication" Value="http://schemas.openid.net/pape/policies/2007/06/multi-factor-physical" />
+ </asp:CheckBoxList>
+ </fieldset>
<br />
<asp:Label ID="loginFailedLabel" runat="server" EnableViewState="False" Text="Login failed"
Visible="False" />
<asp:Label ID="loginCanceledLabel" runat="server" EnableViewState="False" Text="Login canceled"
Visible="False" />
<p>
- <asp:ImageButton runat="server" ImageUrl="~/images/yahoo.png" ID="yahooLoginButton" OnClick="yahooLoginButton_Click" />
+ <asp:ImageButton runat="server" ImageUrl="~/images/yahoo.png" ID="yahooLoginButton"
+ OnClick="yahooLoginButton_Click" />
</p>
- </form>
-</body>
-</html>
+</asp:Content>
diff --git a/samples/RelyingPartyPortal/login.aspx.cs b/samples/RelyingPartyPortal/login.aspx.cs
index a3c062d..a987a4c 100644
--- a/samples/RelyingPartyPortal/login.aspx.cs
+++ b/samples/RelyingPartyPortal/login.aspx.cs
@@ -1,11 +1,22 @@
using System;
+using System.Collections.Generic;
using System.Web.UI;
+using System.Web.UI.WebControls;
+using DotNetOpenId.Extensions.ProviderAuthenticationPolicy;
+using DotNetOpenId.Extensions.SimpleRegistration;
using DotNetOpenId.RelyingParty;
public partial class login : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
OpenIdLogin1.Focus();
- OpenIdLogin1.ImmediateMode = immediateCheckBox.Checked;
+ }
+
+ protected void requireSslCheckBox_CheckedChanged(object sender, EventArgs e) {
+ this.OpenIdLogin1.RequireSsl = this.requireSslCheckBox.Checked;
+ }
+
+ protected void OpenIdLogin1_LoggingIn(object sender, OpenIdEventArgs e) {
+ prepareRequest(e.Request);
}
/// <summary>
@@ -13,7 +24,9 @@ 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>();
+ State.PapePolicies = e.Response.GetExtension<PolicyResponse>();
}
protected void OpenIdLogin1_Failed(object sender, OpenIdEventArgs e) {
loginFailedLabel.Visible = true;
@@ -30,8 +43,32 @@ public partial class login : System.Web.UI.Page {
protected void yahooLoginButton_Click(object sender, ImageClickEventArgs e) {
OpenIdRelyingParty openid = new OpenIdRelyingParty();
var req = openid.CreateRequest("yahoo.com");
+ prepareRequest(req);
req.RedirectToProvider();
// We don't listen for the response from the provider explicitly
// because the OpenIdLogin control is already doing that for us.
}
+
+ private void prepareRequest(IAuthenticationRequest request) {
+ // Setup is the default for the login control. But the user may have checked the box to override that.
+ request.Mode = immediateCheckBox.Checked ? AuthenticationRequestMode.Immediate : AuthenticationRequestMode.Setup;
+
+ // Collect the PAPE policies requested by the user.
+ List<string> policies = new List<string>();
+ foreach (ListItem item in papePolicies.Items) {
+ if (item.Selected) {
+ policies.Add(item.Value);
+ }
+ }
+
+ // Add the PAPE extension if any policy was requested.
+ if (policies.Count > 0) {
+ var pape = new PolicyRequest();
+ foreach (string policy in policies) {
+ pape.PreferredPolicies.Add(policy);
+ }
+
+ request.AddExtension(pape);
+ }
+ }
}
diff --git a/samples/RelyingPartyPortal/login.aspx.designer.cs b/samples/RelyingPartyPortal/login.aspx.designer.cs
index 3220bfa..8c888ca 100644
--- a/samples/RelyingPartyPortal/login.aspx.designer.cs
+++ b/samples/RelyingPartyPortal/login.aspx.designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
-// Runtime Version:2.0.50727.1434
+// Runtime Version:2.0.50727.3521
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -13,22 +13,22 @@
public partial class login {
/// <summary>
- /// Form1 control.
+ /// OpenIdLogin1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
- protected global::System.Web.UI.HtmlControls.HtmlForm Form1;
+ protected global::DotNetOpenId.RelyingParty.OpenIdLogin OpenIdLogin1;
/// <summary>
- /// OpenIdLogin1 control.
+ /// requireSslCheckBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
- protected global::DotNetOpenId.RelyingParty.OpenIdLogin OpenIdLogin1;
+ protected global::System.Web.UI.WebControls.CheckBox requireSslCheckBox;
/// <summary>
/// immediateCheckBox control.
@@ -40,6 +40,15 @@ public partial class login {
protected global::System.Web.UI.WebControls.CheckBox immediateCheckBox;
/// <summary>
+ /// papePolicies control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.CheckBoxList papePolicies;
+
+ /// <summary>
/// loginFailedLabel control.
/// </summary>
/// <remarks>
diff --git a/samples/RelyingPartyPortal/loginProgrammatic.aspx b/samples/RelyingPartyPortal/loginProgrammatic.aspx
new file mode 100644
index 0000000..c65edb1
--- /dev/null
+++ b/samples/RelyingPartyPortal/loginProgrammatic.aspx
@@ -0,0 +1,15 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="loginProgrammatic.aspx.cs"
+ Inherits="loginProgrammatic" MasterPageFile="~/Site.Master" %>
+<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main">
+ <h2>Login Page </h2>
+ <asp:Label ID="Label1" runat="server" Text="OpenID Login" />
+ <asp:TextBox ID="openIdBox" runat="server" />
+ <asp:Button ID="loginButton" runat="server" Text="Login" OnClick="loginButton_Click" />
+ <asp:CustomValidator runat="server" ID="openidValidator" ErrorMessage="Invalid OpenID Identifier"
+ ControlToValidate="openIdBox" EnableViewState="false" OnServerValidate="openidValidator_ServerValidate" />
+ <br />
+ <asp:Label ID="loginFailedLabel" runat="server" EnableViewState="False" Text="Login failed"
+ Visible="False" />
+ <asp:Label ID="loginCanceledLabel" runat="server" EnableViewState="False" Text="Login canceled"
+ Visible="False" />
+</asp:Content> \ No newline at end of file
diff --git a/samples/RelyingPartyPortal/loginProgrammatic.aspx.cs b/samples/RelyingPartyPortal/loginProgrammatic.aspx.cs
new file mode 100644
index 0000000..39a6f9b
--- /dev/null
+++ b/samples/RelyingPartyPortal/loginProgrammatic.aspx.cs
@@ -0,0 +1,96 @@
+using System;
+using System.Net;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using DotNetOpenId;
+using DotNetOpenId.RelyingParty;
+
+public partial class loginProgrammatic : System.Web.UI.Page {
+ protected void openidValidator_ServerValidate(object source, ServerValidateEventArgs args) {
+ // This catches common typos that result in an invalid OpenID Identifier.
+ args.IsValid = Identifier.IsValid(args.Value);
+ }
+
+ OpenIdRelyingParty createRelyingParty() {
+ OpenIdRelyingParty openid = new OpenIdRelyingParty();
+ int minsha, maxsha, minversion;
+ if (int.TryParse(Request.QueryString["minsha"], out minsha)) {
+ openid.Settings.MinimumHashBitLength = minsha;
+ }
+ if (int.TryParse(Request.QueryString["maxsha"], out maxsha)) {
+ openid.Settings.MaximumHashBitLength = maxsha;
+ }
+ if (int.TryParse(Request.QueryString["minversion"], out minversion)) {
+ switch (minversion) {
+ case 1: openid.Settings.MinimumRequiredOpenIdVersion = ProtocolVersion.V10; break;
+ case 2: openid.Settings.MinimumRequiredOpenIdVersion = ProtocolVersion.V20; break;
+ default: throw new ArgumentOutOfRangeException("minversion");
+ }
+ }
+ return openid;
+ }
+
+ protected void loginButton_Click(object sender, EventArgs e) {
+ if (!Page.IsValid) return; // don't login if custom validation failed.
+ OpenIdRelyingParty openid = createRelyingParty();
+ try {
+ IAuthenticationRequest request = openid.CreateRequest(openIdBox.Text);
+ // This is where you would add any OpenID extensions you wanted
+ // to include in the authentication request.
+ // request.AddExtension(someExtensionRequestInstance);
+
+ // Send your visitor to their Provider for authentication.
+ request.RedirectToProvider();
+ } catch (OpenIdException ex) {
+ // The user probably entered an Identifier that
+ // was not a valid OpenID endpoint.
+ openidValidator.Text = ex.Message;
+ openidValidator.IsValid = false;
+ } catch (WebException ex) {
+ // The user probably entered an Identifier that
+ // was not a valid OpenID endpoint.
+ openidValidator.Text = ex.Message;
+ openidValidator.IsValid = false;
+ }
+ }
+
+ protected void Page_Load(object sender, EventArgs e) {
+ openIdBox.Focus();
+ // For debugging/testing, we allow remote clearing of all associations...
+ // NOT a good idea on a production site.
+ if (Request.QueryString["clearAssociations"] == "1") {
+ Application.Remove("DotNetOpenId.RelyingParty.RelyingParty.AssociationStore");
+ // Force a redirect now to prevent the user from logging in while associations
+ // are constantly being cleared.
+ UriBuilder builder = new UriBuilder(Request.Url);
+ builder.Query = null;
+ Response.Redirect(builder.Uri.AbsoluteUri);
+ }
+
+ OpenIdRelyingParty openid = createRelyingParty();
+ if (openid.Response != null) {
+ switch (openid.Response.Status) {
+ case AuthenticationStatus.Authenticated:
+ // This is where you would look for any OpenID extension responses included
+ // in the authentication assertion.
+ // var extension = openid.Response.GetExtension<SomeExtensionResponseType>();
+
+ // Use FormsAuthentication to tell ASP.NET that the user is now logged in,
+ // with the OpenID Claimed Identifier as their username.
+ FormsAuthentication.RedirectFromLoginPage(openid.Response.ClaimedIdentifier, false);
+ break;
+ case AuthenticationStatus.Canceled:
+ loginCanceledLabel.Visible = true;
+ break;
+ case AuthenticationStatus.Failed:
+ loginFailedLabel.Visible = true;
+ break;
+ // We don't need to handle SetupRequired because we're not setting
+ // IAuthenticationRequest.Mode to immediate mode.
+ //case AuthenticationStatus.SetupRequired:
+ // break;
+ }
+ }
+ }
+}
diff --git a/samples/RelyingPartyPortal/loginProgrammatic.aspx.designer.cs b/samples/RelyingPartyPortal/loginProgrammatic.aspx.designer.cs
new file mode 100644
index 0000000..536a6d2
--- /dev/null
+++ b/samples/RelyingPartyPortal/loginProgrammatic.aspx.designer.cs
@@ -0,0 +1,68 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.1434
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+
+
+public partial class loginProgrammatic {
+
+ /// <summary>
+ /// Label1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label Label1;
+
+ /// <summary>
+ /// openIdBox control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.TextBox openIdBox;
+
+ /// <summary>
+ /// loginButton control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button loginButton;
+
+ /// <summary>
+ /// openidValidator control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.CustomValidator openidValidator;
+
+ /// <summary>
+ /// loginFailedLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label loginFailedLabel;
+
+ /// <summary>
+ /// loginCanceledLabel control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label loginCanceledLabel;
+}
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>
+
diff --git a/samples/RelyingPartyPortal/styles.css b/samples/RelyingPartyPortal/styles.css
new file mode 100644
index 0000000..62605db
--- /dev/null
+++ b/samples/RelyingPartyPortal/styles.css
@@ -0,0 +1,10 @@
+h2
+{
+ font-style: italic;
+}
+
+body
+{
+ font-family: Cambria, Arial, Times New Roman;
+ font-size: 12pt;
+} \ No newline at end of file
diff --git a/samples/RelyingPartyPortal/xrds.aspx b/samples/RelyingPartyPortal/xrds.aspx
index 266240c..e79fd8c 100644
--- a/samples/RelyingPartyPortal/xrds.aspx
+++ b/samples/RelyingPartyPortal/xrds.aspx
@@ -15,6 +15,8 @@ is default.aspx.
<Type>http://specs.openid.net/auth/2.0/return_to</Type>
<%-- Every page with an OpenID login should be listed here. --%>
<URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/login.aspx"))%></URI>
+ <URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/loginProgrammatic.aspx"))%></URI>
+ <URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/ajaxlogin.aspx"))%></URI>
</Service>
</XRD>
</xrds:XRDS>