diff options
Diffstat (limited to 'src/OpenID/OpenIdProviderWebForms')
53 files changed, 4873 insertions, 0 deletions
diff --git a/src/OpenID/OpenIdProviderWebForms/.gitignore b/src/OpenID/OpenIdProviderWebForms/.gitignore new file mode 100644 index 0000000..b086a60 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/.gitignore @@ -0,0 +1,5 @@ +Bin +obj +*.user +*.log +StyleCop.Cache diff --git a/src/OpenID/OpenIdProviderWebForms/App_Data/.gitignore b/src/OpenID/OpenIdProviderWebForms/App_Data/.gitignore new file mode 100644 index 0000000..cb89d8a --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/App_Data/.gitignore @@ -0,0 +1 @@ +*.LDF diff --git a/src/OpenID/OpenIdProviderWebForms/App_Data/Users.xml b/src/OpenID/OpenIdProviderWebForms/App_Data/Users.xml new file mode 100644 index 0000000..cffe009 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/App_Data/Users.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8" ?> +<Users> + <User> + <UserName>bob</UserName> + <Password>test</Password> + </User> + <User> + <UserName>bob1</UserName> + <Password>test</Password> + </User> + <User> + <UserName>bob2</UserName> + <Password>test</Password> + </User> + <User> + <UserName>bob3</UserName> + <Password>test</Password> + </User> + <User> + <UserName>bob4</UserName> + <Password>test</Password> + </User> +</Users> diff --git a/src/OpenID/OpenIdProviderWebForms/Code/CustomStore.cs b/src/OpenID/OpenIdProviderWebForms/Code/CustomStore.cs new file mode 100644 index 0000000..3ff139f --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Code/CustomStore.cs @@ -0,0 +1,138 @@ +//----------------------------------------------------------------------- +// <copyright file="CustomStore.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace OpenIdProviderWebForms.Code { + using System; + using System.Collections.Generic; + using System.Data; + using System.Globalization; + using DotNetOpenAuth; + using DotNetOpenAuth.Configuration; + using DotNetOpenAuth.Messaging.Bindings; + using DotNetOpenAuth.OpenId; + + /// <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 : IOpenIdApplicationStore { + private static CustomStoreDataSet dataSet = new CustomStoreDataSet(); + + #region INonceStore Members + + /// <summary> + /// Stores a given nonce and timestamp. + /// </summary> + /// <param name="context">The context, or namespace, within which the + /// <paramref name="nonce"/> must be unique. + /// The context SHOULD be treated as case-sensitive. + /// The value will never be <c>null</c> but may be the empty string.</param> + /// <param name="nonce">A series of random characters.</param> + /// <param name="timestampUtc">The timestamp that together with the nonce string make it unique. + /// The timestamp may also be used by the data store to clear out old nonces.</param> + /// <returns> + /// True if the nonce+timestamp (combination) was not previously in the database. + /// False if the nonce was stored previously with the same timestamp. + /// </returns> + /// <remarks> + /// The nonce must be stored for no less than the maximum time window a message may + /// be processed within before being discarded as an expired message. + /// If the binding element is applicable to your channel, this expiration window + /// is retrieved or set using the + /// <see cref="StandardExpirationBindingElement.MaximumMessageAge"/> property. + /// </remarks> + public bool StoreNonce(string context, string nonce, DateTime timestampUtc) { + // 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.FindByIssuedUtcCodeContext(timestampUtc, nonce, context) != null) { + return false; + } + + TimeSpan maxMessageAge = DotNetOpenAuthSection.Messaging.MaximumMessageLifetime; + dataSet.Nonce.AddNonceRow(context, nonce, timestampUtc, timestampUtc + maxMessageAge); + return true; + } + } + + public void ClearExpiredNonces() { + this.removeExpiredRows(dataSet.Nonce, dataSet.Nonce.ExpiresUtcColumn.ColumnName); + } + + #endregion + + #region ICryptoKeyStore Members + + public CryptoKey GetKey(string bucket, string handle) { + var assocRow = dataSet.CryptoKey.FindByBucketHandle(bucket, handle); + return new CryptoKey(assocRow.Secret, assocRow.ExpiresUtc); + } + + public IEnumerable<KeyValuePair<string, CryptoKey>> GetKeys(string bucket) { + // properly escape the URL to prevent injection attacks. + string value = bucket.Replace("'", "''"); + string filter = string.Format( + CultureInfo.InvariantCulture, + "{0} = '{1}'", + dataSet.CryptoKey.BucketColumn.ColumnName, + value); + string sort = dataSet.CryptoKey.ExpiresUtcColumn.ColumnName + " DESC"; + DataView view = new DataView(dataSet.CryptoKey, filter, sort, DataViewRowState.CurrentRows); + if (view.Count == 0) { + yield break; + } + + foreach (CustomStoreDataSet.CryptoKeyRow row in view) { + yield return new KeyValuePair<string, CryptoKey>(row.Handle, new CryptoKey(row.Secret, row.ExpiresUtc)); + } + } + + public void StoreKey(string bucket, string handle, CryptoKey key) { + var cryptoKeyRow = dataSet.CryptoKey.NewCryptoKeyRow(); + cryptoKeyRow.Bucket = bucket; + cryptoKeyRow.Handle = handle; + cryptoKeyRow.ExpiresUtc = key.ExpiresUtc; + cryptoKeyRow.Secret = key.Key; + dataSet.CryptoKey.AddCryptoKeyRow(cryptoKeyRow); + } + + public void RemoveKey(string bucket, string handle) { + var row = dataSet.CryptoKey.FindByBucketHandle(bucket, handle); + if (row != null) { + dataSet.CryptoKey.RemoveCryptoKeyRow(row); + } + } + + #endregion + + internal void ClearExpiredSecrets() { + this.removeExpiredRows(dataSet.CryptoKey, dataSet.CryptoKey.ExpiresUtcColumn.ColumnName); + } + + private void removeExpiredRows(DataTable table, string expiredColumnName) { + string filter = string.Format(CultureInfo.InvariantCulture, "{0} < #{1}#", expiredColumnName, DateTime.UtcNow); + DataView view = new DataView(table, filter, null, DataViewRowState.CurrentRows); + for (int i = view.Count - 1; i >= 0; i--) { + view.Delete(i); + } + } + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/Code/CustomStoreDataSet.Designer.cs b/src/OpenID/OpenIdProviderWebForms/Code/CustomStoreDataSet.Designer.cs new file mode 100644 index 0000000..b2ca1fc --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Code/CustomStoreDataSet.Designer.cs @@ -0,0 +1,1113 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.17379 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +#pragma warning disable 1591 + +namespace OpenIdProviderWebForms.Code { + + + /// <summary> + ///Represents a strongly typed in-memory cache of data. + ///</summary> + [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 CryptoKeyDataTable tableCryptoKey; + + private NonceDataTable tableNonce; + + private global::System.Data.SchemaSerializationMode _schemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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["CryptoKey"] != null)) { + base.Tables.Add(new CryptoKeyDataTable(ds.Tables["CryptoKey"])); + } + 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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + [global::System.ComponentModel.DesignerSerializationVisibility(global::System.ComponentModel.DesignerSerializationVisibility.Content)] + public CryptoKeyDataTable CryptoKey { + get { + return this.tableCryptoKey; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [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.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.DesignerSerializationVisibilityAttribute(global::System.ComponentModel.DesignerSerializationVisibility.Hidden)] + public new global::System.Data.DataRelationCollection Relations { + get { + return base.Relations; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void InitializeDerivedDataSet() { + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public override global::System.Data.DataSet Clone() { + CustomStoreDataSet cln = ((CustomStoreDataSet)(base.Clone())); + cln.InitVars(); + cln.SchemaSerializationMode = this.SchemaSerializationMode; + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override bool ShouldSerializeTables() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override bool ShouldSerializeRelations() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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["CryptoKey"] != null)) { + base.Tables.Add(new CryptoKeyDataTable(ds.Tables["CryptoKey"])); + } + 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()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal void InitVars() { + this.InitVars(true); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal void InitVars(bool initTable) { + this.tableCryptoKey = ((CryptoKeyDataTable)(base.Tables["CryptoKey"])); + if ((initTable == true)) { + if ((this.tableCryptoKey != null)) { + this.tableCryptoKey.InitVars(); + } + } + this.tableNonce = ((NonceDataTable)(base.Tables["Nonce"])); + if ((initTable == true)) { + if ((this.tableNonce != null)) { + this.tableNonce.InitVars(); + } + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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.tableCryptoKey = new CryptoKeyDataTable(); + base.Tables.Add(this.tableCryptoKey); + this.tableNonce = new NonceDataTable(); + base.Tables.Add(this.tableNonce); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private bool ShouldSerializeCryptoKey() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private bool ShouldSerializeNonce() { + return false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void SchemaChanged(object sender, global::System.ComponentModel.CollectionChangeEventArgs e) { + if ((e.Action == global::System.ComponentModel.CollectionChangeAction.Remove)) { + this.InitVars(); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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; + } + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public delegate void CryptoKeyRowChangeEventHandler(object sender, CryptoKeyRowChangeEvent e); + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public delegate void NonceRowChangeEventHandler(object sender, NonceRowChangeEvent e); + + /// <summary> + ///Represents the strongly named DataTable class. + ///</summary> + [global::System.Serializable()] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] + public partial class CryptoKeyDataTable : global::System.Data.TypedTableBase<CryptoKeyRow> { + + private global::System.Data.DataColumn columnBucket; + + private global::System.Data.DataColumn columnHandle; + + private global::System.Data.DataColumn columnExpiresUtc; + + private global::System.Data.DataColumn columnSecret; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public CryptoKeyDataTable() { + this.TableName = "CryptoKey"; + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal CryptoKeyDataTable(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()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected CryptoKeyDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context) { + this.InitVars(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn BucketColumn { + get { + return this.columnBucket; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn HandleColumn { + get { + return this.columnHandle; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn ExpiresUtcColumn { + get { + return this.columnExpiresUtc; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn SecretColumn { + get { + return this.columnSecret; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + public int Count { + get { + return this.Rows.Count; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public CryptoKeyRow this[int index] { + get { + return ((CryptoKeyRow)(this.Rows[index])); + } + } + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event CryptoKeyRowChangeEventHandler CryptoKeyRowChanging; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event CryptoKeyRowChangeEventHandler CryptoKeyRowChanged; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event CryptoKeyRowChangeEventHandler CryptoKeyRowDeleting; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event CryptoKeyRowChangeEventHandler CryptoKeyRowDeleted; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void AddCryptoKeyRow(CryptoKeyRow row) { + this.Rows.Add(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public CryptoKeyRow AddCryptoKeyRow(string Bucket, string Handle, System.DateTime ExpiresUtc, byte[] Secret) { + CryptoKeyRow rowCryptoKeyRow = ((CryptoKeyRow)(this.NewRow())); + object[] columnValuesArray = new object[] { + Bucket, + Handle, + ExpiresUtc, + Secret}; + rowCryptoKeyRow.ItemArray = columnValuesArray; + this.Rows.Add(rowCryptoKeyRow); + return rowCryptoKeyRow; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public CryptoKeyRow FindByBucketHandle(string Bucket, string Handle) { + return ((CryptoKeyRow)(this.Rows.Find(new object[] { + Bucket, + Handle}))); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public override global::System.Data.DataTable Clone() { + CryptoKeyDataTable cln = ((CryptoKeyDataTable)(base.Clone())); + cln.InitVars(); + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataTable CreateInstance() { + return new CryptoKeyDataTable(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal void InitVars() { + this.columnBucket = base.Columns["Bucket"]; + this.columnHandle = base.Columns["Handle"]; + this.columnExpiresUtc = base.Columns["ExpiresUtc"]; + this.columnSecret = base.Columns["Secret"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitClass() { + this.columnBucket = new global::System.Data.DataColumn("Bucket", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnBucket); + this.columnHandle = new global::System.Data.DataColumn("Handle", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnHandle); + this.columnExpiresUtc = new global::System.Data.DataColumn("ExpiresUtc", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnExpiresUtc); + this.columnSecret = new global::System.Data.DataColumn("Secret", typeof(byte[]), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnSecret); + this.Constraints.Add(new global::System.Data.UniqueConstraint("PrimaryKey", new global::System.Data.DataColumn[] { + this.columnBucket, + this.columnHandle}, true)); + this.columnBucket.AllowDBNull = false; + this.columnBucket.ReadOnly = true; + this.columnHandle.AllowDBNull = false; + this.columnHandle.ReadOnly = true; + this.columnExpiresUtc.AllowDBNull = false; + this.columnExpiresUtc.DateTimeMode = global::System.Data.DataSetDateTime.Utc; + this.columnSecret.AllowDBNull = false; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public CryptoKeyRow NewCryptoKeyRow() { + return ((CryptoKeyRow)(this.NewRow())); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { + return new CryptoKeyRow(builder); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Type GetRowType() { + return typeof(CryptoKeyRow); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowChanged(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanged(e); + if ((this.CryptoKeyRowChanged != null)) { + this.CryptoKeyRowChanged(this, new CryptoKeyRowChangeEvent(((CryptoKeyRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowChanging(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowChanging(e); + if ((this.CryptoKeyRowChanging != null)) { + this.CryptoKeyRowChanging(this, new CryptoKeyRowChangeEvent(((CryptoKeyRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowDeleted(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleted(e); + if ((this.CryptoKeyRowDeleted != null)) { + this.CryptoKeyRowDeleted(this, new CryptoKeyRowChangeEvent(((CryptoKeyRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override void OnRowDeleting(global::System.Data.DataRowChangeEventArgs e) { + base.OnRowDeleting(e); + if ((this.CryptoKeyRowDeleting != null)) { + this.CryptoKeyRowDeleting(this, new CryptoKeyRowChangeEvent(((CryptoKeyRow)(e.Row)), e.Action)); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void RemoveCryptoKeyRow(CryptoKeyRow row) { + this.Rows.Remove(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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 = "CryptoKeyDataTable"; + 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.Serializable()] + [global::System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")] + public partial class NonceDataTable : global::System.Data.TypedTableBase<NonceRow> { + + private global::System.Data.DataColumn columnContext; + + private global::System.Data.DataColumn columnCode; + + private global::System.Data.DataColumn columnIssuedUtc; + + private global::System.Data.DataColumn columnExpiresUtc; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public NonceDataTable() { + this.TableName = "Nonce"; + this.BeginInit(); + this.InitClass(); + this.EndInit(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected NonceDataTable(global::System.Runtime.Serialization.SerializationInfo info, global::System.Runtime.Serialization.StreamingContext context) : + base(info, context) { + this.InitVars(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn ContextColumn { + get { + return this.columnContext; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn CodeColumn { + get { + return this.columnCode; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn IssuedUtcColumn { + get { + return this.columnIssuedUtc; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataColumn ExpiresUtcColumn { + get { + return this.columnExpiresUtc; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + [global::System.ComponentModel.Browsable(false)] + public int Count { + get { + return this.Rows.Count; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public NonceRow this[int index] { + get { + return ((NonceRow)(this.Rows[index])); + } + } + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event NonceRowChangeEventHandler NonceRowChanging; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event NonceRowChangeEventHandler NonceRowChanged; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event NonceRowChangeEventHandler NonceRowDeleting; + + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public event NonceRowChangeEventHandler NonceRowDeleted; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void AddNonceRow(NonceRow row) { + this.Rows.Add(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public NonceRow AddNonceRow(string Context, string Code, System.DateTime IssuedUtc, System.DateTime ExpiresUtc) { + NonceRow rowNonceRow = ((NonceRow)(this.NewRow())); + object[] columnValuesArray = new object[] { + Context, + Code, + IssuedUtc, + ExpiresUtc}; + rowNonceRow.ItemArray = columnValuesArray; + this.Rows.Add(rowNonceRow); + return rowNonceRow; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public NonceRow FindByIssuedUtcCodeContext(System.DateTime IssuedUtc, string Code, string Context) { + return ((NonceRow)(this.Rows.Find(new object[] { + IssuedUtc, + Code, + Context}))); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public override global::System.Data.DataTable Clone() { + NonceDataTable cln = ((NonceDataTable)(base.Clone())); + cln.InitVars(); + return cln; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataTable CreateInstance() { + return new NonceDataTable(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal void InitVars() { + this.columnContext = base.Columns["Context"]; + this.columnCode = base.Columns["Code"]; + this.columnIssuedUtc = base.Columns["IssuedUtc"]; + this.columnExpiresUtc = base.Columns["ExpiresUtc"]; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + private void InitClass() { + this.columnContext = new global::System.Data.DataColumn("Context", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnContext); + this.columnCode = new global::System.Data.DataColumn("Code", typeof(string), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnCode); + this.columnIssuedUtc = new global::System.Data.DataColumn("IssuedUtc", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnIssuedUtc); + this.columnExpiresUtc = new global::System.Data.DataColumn("ExpiresUtc", typeof(global::System.DateTime), null, global::System.Data.MappingType.Element); + base.Columns.Add(this.columnExpiresUtc); + this.Constraints.Add(new global::System.Data.UniqueConstraint("Constraint1", new global::System.Data.DataColumn[] { + this.columnIssuedUtc, + this.columnCode, + this.columnContext}, true)); + this.columnContext.AllowDBNull = false; + this.columnCode.AllowDBNull = false; + this.columnIssuedUtc.AllowDBNull = false; + this.columnIssuedUtc.DateTimeMode = global::System.Data.DataSetDateTime.Utc; + this.columnExpiresUtc.AllowDBNull = false; + this.columnExpiresUtc.DateTimeMode = global::System.Data.DataSetDateTime.Utc; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public NonceRow NewNonceRow() { + return ((NonceRow)(this.NewRow())); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Data.DataRow NewRowFromBuilder(global::System.Data.DataRowBuilder builder) { + return new NonceRow(builder); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + protected override global::System.Type GetRowType() { + return typeof(NonceRow); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public void RemoveNonceRow(NonceRow row) { + this.Rows.Remove(row); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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> + public partial class CryptoKeyRow : global::System.Data.DataRow { + + private CryptoKeyDataTable tableCryptoKey; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal CryptoKeyRow(global::System.Data.DataRowBuilder rb) : + base(rb) { + this.tableCryptoKey = ((CryptoKeyDataTable)(this.Table)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public string Bucket { + get { + return ((string)(this[this.tableCryptoKey.BucketColumn])); + } + set { + this[this.tableCryptoKey.BucketColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public string Handle { + get { + return ((string)(this[this.tableCryptoKey.HandleColumn])); + } + set { + this[this.tableCryptoKey.HandleColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public System.DateTime ExpiresUtc { + get { + return ((global::System.DateTime)(this[this.tableCryptoKey.ExpiresUtcColumn])); + } + set { + this[this.tableCryptoKey.ExpiresUtcColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public byte[] Secret { + get { + return ((byte[])(this[this.tableCryptoKey.SecretColumn])); + } + set { + this[this.tableCryptoKey.SecretColumn] = value; + } + } + } + + /// <summary> + ///Represents strongly named DataRow class. + ///</summary> + public partial class NonceRow : global::System.Data.DataRow { + + private NonceDataTable tableNonce; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + internal NonceRow(global::System.Data.DataRowBuilder rb) : + base(rb) { + this.tableNonce = ((NonceDataTable)(this.Table)); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public string Context { + get { + return ((string)(this[this.tableNonce.ContextColumn])); + } + set { + this[this.tableNonce.ContextColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public string Code { + get { + return ((string)(this[this.tableNonce.CodeColumn])); + } + set { + this[this.tableNonce.CodeColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public System.DateTime IssuedUtc { + get { + return ((global::System.DateTime)(this[this.tableNonce.IssuedUtcColumn])); + } + set { + this[this.tableNonce.IssuedUtcColumn] = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public System.DateTime ExpiresUtc { + get { + return ((global::System.DateTime)(this[this.tableNonce.ExpiresUtcColumn])); + } + set { + this[this.tableNonce.ExpiresUtcColumn] = value; + } + } + } + + /// <summary> + ///Row event argument class + ///</summary> + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public class CryptoKeyRowChangeEvent : global::System.EventArgs { + + private CryptoKeyRow eventRow; + + private global::System.Data.DataRowAction eventAction; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public CryptoKeyRowChangeEvent(CryptoKeyRow row, global::System.Data.DataRowAction action) { + this.eventRow = row; + this.eventAction = action; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public CryptoKeyRow Row { + get { + return this.eventRow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + 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", "4.0.0.0")] + public class NonceRowChangeEvent : global::System.EventArgs { + + private NonceRow eventRow; + + private global::System.Data.DataRowAction eventAction; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public NonceRowChangeEvent(NonceRow row, global::System.Data.DataRowAction action) { + this.eventRow = row; + this.eventAction = action; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public NonceRow Row { + get { + return this.eventRow; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")] + public global::System.Data.DataRowAction Action { + get { + return this.eventAction; + } + } + } + } +} + +#pragma warning restore 1591
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/Code/CustomStoreDataSet.xsc b/src/OpenID/OpenIdProviderWebForms/Code/CustomStoreDataSet.xsc new file mode 100644 index 0000000..05b0199 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/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/src/OpenID/OpenIdProviderWebForms/Code/CustomStoreDataSet.xsd b/src/OpenID/OpenIdProviderWebForms/Code/CustomStoreDataSet.xsd new file mode 100644 index 0000000..cf3b62e --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Code/CustomStoreDataSet.xsd @@ -0,0 +1,49 @@ +<?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:EnableTableAdapterManager="true" msprop:Generator_DataSetName="CustomStoreDataSet" msprop:Generator_UserDSName="CustomStoreDataSet"> + <xs:complexType> + <xs:choice minOccurs="0" maxOccurs="unbounded"> + <xs:element name="CryptoKey" msprop:Generator_UserTableName="CryptoKey" msprop:Generator_RowEvArgName="CryptoKeyRowChangeEvent" msprop:Generator_TableVarName="tableCryptoKey" msprop:Generator_TablePropName="CryptoKey" msprop:Generator_RowDeletingName="CryptoKeyRowDeleting" msprop:Generator_RowChangingName="CryptoKeyRowChanging" msprop:Generator_RowDeletedName="CryptoKeyRowDeleted" msprop:Generator_RowEvHandlerName="CryptoKeyRowChangeEventHandler" msprop:Generator_RowChangedName="CryptoKeyRowChanged" msprop:Generator_TableClassName="CryptoKeyDataTable" msprop:Generator_RowClassName="CryptoKeyRow"> + <xs:complexType> + <xs:sequence> + <xs:element name="Bucket" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnBucket" msprop:Generator_ColumnPropNameInRow="Bucket" msprop:Generator_ColumnPropNameInTable="BucketColumn" msprop:Generator_UserColumnName="Bucket" type="xs:string" /> + <xs:element name="Handle" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnHandle" msprop:Generator_ColumnPropNameInRow="Handle" msprop:Generator_ColumnPropNameInTable="HandleColumn" msprop:Generator_UserColumnName="Handle" type="xs:string" /> + <xs:element name="ExpiresUtc" msdata:DateTimeMode="Utc" msprop:Generator_ColumnVarNameInTable="columnExpiresUtc" msprop:Generator_ColumnPropNameInRow="ExpiresUtc" msprop:Generator_ColumnPropNameInTable="ExpiresUtcColumn" msprop:Generator_UserColumnName="ExpiresUtc" type="xs:dateTime" /> + <xs:element name="Secret" msprop:Generator_ColumnVarNameInTable="columnSecret" msprop:Generator_ColumnPropNameInRow="Secret" msprop:Generator_ColumnPropNameInTable="SecretColumn" msprop:Generator_UserColumnName="Secret" type="xs:base64Binary" /> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="Nonce" msprop:Generator_UserTableName="Nonce" msprop:Generator_RowEvArgName="NonceRowChangeEvent" msprop:Generator_TableVarName="tableNonce" msprop:Generator_TablePropName="Nonce" msprop:Generator_RowDeletingName="NonceRowDeleting" msprop:Generator_RowChangingName="NonceRowChanging" msprop:Generator_RowDeletedName="NonceRowDeleted" msprop:Generator_RowEvHandlerName="NonceRowChangeEventHandler" msprop:Generator_RowChangedName="NonceRowChanged" msprop:Generator_TableClassName="NonceDataTable" msprop:Generator_RowClassName="NonceRow"> + <xs:complexType> + <xs:sequence> + <xs:element name="Context" msprop:Generator_ColumnVarNameInTable="columnContext" msprop:Generator_ColumnPropNameInRow="Context" msprop:Generator_ColumnPropNameInTable="ContextColumn" msprop:Generator_UserColumnName="Context" type="xs:string" /> + <xs:element name="Code" msprop:Generator_ColumnVarNameInTable="columnCode" msprop:Generator_ColumnPropNameInRow="Code" msprop:Generator_ColumnPropNameInTable="CodeColumn" msprop:Generator_UserColumnName="Code" type="xs:string" /> + <xs:element name="IssuedUtc" msdata:DateTimeMode="Utc" msprop:Generator_ColumnVarNameInTable="columnIssuedUtc" msprop:Generator_ColumnPropNameInRow="IssuedUtc" msprop:Generator_ColumnPropNameInTable="IssuedUtcColumn" msprop:Generator_UserColumnName="IssuedUtc" type="xs:dateTime" /> + <xs:element name="ExpiresUtc" msdata:DateTimeMode="Utc" msprop:Generator_ColumnVarNameInTable="columnExpiresUtc" msprop:Generator_ColumnPropNameInRow="ExpiresUtc" msprop:Generator_ColumnPropNameInTable="ExpiresUtcColumn" msprop:Generator_UserColumnName="ExpiresUtc" type="xs:dateTime" /> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:choice> + </xs:complexType> + <xs:unique name="PrimaryKey" msdata:PrimaryKey="true"> + <xs:selector xpath=".//mstns:CryptoKey" /> + <xs:field xpath="mstns:Bucket" /> + <xs:field xpath="mstns:Handle" /> + </xs:unique> + <xs:unique name="Constraint1" msdata:PrimaryKey="true"> + <xs:selector xpath=".//mstns:Nonce" /> + <xs:field xpath="mstns:IssuedUtc" /> + <xs:field xpath="mstns:Code" /> + <xs:field xpath="mstns:Context" /> + </xs:unique> + </xs:element> +</xs:schema>
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/Code/CustomStoreDataSet.xss b/src/OpenID/OpenIdProviderWebForms/Code/CustomStoreDataSet.xss new file mode 100644 index 0000000..b19f728 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/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="-10" ViewPortY="-10" 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="567" Y="77" Height="125" Width="150" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="121" /> + </Shapes> + <Connectors /> +</DiagramLayout>
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/Code/InMemoryConsumerDescription.cs b/src/OpenID/OpenIdProviderWebForms/Code/InMemoryConsumerDescription.cs new file mode 100644 index 0000000..11b5ba5 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Code/InMemoryConsumerDescription.cs @@ -0,0 +1,31 @@ +//----------------------------------------------------------------------- +// <copyright file="InMemoryConsumerDescription.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace OpenIdProviderWebForms.Code { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Web; + using DotNetOpenAuth.OAuth.ChannelElements; + + public class InMemoryConsumerDescription : IConsumerDescription { + #region IConsumerDescription Members + + public string Key { get; set; } + + public string Secret { get; set; } + + public System.Security.Cryptography.X509Certificates.X509Certificate2 Certificate { get; set; } + + public Uri Callback { get; set; } + + public DotNetOpenAuth.OAuth.VerificationCodeFormat VerificationCodeFormat { get; set; } + + public int VerificationCodeLength { get; set; } + + #endregion + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/Code/InMemoryServiceProviderAccessToken.cs b/src/OpenID/OpenIdProviderWebForms/Code/InMemoryServiceProviderAccessToken.cs new file mode 100644 index 0000000..106d38e --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Code/InMemoryServiceProviderAccessToken.cs @@ -0,0 +1,31 @@ +//----------------------------------------------------------------------- +// <copyright file="InMemoryServiceProviderAccessToken.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace OpenIdProviderWebForms.Code { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Web; + using DotNetOpenAuth.OAuth.ChannelElements; + + public class InMemoryServiceProviderAccessToken : IServiceProviderAccessToken { + #region IServiceProviderAccessToken Members + + public string Token { get; set; } + + public DateTime? ExpirationDate { get; set; } + + public string Username { get; set; } + + public string[] Roles { get; set; } + + #endregion + + public string Secret { get; set; } + + public string Scope { get; set; } + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/Code/InMemoryServiceProviderRequestToken.cs b/src/OpenID/OpenIdProviderWebForms/Code/InMemoryServiceProviderRequestToken.cs new file mode 100644 index 0000000..ce2051c --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Code/InMemoryServiceProviderRequestToken.cs @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------- +// <copyright file="InMemoryServiceProviderRequestToken.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace OpenIdProviderWebForms.Code { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Web; + using DotNetOpenAuth.OAuth.ChannelElements; + + public class InMemoryServiceProviderRequestToken : IServiceProviderRequestToken { + /// <summary> + /// Initializes a new instance of the <see cref="InMemoryServiceProviderRequestToken"/> class. + /// </summary> + public InMemoryServiceProviderRequestToken() { + this.CreatedOn = DateTime.Now; + } + + #region IServiceProviderRequestToken Members + + public string Token { get; set; } + + public string ConsumerKey { get; set; } + + public DateTime CreatedOn { get; set; } + + public Uri Callback { get; set; } + + public string VerificationCode { get; set; } + + public Version ConsumerVersion { get; set; } + + #endregion + + public string Secret { get; set; } + + public string Scope { get; set; } + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/Code/InMemoryTokenManager.cs b/src/OpenID/OpenIdProviderWebForms/Code/InMemoryTokenManager.cs new file mode 100644 index 0000000..c391291 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Code/InMemoryTokenManager.cs @@ -0,0 +1,117 @@ +//----------------------------------------------------------------------- +// <copyright file="InMemoryTokenManager.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace OpenIdProviderWebForms.Code { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Web; + using DotNetOpenAuth.OAuth.ChannelElements; + using DotNetOpenAuth.OAuth.Messages; + using DotNetOpenAuth.OpenId.Extensions.OAuth; + + /// <summary> + /// A simple in-memory token manager. JUST FOR PURPOSES OF KEEPING THE SAMPLE SIMPLE. + /// </summary> + /// <remarks> + /// This is merely a sample app. A real web app SHOULD NEVER store a memory-only + /// token manager in application. It should be an IServiceProviderTokenManager + /// implementation that is bound to a database. + /// </remarks> + public class InMemoryTokenManager : IServiceProviderTokenManager, IOpenIdOAuthTokenManager, ICombinedOpenIdProviderTokenManager { + private Dictionary<string, InMemoryServiceProviderRequestToken> requestTokens = new Dictionary<string, InMemoryServiceProviderRequestToken>(); + private Dictionary<string, InMemoryServiceProviderAccessToken> accessTokens = new Dictionary<string, InMemoryServiceProviderAccessToken>(); + + /// <summary> + /// Initializes a new instance of the <see cref="InMemoryTokenManager"/> class. + /// </summary> + internal InMemoryTokenManager() { + } + + #region IServiceProviderTokenManager Members + + public IConsumerDescription GetConsumer(string consumerKey) { + return new InMemoryConsumerDescription { + Key = consumerKey, + Secret = "some crazy secret", + }; + } + + public IServiceProviderRequestToken GetRequestToken(string token) { + return this.requestTokens[token]; + } + + public IServiceProviderAccessToken GetAccessToken(string token) { + throw new NotImplementedException(); + } + + public void UpdateToken(IServiceProviderRequestToken token) { + // Nothing to do here, since there's no database in this sample. + } + + #endregion + + #region ITokenManager Members + + public string GetTokenSecret(string token) { + if (this.requestTokens.ContainsKey(token)) { + return this.requestTokens[token].Secret; + } else { + return this.accessTokens[token].Secret; + } + } + + public void StoreNewRequestToken(DotNetOpenAuth.OAuth.Messages.UnauthorizedTokenRequest request, DotNetOpenAuth.OAuth.Messages.ITokenSecretContainingMessage response) { + throw new NotImplementedException(); + } + + public bool IsRequestTokenAuthorized(string requestToken) { + // In OpenID+OAuth scenarios, request tokens are always authorized. + return true; + } + + public void ExpireRequestTokenAndStoreNewAccessToken(string consumerKey, string requestToken, string accessToken, string accessTokenSecret) { + this.requestTokens.Remove(requestToken); + this.accessTokens[accessToken] = new InMemoryServiceProviderAccessToken { + Token = accessToken, + Secret = accessTokenSecret, + }; + } + + public TokenType GetTokenType(string token) { + if (this.requestTokens.ContainsKey(token)) { + return TokenType.RequestToken; + } else if (this.accessTokens.ContainsKey(token)) { + return TokenType.AccessToken; + } else { + return TokenType.InvalidToken; + } + } + + #endregion + + #region IOpenIdOAuthTokenManager Members + + public void StoreOpenIdAuthorizedRequestToken(string consumerKey, AuthorizationApprovedResponse authorization) { + this.requestTokens[authorization.RequestToken] = new InMemoryServiceProviderRequestToken { + Token = authorization.RequestToken, + Scope = authorization.Scope, + ConsumerVersion = authorization.Version, + }; + } + + #endregion + + #region ICombinedOpenIdProviderTokenManager Members + + public string GetConsumerKey(DotNetOpenAuth.OpenId.Realm realm) { + // We just use the realm as the consumer key, like Google does. + return realm; + } + + #endregion + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/Code/OAuthHybrid.cs b/src/OpenID/OpenIdProviderWebForms/Code/OAuthHybrid.cs new file mode 100644 index 0000000..8e64bfb --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Code/OAuthHybrid.cs @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------- +// <copyright file="OAuthHybrid.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace OpenIdProviderWebForms.Code { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Web; + using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OAuth; + using DotNetOpenAuth.OAuth.ChannelElements; + + internal class OAuthHybrid { + /// <summary> + /// Initializes static members of the <see cref="OAuthHybrid"/> class. + /// </summary> + static OAuthHybrid() { + ServiceProvider = new ServiceProviderOpenIdProvider(GetServiceDescription(), TokenManager); + } + + internal static IServiceProviderTokenManager TokenManager { + get { + // This is merely a sample app. A real web app SHOULD NEVER store a memory-only + // token manager in application. It should be an IServiceProviderTokenManager + // implementation that is bound to a database. + var tokenManager = (IServiceProviderTokenManager)HttpContext.Current.Application["TokenManager"]; + if (tokenManager == null) { + HttpContext.Current.Application["TokenManager"] = tokenManager = new InMemoryTokenManager(); + } + + return tokenManager; + } + } + + internal static ServiceProviderOpenIdProvider ServiceProvider { get; private set; } + + internal static ServiceProviderDescription GetServiceDescription() { + return new ServiceProviderDescription { + TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() }, + }; + } + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/Code/ReadOnlyXmlMembershipProvider.cs b/src/OpenID/OpenIdProviderWebForms/Code/ReadOnlyXmlMembershipProvider.cs new file mode 100644 index 0000000..54db5c0 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Code/ReadOnlyXmlMembershipProvider.cs @@ -0,0 +1,270 @@ +namespace OpenIdProviderWebForms.Code { + using System; + using System.Collections.Generic; + using System.Collections.Specialized; + using System.Configuration.Provider; + using System.Security.Permissions; + using System.Web; + using System.Web.Hosting; + using System.Web.Security; + using System.Xml; + + public class ReadOnlyXmlMembershipProvider : MembershipProvider { + private Dictionary<string, MembershipUser> users; + private string xmlFileName; + + // MembershipProvider Properties + public override string ApplicationName { + get { throw new NotSupportedException(); } + set { throw new NotSupportedException(); } + } + + public override bool EnablePasswordRetrieval { + get { return false; } + } + + public override bool EnablePasswordReset { + get { return false; } + } + + public override int MaxInvalidPasswordAttempts { + get { throw new NotSupportedException(); } + } + + public override int MinRequiredNonAlphanumericCharacters { + get { throw new NotSupportedException(); } + } + + public override int MinRequiredPasswordLength { + get { throw new NotSupportedException(); } + } + + public override int PasswordAttemptWindow { + get { throw new NotSupportedException(); } + } + + public override MembershipPasswordFormat PasswordFormat { + get { throw new NotSupportedException(); } + } + + public override string PasswordStrengthRegularExpression { + get { throw new NotSupportedException(); } + } + + public override bool RequiresQuestionAndAnswer { + get { throw new NotSupportedException(); } + } + + public override bool RequiresUniqueEmail { + get { throw new NotSupportedException(); } + } + + // MembershipProvider Methods + public override void Initialize(string name, NameValueCollection config) { + // Verify that config isn't null + if (config == null) { + throw new ArgumentNullException("config"); + } + + // Assign the provider a default name if it doesn't have one + if (string.IsNullOrEmpty(name)) { + name = "ReadOnlyXmlMembershipProvider"; + } + + // Add a default "description" attribute to config if the + // attribute doesn't exist or is empty + if (string.IsNullOrEmpty(config["description"])) { + config.Remove("description"); + config.Add("description", "Read-only XML membership provider"); + } + + // Call the base class's Initialize method + base.Initialize(name, config); + + // Initialize _XmlFileName and make sure the path + // is app-relative + string path = config["xmlFileName"]; + + if (string.IsNullOrEmpty(path)) { + path = "~/App_Data/Users.xml"; + } + + if (!VirtualPathUtility.IsAppRelative(path)) { + throw new ArgumentException("xmlFileName must be app-relative"); + } + + string fullyQualifiedPath = VirtualPathUtility.Combine( + VirtualPathUtility.AppendTrailingSlash(HttpRuntime.AppDomainAppVirtualPath), + path); + + this.xmlFileName = HostingEnvironment.MapPath(fullyQualifiedPath); + config.Remove("xmlFileName"); + + // Make sure we have permission to read the XML data source and + // throw an exception if we don't + FileIOPermission permission = new FileIOPermission(FileIOPermissionAccess.Read, this.xmlFileName); + permission.Demand(); + + // Throw an exception if unrecognized attributes remain + if (config.Count > 0) { + string attr = config.GetKey(0); + if (!string.IsNullOrEmpty(attr)) { + throw new ProviderException("Unrecognized attribute: " + attr); + } + } + } + + public override bool ValidateUser(string username, string password) { + // Validate input parameters + if (string.IsNullOrEmpty(username) || + string.IsNullOrEmpty(password)) { + return false; + } + + try { + // Make sure the data source has been loaded + this.ReadMembershipDataStore(); + + // Validate the user name and password + MembershipUser user; + if (this.users.TryGetValue(username, out user)) { + if (user.Comment == password) { // Case-sensitive + // NOTE: A read/write membership provider + // would update the user's LastLoginDate here. + // A fully featured provider would also fire + // an AuditMembershipAuthenticationSuccess + // Web event + return true; + } + } + + // NOTE: A fully featured membership provider would + // fire an AuditMembershipAuthenticationFailure + // Web event here + return false; + } catch (Exception) { + return false; + } + } + + public override MembershipUser GetUser(string username, bool userIsOnline) { + // Note: This implementation ignores userIsOnline + + // Validate input parameters + if (string.IsNullOrEmpty(username)) { + return null; + } + + // Make sure the data source has been loaded + this.ReadMembershipDataStore(); + + // Retrieve the user from the data source + MembershipUser user; + if (this.users.TryGetValue(username, out user)) { + return user; + } + + return null; + } + + public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords) { + // Note: This implementation ignores pageIndex and pageSize, + // and it doesn't sort the MembershipUser objects returned + + // Make sure the data source has been loaded + this.ReadMembershipDataStore(); + + MembershipUserCollection users = new MembershipUserCollection(); + + foreach (KeyValuePair<string, MembershipUser> pair in this.users) { + users.Add(pair.Value); + } + + totalRecords = users.Count; + return users; + } + + public override int GetNumberOfUsersOnline() { + throw new NotSupportedException(); + } + + public override bool ChangePassword(string username, string oldPassword, string newPassword) { + throw new NotSupportedException(); + } + + public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer) { + throw new NotSupportedException(); + } + + public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { + throw new NotSupportedException(); + } + + public override bool DeleteUser(string username, bool deleteAllRelatedData) { + throw new NotSupportedException(); + } + + public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords) { + throw new NotSupportedException(); + } + + public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords) { + throw new NotSupportedException(); + } + + public override string GetPassword(string username, string answer) { + throw new NotSupportedException(); + } + + public override MembershipUser GetUser(object providerUserKey, bool userIsOnline) { + throw new NotSupportedException(); + } + + public override string GetUserNameByEmail(string email) { + throw new NotSupportedException(); + } + + public override string ResetPassword(string username, string answer) { + throw new NotSupportedException(); + } + + public override bool UnlockUser(string userName) { + throw new NotSupportedException(); + } + + public override void UpdateUser(MembershipUser user) { + throw new NotSupportedException(); + } + + // Helper method + private void ReadMembershipDataStore() { + lock (this) { + if (this.users == null) { + this.users = new Dictionary<string, MembershipUser>(16, StringComparer.InvariantCultureIgnoreCase); + XmlDocument doc = new XmlDocument(); + doc.Load(this.xmlFileName); + XmlNodeList nodes = doc.GetElementsByTagName("User"); + + foreach (XmlNode node in nodes) { + MembershipUser user = new MembershipUser( + Name, // Provider name + node["UserName"].InnerText, // Username + null, // providerUserKey + null, // Email + string.Empty, // passwordQuestion + node["Password"].InnerText, // Comment + true, // isApproved + false, // isLockedOut + DateTime.Now, // creationDate + DateTime.Now, // lastLoginDate + DateTime.Now, // lastActivityDate + DateTime.Now, // lastPasswordChangedDate + new DateTime(1980, 1, 1)); // lastLockoutDate + + this.users.Add(user.UserName, user); + } + } + } + } + } +}
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/Code/TracePageAppender.cs b/src/OpenID/OpenIdProviderWebForms/Code/TracePageAppender.cs new file mode 100644 index 0000000..1bb7a34 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Code/TracePageAppender.cs @@ -0,0 +1,13 @@ +namespace OpenIdProviderWebForms.Code { + using System; + using System.Collections.Generic; + using System.IO; + using System.Web; + + 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/src/OpenID/OpenIdProviderWebForms/Code/Util.cs b/src/OpenID/OpenIdProviderWebForms/Code/Util.cs new file mode 100644 index 0000000..deff447 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Code/Util.cs @@ -0,0 +1,75 @@ +//----------------------------------------------------------------------- +// <copyright file="Util.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace OpenIdProviderWebForms.Code { + using System; + using System.Web; + using DotNetOpenAuth.OpenId; + using DotNetOpenAuth.OpenId.Provider; + + public class Util { + public static string ExtractUserName(Uri url) { + return url.Segments[url.Segments.Length - 1]; + } + + public static string ExtractUserName(Identifier identifier) { + return ExtractUserName(new Uri(identifier.ToString())); + } + + public static Identifier BuildIdentityUrl() { + return BuildIdentityUrl(HttpContext.Current.User.Identity.Name); + } + + public static Identifier BuildIdentityUrl(string username) { + // This sample Provider has a custom policy for normalizing URIs, which is that the whole + // path of the URI be lowercase except for the first letter of the username. + username = username.Substring(0, 1).ToUpperInvariant() + username.Substring(1).ToLowerInvariant(); + return new Uri(HttpContext.Current.Request.Url, HttpContext.Current.Response.ApplyAppPathModifier("~/user.aspx/" + username)); + } + + internal static void ProcessAuthenticationChallenge(IAuthenticationRequest idrequest) { + if (idrequest.Immediate) { + if (idrequest.IsDirectedIdentity) { + if (HttpContext.Current.User.Identity.IsAuthenticated) { + idrequest.LocalIdentifier = Util.BuildIdentityUrl(); + idrequest.IsAuthenticated = true; + } else { + idrequest.IsAuthenticated = false; + } + } else { + string userOwningOpenIdUrl = Util.ExtractUserName(idrequest.LocalIdentifier); + + // NOTE: in a production provider site, you may want to only + // respond affirmatively if the user has already authorized this consumer + // to know the answer. + idrequest.IsAuthenticated = userOwningOpenIdUrl == HttpContext.Current.User.Identity.Name; + } + + if (idrequest.IsAuthenticated.Value) { + // add extension responses here. + } + } else { + HttpContext.Current.Response.Redirect("~/decide.aspx", true); + } + } + + internal static void ProcessAnonymousRequest(IAnonymousRequest request) { + if (request.Immediate) { + // NOTE: in a production provider site, you may want to only + // respond affirmatively if the user has already authorized this consumer + // to know the answer. + request.IsApproved = HttpContext.Current.User.Identity.IsAuthenticated; + + if (request.IsApproved.Value) { + // Add extension responses here. + // These would typically be filled in from a user database + } + } else { + HttpContext.Current.Response.Redirect("~/decide.aspx", true); + } + } + } +}
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/Default.aspx b/src/OpenID/OpenIdProviderWebForms/Default.aspx new file mode 100644 index 0000000..4f9e4bc --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Default.aspx @@ -0,0 +1,64 @@ +<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.Master" CodeBehind="Default.aspx.cs" + Inherits="OpenIdProviderWebForms._default" %> + +<%@ Import Namespace="OpenIdProviderWebForms.Code" %> +<%@ Register Assembly="DotNetOpenAuth.OpenId.UI" Namespace="DotNetOpenAuth.OpenId" TagPrefix="openid" %> +<%@ Register Assembly="DotNetOpenAuth.OpenId.UI" Namespace="DotNetOpenAuth" TagPrefix="openauth" %> +<asp:Content runat="server" ContentPlaceHolderID="head"> + <openauth:XrdsPublisher runat="server" XrdsUrl="~/op_xrds.aspx" /> + + <script language="javascript"> + String.prototype.startsWith = function(substring) { + if (this.length < substring.length) { + return false; + } + return this.substring(0, substring.length) == substring; + }; + + function updateBookmark(rpRealm) { + if (!(rpRealm.startsWith("http://") || rpRealm.startsWith("https://"))) { + rpRealm = "http://" + rpRealm; + } + + var bookmarkUrl = document.location + "?rp=" + encodeURIComponent(rpRealm); + var bookmarkParagraph = document.getElementById('bookmarkParagraph'); + var bookmark = document.getElementById('bookmark'); + bookmarkParagraph.style.display = ''; + bookmark.href = bookmarkUrl; + bookmark.innerHTML = bookmarkUrl; + } + </script> + +</asp:Content> +<asp:Content runat="server" ContentPlaceHolderID="Main"> + <h2>Provider </h2> + <p>Welcome. This site doesn't do anything more than simple authentication of users. + Start the authentication process on the Relying Party sample site, or log in here + and send an unsolicited assertion. </p> + <asp:LoginView runat="server" ID="loginView"> + <LoggedInTemplate> + <asp:Panel runat="server" DefaultButton="sendAssertionButton"> + <p>You're logged in as <b> + <%= HttpUtility.HtmlEncode(User.Identity.Name) %></b> </p> + <p>Your claimed identifier is <b> + <%= HttpUtility.HtmlEncode(Util.BuildIdentityUrl()) %></b> </p> + <p>Since you're logged in, try sending an unsolicited assertion to an OpenID 2.0 relying + party site. Just type in the URL to the site's home page. This could be the sample + relying party web site. </p> + <div> + <asp:TextBox runat="server" ID="relyingPartySite" Columns="40" onchange="updateBookmark(this.value)" + onkeyup="updateBookmark(this.value)" /> + <asp:Button runat="server" ID="sendAssertionButton" Text="Login" OnClick="sendAssertionButton_Click" /> + <asp:RequiredFieldValidator runat="server" ControlToValidate="relyingPartySite" Text="Specify relying party site first" /> + </div> + <p id="bookmarkParagraph" style="display: none">Bookmark <a id="bookmark"></a> so + you can log into the RP automatically in the future.</p> + <p>An unsolicited assertion is a way to log in to a relying party site directly from + your OpenID Provider. </p> + <p><asp:Label runat="server" EnableViewState="false" Visible="false" ID="errorLabel" + ForeColor="Red" /> </p> + </asp:Panel> + </LoggedInTemplate> + </asp:LoginView> + <asp:LoginStatus runat="server" /> +</asp:Content> diff --git a/src/OpenID/OpenIdProviderWebForms/Default.aspx.cs b/src/OpenID/OpenIdProviderWebForms/Default.aspx.cs new file mode 100644 index 0000000..4843639 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Default.aspx.cs @@ -0,0 +1,48 @@ +namespace OpenIdProviderWebForms { + using System; + using System.Web.Security; + using System.Web.UI.WebControls; + using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId; + using DotNetOpenAuth.OpenId.Provider; + using OpenIdProviderWebForms.Code; + + /// <summary> + /// Page for handling logins to this server. + /// </summary> + public partial class _default : System.Web.UI.Page { + protected void Page_Load(object sender, EventArgs e) { + if (Request.QueryString["rp"] != null) { + if (Page.User.Identity.IsAuthenticated) { + this.SendAssertion(Request.QueryString["rp"]); + } else { + FormsAuthentication.RedirectToLoginPage(); + } + } else { + TextBox relyingPartySite = (TextBox)this.loginView.FindControl("relyingPartySite"); + if (relyingPartySite != null) { + relyingPartySite.Focus(); + } + } + } + + protected void sendAssertionButton_Click(object sender, EventArgs e) { + TextBox relyingPartySite = (TextBox)this.loginView.FindControl("relyingPartySite"); + this.SendAssertion(relyingPartySite.Text); + } + + private void SendAssertion(string relyingPartyRealm) { + Uri providerEndpoint = new Uri(Request.Url, Page.ResolveUrl("~/server.aspx")); + OpenIdProvider op = new OpenIdProvider(); + try { + // Send user input through identifier parser so we accept more free-form input. + string rpSite = Identifier.Parse(relyingPartyRealm); + op.PrepareUnsolicitedAssertion(providerEndpoint, rpSite, Util.BuildIdentityUrl(), Util.BuildIdentityUrl()).Send(); + } catch (ProtocolException ex) { + Label errorLabel = (Label)this.loginView.FindControl("errorLabel"); + errorLabel.Visible = true; + errorLabel.Text = ex.Message; + } + } + } +}
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/Default.aspx.designer.cs b/src/OpenID/OpenIdProviderWebForms/Default.aspx.designer.cs new file mode 100644 index 0000000..70872c7 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Default.aspx.designer.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace OpenIdProviderWebForms { + + + public partial class _default { + + /// <summary> + /// loginView 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.LoginView loginView; + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/Global.asax b/src/OpenID/OpenIdProviderWebForms/Global.asax new file mode 100644 index 0000000..a67f1b1 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="OpenIdProviderWebForms.Global" Language="C#" %> diff --git a/src/OpenID/OpenIdProviderWebForms/Global.asax.cs b/src/OpenID/OpenIdProviderWebForms/Global.asax.cs new file mode 100644 index 0000000..43b1be6 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Global.asax.cs @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------- +// <copyright file="Global.asax.cs" company="Outercurve Foundation"> +// Copyright (c) Outercurve Foundation. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace OpenIdProviderWebForms { + using System; + using System.Collections.Specialized; + using System.IO; + using System.Text; + using System.Web; + using OpenIdProviderWebForms.Code; + + public class Global : System.Web.HttpApplication { + public static log4net.ILog Logger = log4net.LogManager.GetLogger(typeof(Global)); + + internal static StringBuilder LogMessages = new StringBuilder(); + + public static string ToString(NameValueCollection collection) { + using (StringWriter sw = new StringWriter()) { + foreach (string key in collection.Keys) { + sw.WriteLine("{0} = '{1}'", key, collection[key]); + } + return sw.ToString(); + } + } + + 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(); + } + + protected void Application_BeginRequest(object sender, EventArgs e) { + Logger.DebugFormat("Processing {0} on {1} ", this.Request.HttpMethod, this.stripQueryString(this.Request.Url)); + if (Request.QueryString.Count > 0) { + Logger.DebugFormat("Querystring follows: \n{0}", ToString(Request.QueryString)); + } + if (Request.Form.Count > 0) { + Logger.DebugFormat("Posted form follows: \n{0}", ToString(Request.Form)); + } + } + + protected void Application_AuthenticateRequest(object sender, EventArgs e) { + 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) { + Logger.ErrorFormat( + "An unhandled exception was raised. Details follow: {0}", + HttpContext.Current.Server.GetLastError()); + } + + private string stripQueryString(Uri uri) { + UriBuilder builder = new UriBuilder(uri); + builder.Query = null; + return builder.ToString(); + } + } +}
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/OpenIdProviderWebForms.csproj b/src/OpenID/OpenIdProviderWebForms/OpenIdProviderWebForms.csproj new file mode 100644 index 0000000..d4e2b90 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/OpenIdProviderWebForms.csproj @@ -0,0 +1,258 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))\EnlistmentInfo.props" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))' != '' " />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{2A59DE0A-B76A-4B42-9A33-04D34548353D}</ProjectGuid>
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>OpenIdProviderWebForms</RootNamespace>
+ <AssemblyName>OpenIdProviderWebForms</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <TargetFrameworkProfile />
+ <UseIISExpress>false</UseIISExpress>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\</OutputPath>
+ <DefineConstants>DEBUG</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'CodeAnalysis|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\</OutputPath>
+ <DefineConstants>DEBUG</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\DotNetOpenAuth.Core.4.0.0.12084\lib\net40-full\DotNetOpenAuth.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="DotNetOpenAuth.Core.UI, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\DotNetOpenAuth.Core.UI.4.0.0.12084\lib\net40-full\DotNetOpenAuth.Core.UI.dll</HintPath>
+ </Reference>
+ <Reference Include="DotNetOpenAuth.OAuth, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\DotNetOpenAuth.OAuth.Core.4.0.0.12084\lib\net40-full\DotNetOpenAuth.OAuth.dll</HintPath>
+ </Reference>
+ <Reference Include="DotNetOpenAuth.OAuth.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\DotNetOpenAuth.OAuth.Common.4.0.0.12084\lib\net40-full\DotNetOpenAuth.OAuth.Common.dll</HintPath>
+ </Reference>
+ <Reference Include="DotNetOpenAuth.OAuth.Consumer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\DotNetOpenAuth.OAuth.Consumer.4.0.0.12084\lib\net40-full\DotNetOpenAuth.OAuth.Consumer.dll</HintPath>
+ </Reference>
+ <Reference Include="DotNetOpenAuth.OAuth.ServiceProvider, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\DotNetOpenAuth.OAuth.ServiceProvider.4.0.0.12084\lib\net40-full\DotNetOpenAuth.OAuth.ServiceProvider.dll</HintPath>
+ </Reference>
+ <Reference Include="DotNetOpenAuth.OpenId, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\DotNetOpenAuth.OpenId.Core.4.0.0.12084\lib\net40-full\DotNetOpenAuth.OpenId.dll</HintPath>
+ </Reference>
+ <Reference Include="DotNetOpenAuth.OpenId.Provider, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\DotNetOpenAuth.OpenId.Provider.4.0.0.12084\lib\net40-full\DotNetOpenAuth.OpenId.Provider.dll</HintPath>
+ </Reference>
+ <Reference Include="DotNetOpenAuth.OpenId.Provider.UI, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\DotNetOpenAuth.OpenId.Provider.UI.4.0.0.12084\lib\net40-full\DotNetOpenAuth.OpenId.Provider.UI.dll</HintPath>
+ </Reference>
+ <Reference Include="DotNetOpenAuth.OpenId.UI, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\DotNetOpenAuth.OpenId.Core.UI.4.0.0.12084\lib\net40-full\DotNetOpenAuth.OpenId.UI.dll</HintPath>
+ </Reference>
+ <Reference Include="DotNetOpenAuth.OpenIdOAuth, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\DotNetOpenAuth.OpenIdOAuth.4.0.0.12084\lib\net40-full\DotNetOpenAuth.OpenIdOAuth.dll</HintPath>
+ </Reference>
+ <Reference Include="log4net">
+ <HintPath>..\..\..\packages\log4net.2.0.0\lib\net40-full\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Web.DynamicData" />
+ <Reference Include="System.Web.Entity" />
+ <Reference Include="System.Web.Extensions" />
+ <Reference Include="System.Web.Extensions.Design" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.EnterpriseServices" />
+ <Reference Include="System.Web.Mobile" />
+ <Reference Include="System.Web.ApplicationServices" Condition=" '$(TargetFrameworkVersion)' != 'v3.5' ">
+ <RequiredTargetFramework>v4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="App_Data\Users.xml" />
+ <Content Include="op_xrds.aspx" />
+ <Content Include="decide.aspx" />
+ <Content Include="Default.aspx" />
+ <Content Include="login.aspx" />
+ <Content Include="ProfileFields.ascx" />
+ <Content Include="server.aspx" />
+ <Content Include="user.aspx" />
+ <Content Include="Global.asax" />
+ <Content Include="Web.config" />
+ <Content Include="user_xrds.aspx" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="access_token.ashx.cs">
+ <DependentUpon>access_token.ashx</DependentUpon>
+ </Compile>
+ <Compile Include="Code\InMemoryConsumerDescription.cs" />
+ <Compile Include="Code\InMemoryServiceProviderAccessToken.cs" />
+ <Compile Include="Code\CustomStore.cs" />
+ <Compile Include="Code\CustomStoreDataSet.Designer.cs">
+ <DependentUpon>CustomStoreDataSet.xsd</DependentUpon>
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ </Compile>
+ <Compile Include="Code\InMemoryServiceProviderRequestToken.cs" />
+ <Compile Include="Code\InMemoryTokenManager.cs" />
+ <Compile Include="Code\OAuthHybrid.cs" />
+ <Compile Include="Code\ReadOnlyXmlMembershipProvider.cs" />
+ <Compile Include="Code\TracePageAppender.cs" />
+ <Compile Include="Code\Util.cs" />
+ <Compile Include="decide.aspx.cs">
+ <DependentUpon>decide.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="decide.aspx.designer.cs">
+ <DependentUpon>decide.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Default.aspx.cs">
+ <DependentUpon>Default.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="Default.aspx.designer.cs">
+ <DependentUpon>Default.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Global.asax.cs">
+ <DependentUpon>Global.asax</DependentUpon>
+ </Compile>
+ <Compile Include="login.aspx.cs">
+ <DependentUpon>login.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="login.aspx.designer.cs">
+ <DependentUpon>login.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="ProfileFields.ascx.cs">
+ <DependentUpon>ProfileFields.ascx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="ProfileFields.ascx.designer.cs">
+ <DependentUpon>ProfileFields.ascx</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Provider.ashx.cs">
+ <DependentUpon>Provider.ashx</DependentUpon>
+ </Compile>
+ <Compile Include="server.aspx.cs">
+ <DependentUpon>server.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="server.aspx.designer.cs">
+ <DependentUpon>server.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="TracePage.aspx.cs">
+ <DependentUpon>TracePage.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="TracePage.aspx.designer.cs">
+ <DependentUpon>TracePage.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="user.aspx.cs">
+ <DependentUpon>user.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="user.aspx.designer.cs">
+ <DependentUpon>user.aspx</DependentUpon>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="favicon.ico" />
+ <Content Include="Site.Master" />
+ <Content Include="styles.css" />
+ <Content Include="TracePage.aspx" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="access_token.ashx" />
+ <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>
+ <Content Include="images\DotNetOpenAuth.png" />
+ <Content Include="Provider.ashx" />
+ <Content Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\DotNetOpenAuth.ApplicationBlock\DotNetOpenAuth.ApplicationBlock.csproj">
+ <Project>{AA78D112-D889-414B-A7D4-467B34C7B663}</Project>
+ <Name>DotNetOpenAuth.ApplicationBlock</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + -->
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+ <WebProjectProperties>
+ <UseIIS>False</UseIIS>
+ <AutoAssignPort>False</AutoAssignPort>
+ <DevelopmentServerPort>4860</DevelopmentServerPort>
+ <DevelopmentServerVPath>/</DevelopmentServerVPath>
+ <IISUrl>
+ </IISUrl>
+ <NTLMAuthentication>False</NTLMAuthentication>
+ <UseCustomServer>False</UseCustomServer>
+ <CustomServerUrl>
+ </CustomServerUrl>
+ <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
+ </WebProjectProperties>
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))\EnlistmentInfo.targets" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.targets))' != '' " />
+ <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+</Project>
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/ProfileFields.ascx b/src/OpenID/OpenIdProviderWebForms/ProfileFields.ascx new file mode 100644 index 0000000..9f368d5 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/ProfileFields.ascx @@ -0,0 +1,1024 @@ +<%@ Control Language="C#" AutoEventWireup="true" Inherits="OpenIdProviderWebForms.ProfileFields" CodeBehind="ProfileFields.ascx.cs" %> +This consumer has requested the following fields from you<br /> +<table> + <tr> + <td> + + </td> + <td> + <asp:HyperLink ID="privacyLink" runat="server" Text="Privacy Policy" + Target="_blank" /> + </td> + </tr> + <tr runat="server" id="nicknameRow"> + <td> + Nickname + <asp:Label ID="nicknameRequiredLabel" runat="server" Text="*" Visible="False"></asp:Label> + </td> + <td> + <asp:TextBox ID="nicknameTextBox" runat="server"></asp:TextBox> + </td> + </tr> + <tr runat="server" id="emailRow"> + <td> + Email + <asp:Label ID="emailRequiredLabel" runat="server" Text="*" Visible="False"></asp:Label> + </td> + <td> + <asp:TextBox ID="emailTextBox" runat="server"></asp:TextBox> + </td> + </tr> + <tr runat="server" id="fullnameRow"> + <td> + FullName + <asp:Label ID="fullnameRequiredLabel" runat="server" Text="*" Visible="False"></asp:Label> + </td> + <td> + <asp:TextBox ID="fullnameTextBox" runat="server"></asp:TextBox> + </td> + </tr> + <tr runat="server" id="dateOfBirthRow"> + <td> + Date of Birth + <asp:Label ID="dobRequiredLabel" runat="server" Text="*" Visible="False"></asp:Label> + </td> + <td> + <asp:DropDownList ID="dobDayDropdownlist" runat="server"> + <asp:ListItem></asp:ListItem> + <asp:ListItem>1</asp:ListItem> + <asp:ListItem>2</asp:ListItem> + <asp:ListItem>3</asp:ListItem> + <asp:ListItem>4</asp:ListItem> + <asp:ListItem>5</asp:ListItem> + <asp:ListItem>6</asp:ListItem> + <asp:ListItem>7</asp:ListItem> + <asp:ListItem>8</asp:ListItem> + <asp:ListItem>9</asp:ListItem> + <asp:ListItem>10</asp:ListItem> + <asp:ListItem>11</asp:ListItem> + <asp:ListItem>12</asp:ListItem> + <asp:ListItem>13</asp:ListItem> + <asp:ListItem>14</asp:ListItem> + <asp:ListItem>15</asp:ListItem> + <asp:ListItem>16</asp:ListItem> + <asp:ListItem>17</asp:ListItem> + <asp:ListItem>18</asp:ListItem> + <asp:ListItem>19</asp:ListItem> + <asp:ListItem>20</asp:ListItem> + <asp:ListItem>21</asp:ListItem> + <asp:ListItem>22</asp:ListItem> + <asp:ListItem>23</asp:ListItem> + <asp:ListItem>24</asp:ListItem> + <asp:ListItem>25</asp:ListItem> + <asp:ListItem>26</asp:ListItem> + <asp:ListItem>27</asp:ListItem> + <asp:ListItem>28</asp:ListItem> + <asp:ListItem>29</asp:ListItem> + <asp:ListItem>30</asp:ListItem> + <asp:ListItem>31</asp:ListItem> + </asp:DropDownList> + <asp:DropDownList ID="dobMonthDropdownlist" runat="server"> + <asp:ListItem></asp:ListItem> + <asp:ListItem Value="1">January</asp:ListItem> + <asp:ListItem Value="2">February</asp:ListItem> + <asp:ListItem Value="3">March</asp:ListItem> + <asp:ListItem Value="4">April</asp:ListItem> + <asp:ListItem Value="5">May</asp:ListItem> + <asp:ListItem Value="6">June</asp:ListItem> + <asp:ListItem Value="7">July</asp:ListItem> + <asp:ListItem Value="8">August</asp:ListItem> + <asp:ListItem Value="9">September</asp:ListItem> + <asp:ListItem Value="10">October</asp:ListItem> + <asp:ListItem Value="11">November</asp:ListItem> + <asp:ListItem Value="12">December</asp:ListItem> + </asp:DropDownList> + + <asp:DropDownList ID="dobYearDropdownlist" runat="server"> + <asp:ListItem></asp:ListItem> + <asp:ListItem>2009</asp:ListItem> + <asp:ListItem>2008</asp:ListItem> + <asp:ListItem>2007</asp:ListItem> + <asp:ListItem>2006</asp:ListItem> + <asp:ListItem>2005</asp:ListItem> + <asp:ListItem>2004</asp:ListItem> + <asp:ListItem>2003</asp:ListItem> + <asp:ListItem>2002</asp:ListItem> + <asp:ListItem>2001</asp:ListItem> + <asp:ListItem>2000</asp:ListItem> + <asp:ListItem>1999</asp:ListItem> + <asp:ListItem>1998</asp:ListItem> + <asp:ListItem>1997</asp:ListItem> + <asp:ListItem>1996</asp:ListItem> + <asp:ListItem>1995</asp:ListItem> + <asp:ListItem>1994</asp:ListItem> + <asp:ListItem>1993</asp:ListItem> + <asp:ListItem>1992</asp:ListItem> + <asp:ListItem>1991</asp:ListItem> + <asp:ListItem>1990</asp:ListItem> + <asp:ListItem>1989</asp:ListItem> + <asp:ListItem>1988</asp:ListItem> + <asp:ListItem>1987</asp:ListItem> + <asp:ListItem>1986</asp:ListItem> + <asp:ListItem>1985</asp:ListItem> + <asp:ListItem>1984</asp:ListItem> + <asp:ListItem>1983</asp:ListItem> + <asp:ListItem>1982</asp:ListItem> + <asp:ListItem>1981</asp:ListItem> + <asp:ListItem>1980</asp:ListItem> + <asp:ListItem>1979</asp:ListItem> + <asp:ListItem>1978</asp:ListItem> + <asp:ListItem>1977</asp:ListItem> + <asp:ListItem>1976</asp:ListItem> + <asp:ListItem>1975</asp:ListItem> + <asp:ListItem>1974</asp:ListItem> + <asp:ListItem>1973</asp:ListItem> + <asp:ListItem>1972</asp:ListItem> + <asp:ListItem>1971</asp:ListItem> + <asp:ListItem>1970</asp:ListItem> + <asp:ListItem>1969</asp:ListItem> + <asp:ListItem>1968</asp:ListItem> + <asp:ListItem>1967</asp:ListItem> + <asp:ListItem>1966</asp:ListItem> + <asp:ListItem>1965</asp:ListItem> + <asp:ListItem>1964</asp:ListItem> + <asp:ListItem>1963</asp:ListItem> + <asp:ListItem>1962</asp:ListItem> + <asp:ListItem>1961</asp:ListItem> + <asp:ListItem>1960</asp:ListItem> + <asp:ListItem>1959</asp:ListItem> + <asp:ListItem>1958</asp:ListItem> + <asp:ListItem>1957</asp:ListItem> + <asp:ListItem>1956</asp:ListItem> + <asp:ListItem>1955</asp:ListItem> + <asp:ListItem>1954</asp:ListItem> + <asp:ListItem>1953</asp:ListItem> + <asp:ListItem>1952</asp:ListItem> + <asp:ListItem>1951</asp:ListItem> + <asp:ListItem>1950</asp:ListItem> + <asp:ListItem>1949</asp:ListItem> + <asp:ListItem>1948</asp:ListItem> + <asp:ListItem>1947</asp:ListItem> + <asp:ListItem>1946</asp:ListItem> + <asp:ListItem>1945</asp:ListItem> + <asp:ListItem>1944</asp:ListItem> + <asp:ListItem>1943</asp:ListItem> + <asp:ListItem>1942</asp:ListItem> + <asp:ListItem>1941</asp:ListItem> + <asp:ListItem>1940</asp:ListItem> + <asp:ListItem>1939</asp:ListItem> + <asp:ListItem>1938</asp:ListItem> + <asp:ListItem>1937</asp:ListItem> + <asp:ListItem>1936</asp:ListItem> + <asp:ListItem>1935</asp:ListItem> + <asp:ListItem>1934</asp:ListItem> + <asp:ListItem>1933</asp:ListItem> + <asp:ListItem>1932</asp:ListItem> + <asp:ListItem>1931</asp:ListItem> + <asp:ListItem>1930</asp:ListItem> + <asp:ListItem>1929</asp:ListItem> + <asp:ListItem>1928</asp:ListItem> + <asp:ListItem>1927</asp:ListItem> + <asp:ListItem>1926</asp:ListItem> + <asp:ListItem>1925</asp:ListItem> + <asp:ListItem>1924</asp:ListItem> + <asp:ListItem>1923</asp:ListItem> + <asp:ListItem>1922</asp:ListItem> + <asp:ListItem>1921</asp:ListItem> + <asp:ListItem>1920</asp:ListItem> + </asp:DropDownList> + </td> + </tr> + <tr runat="server" id="genderRow"> + <td> + Gender + <asp:Label ID="genderRequiredLabel" runat="server" Text="*" Visible="False"></asp:Label> + </td> + <td> + <asp:DropDownList ID="genderDropdownList" runat="server"> + <asp:ListItem Selected="True"></asp:ListItem> + <asp:ListItem>Male</asp:ListItem> + <asp:ListItem>Female</asp:ListItem> + </asp:DropDownList> + </td> + </tr> + <tr runat="server" id="postcodeRow"> + <td> + Post Code + <asp:Label ID="postcodeRequiredLabel" runat="server" Text="*" Visible="False"></asp:Label> + </td> + <td> + <asp:TextBox ID="postcodeTextBox" runat="server"></asp:TextBox> + </td> + </tr> + <tr runat="server" id="countryRow"> + <td> + Country + <asp:Label ID="countryRequiredLabel" runat="server" Text="*" Visible="False"></asp:Label> + </td> + <td> + <asp:DropDownList ID="countryDropdownList" runat="server"> + <asp:ListItem Value=""> </asp:ListItem> + <asp:ListItem Value="AF">AFGHANISTAN </asp:ListItem> + <asp:ListItem Value="AX">ÅLAND ISLANDS</asp:ListItem> + <asp:ListItem Value="AL">ALBANIA</asp:ListItem> + <asp:ListItem Value="DZ">ALGERIA</asp:ListItem> + <asp:ListItem Value="AS">AMERICAN SAMOA</asp:ListItem> + <asp:ListItem Value="AD">ANDORRA</asp:ListItem> + <asp:ListItem Value="AO">ANGOLA</asp:ListItem> + <asp:ListItem Value="AI">ANGUILLA</asp:ListItem> + <asp:ListItem Value="AQ">ANTARCTICA</asp:ListItem> + <asp:ListItem Value="AG">ANTIGUA AND BARBUDA</asp:ListItem> + <asp:ListItem Value="AR">ARGENTINA</asp:ListItem> + <asp:ListItem Value="AM">ARMENIA</asp:ListItem> + <asp:ListItem Value="AW">ARUBA</asp:ListItem> + <asp:ListItem Value="AU">AUSTRALIA</asp:ListItem> + <asp:ListItem Value="AT">AUSTRIA</asp:ListItem> + <asp:ListItem Value="AZ">AZERBAIJAN</asp:ListItem> + <asp:ListItem Value="BS">BAHAMAS</asp:ListItem> + <asp:ListItem Value="BH">BAHRAIN</asp:ListItem> + <asp:ListItem Value="BD">BANGLADESH</asp:ListItem> + <asp:ListItem Value="BB">BARBADOS</asp:ListItem> + <asp:ListItem Value="BY">BELARUS</asp:ListItem> + <asp:ListItem Value="BE">BELGIUM</asp:ListItem> + <asp:ListItem Value="BZ">BELIZE</asp:ListItem> + <asp:ListItem Value="BJ">BENIN</asp:ListItem> + <asp:ListItem Value="BM">BERMUDA</asp:ListItem> + <asp:ListItem Value="BT">BHUTAN</asp:ListItem> + <asp:ListItem Value="BO">BOLIVIA</asp:ListItem> + <asp:ListItem Value="BA">BOSNIA AND HERZEGOVINA</asp:ListItem> + <asp:ListItem Value="BW">BOTSWANA</asp:ListItem> + <asp:ListItem Value="BV">BOUVET ISLAND</asp:ListItem> + <asp:ListItem Value="BR">BRAZIL</asp:ListItem> + <asp:ListItem Value="IO">BRITISH INDIAN OCEAN TERRITORY</asp:ListItem> + <asp:ListItem Value="BN">BRUNEI DARUSSALAM</asp:ListItem> + <asp:ListItem Value="BG">BULGARIA</asp:ListItem> + <asp:ListItem Value="BF">BURKINA FASO</asp:ListItem> + <asp:ListItem Value="BI">BURUNDI</asp:ListItem> + <asp:ListItem Value="KH">CAMBODIA</asp:ListItem> + <asp:ListItem Value="CM">CAMEROON</asp:ListItem> + <asp:ListItem Value="CA">CANADA</asp:ListItem> + <asp:ListItem Value="CV">CAPE VERDE</asp:ListItem> + <asp:ListItem Value="KY">CAYMAN ISLANDS</asp:ListItem> + <asp:ListItem Value="CF">CENTRAL AFRICAN REPUBLIC</asp:ListItem> + <asp:ListItem Value="TD">CHAD</asp:ListItem> + <asp:ListItem Value="CL">CHILE</asp:ListItem> + <asp:ListItem Value="CN">CHINA</asp:ListItem> + <asp:ListItem Value="CX">CHRISTMAS ISLAND</asp:ListItem> + <asp:ListItem Value="CC">COCOS (KEELING) ISLANDS</asp:ListItem> + <asp:ListItem Value="CO">COLOMBIA</asp:ListItem> + <asp:ListItem Value="KM">COMOROS</asp:ListItem> + <asp:ListItem Value="CG">CONGO</asp:ListItem> + <asp:ListItem Value="CD">CONGO, THE DEMOCRATIC REPUBLIC OF THE</asp:ListItem> + <asp:ListItem Value="CK">COOK ISLANDS</asp:ListItem> + <asp:ListItem Value="CR">COSTA RICA</asp:ListItem> + <asp:ListItem Value="CI">CÔTE D'IVOIRE</asp:ListItem> + <asp:ListItem Value="HR">CROATIA</asp:ListItem> + <asp:ListItem Value="CU">CUBA</asp:ListItem> + <asp:ListItem Value="CY">CYPRUS</asp:ListItem> + <asp:ListItem Value="CZ">CZECH REPUBLIC</asp:ListItem> + <asp:ListItem Value="DK">DENMARK</asp:ListItem> + <asp:ListItem Value="DJ">DJIBOUTI</asp:ListItem> + <asp:ListItem Value="DM">DOMINICA</asp:ListItem> + <asp:ListItem Value="DO">DOMINICAN REPUBLIC</asp:ListItem> + <asp:ListItem Value="EC">ECUADOR</asp:ListItem> + <asp:ListItem Value="EG">EGYPT</asp:ListItem> + <asp:ListItem Value="SV">EL SALVADOR</asp:ListItem> + <asp:ListItem Value="GQ">EQUATORIAL GUINEA</asp:ListItem> + <asp:ListItem Value="ER">ERITREA</asp:ListItem> + <asp:ListItem Value="EE">ESTONIA</asp:ListItem> + <asp:ListItem Value="ET">ETHIOPIA</asp:ListItem> + <asp:ListItem Value="FK">FALKLAND ISLANDS (MALVINAS)</asp:ListItem> + <asp:ListItem Value="FO">FAROE ISLANDS</asp:ListItem> + <asp:ListItem Value="FJ">FIJI</asp:ListItem> + <asp:ListItem Value="FI">FINLAND</asp:ListItem> + <asp:ListItem Value="FR">FRANCE</asp:ListItem> + <asp:ListItem Value="GF">FRENCH GUIANA</asp:ListItem> + <asp:ListItem Value="PF">FRENCH POLYNESIA</asp:ListItem> + <asp:ListItem Value="TF">FRENCH SOUTHERN TERRITORIES</asp:ListItem> + <asp:ListItem Value="GA">GABON </asp:ListItem> + <asp:ListItem Value="GM">GAMBIA</asp:ListItem> + <asp:ListItem Value="GE">GEORGIA</asp:ListItem> + <asp:ListItem Value="DE">GERMANY</asp:ListItem> + <asp:ListItem Value="GH">GHANA</asp:ListItem> + <asp:ListItem Value="GI">GIBRALTAR</asp:ListItem> + <asp:ListItem Value="GR">GREECE</asp:ListItem> + <asp:ListItem Value="GL">GREENLAND</asp:ListItem> + <asp:ListItem Value="GD">GRENADA</asp:ListItem> + <asp:ListItem Value="GP">GUADELOUPE</asp:ListItem> + <asp:ListItem Value="GU">GUAM </asp:ListItem> + <asp:ListItem Value="GT">GUATEMALA</asp:ListItem> + <asp:ListItem Value="GG">GUERNSEY</asp:ListItem> + <asp:ListItem Value="GN">GUINEA</asp:ListItem> + <asp:ListItem Value="GW">GUINEA-BISSAU</asp:ListItem> + <asp:ListItem Value="GY">GUYANA</asp:ListItem> + <asp:ListItem Value="HT">HAITI</asp:ListItem> + <asp:ListItem Value="HM">HEARD ISLAND AND MCDONALD ISLANDS</asp:ListItem> + <asp:ListItem Value="VA">HOLY SEE (VATICAN CITY STATE)</asp:ListItem> + <asp:ListItem Value="HN">HONDURAS</asp:ListItem> + <asp:ListItem Value="HK">HONG KONG</asp:ListItem> + <asp:ListItem Value="HU">HUNGARY</asp:ListItem> + <asp:ListItem Value="IS">ICELAND</asp:ListItem> + <asp:ListItem Value="IN">INDIA</asp:ListItem> + <asp:ListItem Value="ID">INDONESIA</asp:ListItem> + <asp:ListItem Value="IR">IRAN, ISLAMIC REPUBLIC OF</asp:ListItem> + <asp:ListItem Value="IQ">IRAQ</asp:ListItem> + <asp:ListItem Value="IE">IRELAND</asp:ListItem> + <asp:ListItem Value="IM">ISLE OF MAN</asp:ListItem> + <asp:ListItem Value="IL">ISRAEL</asp:ListItem> + <asp:ListItem Value="IT">ITALY</asp:ListItem> + <asp:ListItem Value="JM">JAMAICA</asp:ListItem> + <asp:ListItem Value="JP">JAPAN</asp:ListItem> + <asp:ListItem Value="JE">JERSEY</asp:ListItem> + <asp:ListItem Value="JO">JORDAN</asp:ListItem> + <asp:ListItem Value="KZ">KAZAKHSTAN</asp:ListItem> + <asp:ListItem Value="KE">KENYA</asp:ListItem> + <asp:ListItem Value="KI">KIRIBATI</asp:ListItem> + <asp:ListItem Value="KP">KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF</asp:ListItem> + <asp:ListItem Value="KR">KOREA, REPUBLIC OF</asp:ListItem> + <asp:ListItem Value="KW">KUWAIT</asp:ListItem> + <asp:ListItem Value="KG">KYRGYZSTAN</asp:ListItem> + <asp:ListItem Value="LA">LAO PEOPLE'S DEMOCRATIC REPUBLIC </asp:ListItem> + <asp:ListItem Value="LV">LATVIA</asp:ListItem> + <asp:ListItem Value="LB">LEBANON</asp:ListItem> + <asp:ListItem Value="LS">LESOTHO</asp:ListItem> + <asp:ListItem Value="LR">LIBERIA</asp:ListItem> + <asp:ListItem Value="LY">LIBYAN ARAB JAMAHIRIYA</asp:ListItem> + <asp:ListItem Value="LI">LIECHTENSTEIN</asp:ListItem> + <asp:ListItem Value="LT">LITHUANIA</asp:ListItem> + <asp:ListItem Value="LU">LUXEMBOURG</asp:ListItem> + <asp:ListItem Value="MO">MACAO</asp:ListItem> + <asp:ListItem Value="MK">MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF</asp:ListItem> + <asp:ListItem Value="MG">MADAGASCAR</asp:ListItem> + <asp:ListItem Value="MW">MALAWI</asp:ListItem> + <asp:ListItem Value="MY">MALAYSIA</asp:ListItem> + <asp:ListItem Value="MV">MALDIVES</asp:ListItem> + <asp:ListItem Value="ML">MALI</asp:ListItem> + <asp:ListItem Value="MT">MALTA</asp:ListItem> + <asp:ListItem Value="MH">MARSHALL ISLANDS</asp:ListItem> + <asp:ListItem Value="MQ">MARTINIQUE</asp:ListItem> + <asp:ListItem Value="MR">MAURITANIA</asp:ListItem> + <asp:ListItem Value="MU">MAURITIUS</asp:ListItem> + <asp:ListItem Value="YT">MAYOTTE</asp:ListItem> + <asp:ListItem Value="MX">MEXICO</asp:ListItem> + <asp:ListItem Value="FM">MICRONESIA, FEDERATED STATES OF</asp:ListItem> + <asp:ListItem Value="MD">MOLDOVA, REPUBLIC OF</asp:ListItem> + <asp:ListItem Value="MC">MONACO</asp:ListItem> + <asp:ListItem Value="MN">MONGOLIA</asp:ListItem> + <asp:ListItem Value="ME">MONTENEGRO</asp:ListItem> + <asp:ListItem Value="MS">MONTSERRAT</asp:ListItem> + <asp:ListItem Value="MA">MOROCCO</asp:ListItem> + <asp:ListItem Value="MZ">MOZAMBIQUE</asp:ListItem> + <asp:ListItem Value="MM">MYANMAR</asp:ListItem> + <asp:ListItem Value="NA">NAMIBIA</asp:ListItem> + <asp:ListItem Value="NR">NAURU</asp:ListItem> + <asp:ListItem Value="NP">NEPAL</asp:ListItem> + <asp:ListItem Value="NL">NETHERLANDS</asp:ListItem> + <asp:ListItem Value="AN">NETHERLANDS ANTILLES</asp:ListItem> + <asp:ListItem Value="NC">NEW CALEDONIA</asp:ListItem> + <asp:ListItem Value="NZ">NEW ZEALAND</asp:ListItem> + <asp:ListItem Value="NI">NICARAGUA</asp:ListItem> + <asp:ListItem Value="NE">NIGER</asp:ListItem> + <asp:ListItem Value="NG">NIGERIA</asp:ListItem> + <asp:ListItem Value="NU">NIUE</asp:ListItem> + <asp:ListItem Value="NF">NORFOLK ISLAND</asp:ListItem> + <asp:ListItem Value="MP">NORTHERN MARIANA ISLANDS</asp:ListItem> + <asp:ListItem Value="NO">NORWAY</asp:ListItem> + <asp:ListItem Value="OM">OMAN</asp:ListItem> + <asp:ListItem Value="PK">PAKISTAN</asp:ListItem> + <asp:ListItem Value="PW">PALAU</asp:ListItem> + <asp:ListItem Value="PS">PALESTINIAN TERRITORY, OCCUPIED</asp:ListItem> + <asp:ListItem Value="PA">PANAMA</asp:ListItem> + <asp:ListItem Value="PG">PAPUA NEW GUINEA</asp:ListItem> + <asp:ListItem Value="PY">PARAGUAY</asp:ListItem> + <asp:ListItem Value="PE">PERU</asp:ListItem> + <asp:ListItem Value="PH">PHILIPPINES</asp:ListItem> + <asp:ListItem Value="PN">PITCAIRN</asp:ListItem> + <asp:ListItem Value="PL">POLAND</asp:ListItem> + <asp:ListItem Value="PT">PORTUGAL</asp:ListItem> + <asp:ListItem Value="PR">PUERTO RICO</asp:ListItem> + <asp:ListItem Value="QA">QATAR</asp:ListItem> + <asp:ListItem Value="RE">RÉUNION</asp:ListItem> + <asp:ListItem Value="RO">ROMANIA</asp:ListItem> + <asp:ListItem Value="RU">RUSSIAN FEDERATION</asp:ListItem> + <asp:ListItem Value="RW">RWANDA</asp:ListItem> + <asp:ListItem Value="SH">SAINT HELENA </asp:ListItem> + <asp:ListItem Value="KN">SAINT KITTS AND NEVIS</asp:ListItem> + <asp:ListItem Value="LC">SAINT LUCIA</asp:ListItem> + <asp:ListItem Value="PM">SAINT PIERRE AND MIQUELON</asp:ListItem> + <asp:ListItem Value="VC">SAINT VINCENT AND THE GRENADINES</asp:ListItem> + <asp:ListItem Value="WS">SAMOA</asp:ListItem> + <asp:ListItem Value="SM">SAN MARINO</asp:ListItem> + <asp:ListItem Value="ST">SAO TOME AND PRINCIPE</asp:ListItem> + <asp:ListItem Value="SA">SAUDI ARABIA</asp:ListItem> + <asp:ListItem Value="SN">SENEGAL</asp:ListItem> + <asp:ListItem Value="RS">SERBIA</asp:ListItem> + <asp:ListItem Value="SC">SEYCHELLES</asp:ListItem> + <asp:ListItem Value="SL">SIERRA LEONE</asp:ListItem> + <asp:ListItem Value="SG">SINGAPORE</asp:ListItem> + <asp:ListItem Value="SK">SLOVAKIA</asp:ListItem> + <asp:ListItem Value="SI">SLOVENIA</asp:ListItem> + <asp:ListItem Value="SB">SOLOMON ISLANDS</asp:ListItem> + <asp:ListItem Value="SO">SOMALIA</asp:ListItem> + <asp:ListItem Value="ZA">SOUTH AFRICA</asp:ListItem> + <asp:ListItem Value="GS">SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS</asp:ListItem> + <asp:ListItem Value="ES">SPAIN</asp:ListItem> + <asp:ListItem Value="LK">SRI LANKA</asp:ListItem> + <asp:ListItem Value="SD">SUDAN</asp:ListItem> + <asp:ListItem Value="SR">SURINAME</asp:ListItem> + <asp:ListItem Value="SJ">SVALBARD AND JAN MAYEN</asp:ListItem> + <asp:ListItem Value="SZ">SWAZILAND</asp:ListItem> + <asp:ListItem Value="SE">SWEDEN</asp:ListItem> + <asp:ListItem Value="CH">SWITZERLAND</asp:ListItem> + <asp:ListItem Value="SY">SYRIAN ARAB REPUBLIC</asp:ListItem> + <asp:ListItem Value="TW">TAIWAN, PROVINCE OF CHINA</asp:ListItem> + <asp:ListItem Value="TJ">TAJIKISTAN</asp:ListItem> + <asp:ListItem Value="TZ">TANZANIA, UNITED REPUBLIC OF</asp:ListItem> + <asp:ListItem Value="TH">THAILAND</asp:ListItem> + <asp:ListItem Value="TL">TIMOR-LESTE</asp:ListItem> + <asp:ListItem Value="TG">TOGO</asp:ListItem> + <asp:ListItem Value="TK">TOKELAU</asp:ListItem> + <asp:ListItem Value="TO">TONGA</asp:ListItem> + <asp:ListItem Value="TT">TRINIDAD AND TOBAGO</asp:ListItem> + <asp:ListItem Value="TN">TUNISIA</asp:ListItem> + <asp:ListItem Value="TR">TURKEY</asp:ListItem> + <asp:ListItem Value="TM">TURKMENISTAN</asp:ListItem> + <asp:ListItem Value="TC">TURKS AND CAICOS ISLANDS</asp:ListItem> + <asp:ListItem Value="TV">TUVALU</asp:ListItem> + <asp:ListItem Value="UG">UGANDA</asp:ListItem> + <asp:ListItem Value="UA">UKRAINE</asp:ListItem> + <asp:ListItem Value="AE">UNITED ARAB EMIRATES</asp:ListItem> + <asp:ListItem Value="GB">UNITED KINGDOM</asp:ListItem> + <asp:ListItem Value="US">UNITED STATES</asp:ListItem> + <asp:ListItem Value="UM">UNITED STATES MINOR OUTLYING ISLANDS</asp:ListItem> + <asp:ListItem Value="UY">URUGUAY</asp:ListItem> + <asp:ListItem Value="UZ">UZBEKISTAN</asp:ListItem> + <asp:ListItem Value="VU">VANUATU</asp:ListItem> + <asp:ListItem Value="VE">VENEZUELA</asp:ListItem> + <asp:ListItem Value="VN">VIET NAM</asp:ListItem> + <asp:ListItem Value="VG">VIRGIN ISLANDS, BRITISH</asp:ListItem> + <asp:ListItem Value="VI">VIRGIN ISLANDS, U.S.</asp:ListItem> + <asp:ListItem Value="WF">WALLIS AND FUTUNA</asp:ListItem> + <asp:ListItem Value="EH">WESTERN SAHARA</asp:ListItem> + <asp:ListItem Value="YE">YEMEN</asp:ListItem> + <asp:ListItem Value="ZM">ZAMBIA</asp:ListItem> + <asp:ListItem Value="ZW">ZIMBABWE</asp:ListItem> + </asp:DropDownList> + </td> + </tr> + <tr runat="server" id="languageRow"> + <td> + Language + <asp:Label ID="languageRequiredLabel" runat="server" Text="*" Visible="False"></asp:Label> + </td> + <td> + <asp:DropDownList ID="languageDropdownList" runat="server"> + <asp:ListItem Value=""></asp:ListItem> + <asp:ListItem Value="EN">English</asp:ListItem> + <asp:ListItem Value="AB">Abkhazian</asp:ListItem> + <asp:ListItem Value="AA">Afar</asp:ListItem> + <asp:ListItem Value="AF">Afrikaans</asp:ListItem> + <asp:ListItem Value="SQ">Albanian</asp:ListItem> + <asp:ListItem Value="AM">Amharic</asp:ListItem> + <asp:ListItem Value="AR">Arabic</asp:ListItem> + <asp:ListItem Value="HY">Armenian</asp:ListItem> + <asp:ListItem Value="AS">Assamese</asp:ListItem> + <asp:ListItem Value="AY">Aymara</asp:ListItem> + <asp:ListItem Value="AZ">Azerbaijani</asp:ListItem> + <asp:ListItem Value="BA">Bashkir</asp:ListItem> + <asp:ListItem Value="EU">Basque</asp:ListItem> + <asp:ListItem Value="BN">Bengali</asp:ListItem> + <asp:ListItem Value="DZ">Bhutani</asp:ListItem> + <asp:ListItem Value="BH">Bihari</asp:ListItem> + <asp:ListItem Value="BI">Bislama</asp:ListItem> + <asp:ListItem Value="BR">Breton</asp:ListItem> + <asp:ListItem Value="BG">Bulgarian</asp:ListItem> + <asp:ListItem Value="MY">Burmese</asp:ListItem> + <asp:ListItem Value="BE">Byelorussian</asp:ListItem> + <asp:ListItem Value="KM">Cambodian</asp:ListItem> + <asp:ListItem Value="CA">Catalan</asp:ListItem> + <asp:ListItem Value="ZH">Chinese</asp:ListItem> + <asp:ListItem Value="CO">Corsican</asp:ListItem> + <asp:ListItem Value="HR">Croatian</asp:ListItem> + <asp:ListItem Value="CS">Czech</asp:ListItem> + <asp:ListItem Value="DA">Danish</asp:ListItem> + <asp:ListItem Value="NL">Dutch</asp:ListItem> + <asp:ListItem Value="EO">Esperanto</asp:ListItem> + <asp:ListItem Value="ET">Estonian</asp:ListItem> + <asp:ListItem Value="FO">Faeroese</asp:ListItem> + <asp:ListItem Value="FJ">Fiji</asp:ListItem> + <asp:ListItem Value="FI">Finnish</asp:ListItem> + <asp:ListItem Value="FR">French</asp:ListItem> + <asp:ListItem Value="FY">Frisian</asp:ListItem> + <asp:ListItem Value="GD">Gaelic</asp:ListItem> + <asp:ListItem Value="GL">Galician</asp:ListItem> + <asp:ListItem Value="KA">Georgian</asp:ListItem> + <asp:ListItem Value="DE">German</asp:ListItem> + <asp:ListItem Value="EL">Greek</asp:ListItem> + <asp:ListItem Value="KL">Greenlandic</asp:ListItem> + <asp:ListItem Value="GN">Guarani</asp:ListItem> + <asp:ListItem Value="GU">Gujarati</asp:ListItem> + <asp:ListItem Value="HA">Hausa</asp:ListItem> + <asp:ListItem Value="IW">Hebrew</asp:ListItem> + <asp:ListItem Value="HI">Hindi</asp:ListItem> + <asp:ListItem Value="HU">Hungarian</asp:ListItem> + <asp:ListItem Value="IS">Icelandic</asp:ListItem> + <asp:ListItem Value="IN">Indonesian</asp:ListItem> + <asp:ListItem Value="IA">Interlingua</asp:ListItem> + <asp:ListItem Value="IE">Interlingue</asp:ListItem> + <asp:ListItem Value="IK">Inupiak</asp:ListItem> + <asp:ListItem Value="GA">Irish</asp:ListItem> + <asp:ListItem Value="IT">Italian</asp:ListItem> + <asp:ListItem Value="JA">Japanese</asp:ListItem> + <asp:ListItem Value="JW">Javanese</asp:ListItem> + <asp:ListItem Value="KN">Kannada</asp:ListItem> + <asp:ListItem Value="KS">Kashmiri</asp:ListItem> + <asp:ListItem Value="KK">Kazakh</asp:ListItem> + <asp:ListItem Value="RW">Kinyarwanda</asp:ListItem> + <asp:ListItem Value="KY">Kirghiz</asp:ListItem> + <asp:ListItem Value="RN">Kirundi</asp:ListItem> + <asp:ListItem Value="KO">Korean</asp:ListItem> + <asp:ListItem Value="KU">Kurdish</asp:ListItem> + <asp:ListItem Value="LO">Laothian</asp:ListItem> + <asp:ListItem Value="LA">Latin</asp:ListItem> + <asp:ListItem Value="LV">Latvian</asp:ListItem> + <asp:ListItem Value="LN">Lingala</asp:ListItem> + <asp:ListItem Value="LT">Lithuanian</asp:ListItem> + <asp:ListItem Value="MK">Macedonian</asp:ListItem> + <asp:ListItem Value="MG">Malagasy</asp:ListItem> + <asp:ListItem Value="MS">Malay</asp:ListItem> + <asp:ListItem Value="ML">Malayalam</asp:ListItem> + <asp:ListItem Value="MT">Maltese</asp:ListItem> + <asp:ListItem Value="MI">Maori</asp:ListItem> + <asp:ListItem Value="MR">Marathi</asp:ListItem> + <asp:ListItem Value="MO">Moldavian</asp:ListItem> + <asp:ListItem Value="MN">Mongolian</asp:ListItem> + <asp:ListItem Value="NA">Nauru</asp:ListItem> + <asp:ListItem Value="NE">Nepali</asp:ListItem> + <asp:ListItem Value="NO">Norwegian</asp:ListItem> + <asp:ListItem Value="OC">Occitan</asp:ListItem> + <asp:ListItem Value="OR">Oriya</asp:ListItem> + <asp:ListItem Value="OM">Oromo</asp:ListItem> + <asp:ListItem Value="PS">Pashto</asp:ListItem> + <asp:ListItem Value="FA">Persian</asp:ListItem> + <asp:ListItem Value="PL">Polish</asp:ListItem> + <asp:ListItem Value="PT">Portuguese</asp:ListItem> + <asp:ListItem Value="PA">Punjabi</asp:ListItem> + <asp:ListItem Value="QU">Quechua</asp:ListItem> + <asp:ListItem Value="RM">Rhaeto-Romance</asp:ListItem> + <asp:ListItem Value="RO">Romanian</asp:ListItem> + <asp:ListItem Value="RU">Russian</asp:ListItem> + <asp:ListItem Value="SM">Samoan</asp:ListItem> + <asp:ListItem Value="SG">Sangro</asp:ListItem> + <asp:ListItem Value="SA">Sanskrit</asp:ListItem> + <asp:ListItem Value="SR">Serbian</asp:ListItem> + <asp:ListItem Value="SH">Serbo-Croatian</asp:ListItem> + <asp:ListItem Value="ST">Sesotho</asp:ListItem> + <asp:ListItem Value="TN">Setswana</asp:ListItem> + <asp:ListItem Value="SN">Shona</asp:ListItem> + <asp:ListItem Value="SD">Sindhi</asp:ListItem> + <asp:ListItem Value="SI">Singhalese</asp:ListItem> + <asp:ListItem Value="SS">Siswati</asp:ListItem> + <asp:ListItem Value="SK">Slovak</asp:ListItem> + <asp:ListItem Value="SL">Slovenian</asp:ListItem> + <asp:ListItem Value="SO">Somali</asp:ListItem> + <asp:ListItem Value="ES">Spanish</asp:ListItem> + <asp:ListItem Value="SU">Sudanese</asp:ListItem> + <asp:ListItem Value="SW">Swahili</asp:ListItem> + <asp:ListItem Value="SV">Swedish</asp:ListItem> + <asp:ListItem Value="TL">Tagalog</asp:ListItem> + <asp:ListItem Value="TG">Tajik</asp:ListItem> + <asp:ListItem Value="TA">Tamil</asp:ListItem> + <asp:ListItem Value="TT">Tatar</asp:ListItem> + <asp:ListItem Value="TE">Telugu</asp:ListItem> + <asp:ListItem Value="TH">Thai</asp:ListItem> + <asp:ListItem Value="BO">Tibetan</asp:ListItem> + <asp:ListItem Value="TI">Tigrinya</asp:ListItem> + <asp:ListItem Value="TO">Tonga</asp:ListItem> + <asp:ListItem Value="TS">Tsonga</asp:ListItem> + <asp:ListItem Value="TR">Turkish</asp:ListItem> + <asp:ListItem Value="TK">Turkmen</asp:ListItem> + <asp:ListItem Value="TW">Twi</asp:ListItem> + <asp:ListItem Value="UK">Ukrainian</asp:ListItem> + <asp:ListItem Value="UR">Urdu</asp:ListItem> + <asp:ListItem Value="UZ">Uzbek</asp:ListItem> + <asp:ListItem Value="VI">Vietnamese</asp:ListItem> + <asp:ListItem Value="VO">Volapuk</asp:ListItem> + <asp:ListItem Value="CY">Welsh</asp:ListItem> + <asp:ListItem Value="WO">Wolof</asp:ListItem> + <asp:ListItem Value="XH">Xhosa</asp:ListItem> + <asp:ListItem Value="JI">Yiddish</asp:ListItem> + <asp:ListItem Value="YO">Yoruba</asp:ListItem> + <asp:ListItem Value="ZU">Zulu</asp:ListItem> + </asp:DropDownList> + </td> + </tr> + <tr runat="server" id="timezoneRow"> + <td> + Timezone + <asp:Label ID="timezoneRequiredLabel" runat="server" Text="*" Visible="False"></asp:Label> + </td> + <td> + <asp:DropDownList runat="server" ID="timezoneDropdownList"> + <asp:ListItem Value=""></asp:ListItem> + <asp:ListItem Value="Europe/London">Europe/London</asp:ListItem> + <asp:ListItem Value="Africa/Abidjan">Africa/Abidjan</asp:ListItem> + <asp:ListItem Value="Africa/Accra">Africa/Accra</asp:ListItem> + <asp:ListItem Value="Africa/Addis_Ababa">Africa/Addis_Ababa</asp:ListItem> + <asp:ListItem Value="Africa/Algiers">Africa/Algiers</asp:ListItem> + <asp:ListItem Value="Africa/Asmera">Africa/Asmera</asp:ListItem> + <asp:ListItem Value="Africa/Bamako">Africa/Bamako</asp:ListItem> + <asp:ListItem Value="Africa/Bangui">Africa/Bangui</asp:ListItem> + <asp:ListItem Value="Africa/Banjul">Africa/Banjul</asp:ListItem> + <asp:ListItem Value="Africa/Bissau">Africa/Bissau</asp:ListItem> + <asp:ListItem Value="Africa/Blantyre">Africa/Blantyre</asp:ListItem> + <asp:ListItem Value="Africa/Brazzaville">Africa/Brazzaville</asp:ListItem> + <asp:ListItem Value="Africa/Bujumbura">Africa/Bujumbura</asp:ListItem> + <asp:ListItem Value="Africa/Cairo">Africa/Cairo</asp:ListItem> + <asp:ListItem Value="Africa/Casablanca">Africa/Casablanca</asp:ListItem> + <asp:ListItem Value="Africa/Ceuta">Africa/Ceuta</asp:ListItem> + <asp:ListItem Value="Africa/Conakry">Africa/Conakry</asp:ListItem> + <asp:ListItem Value="Africa/Dakar">Africa/Dakar</asp:ListItem> + <asp:ListItem Value="Africa/Dar_es_Salaam">Africa/Dar_es_Salaam</asp:ListItem> + <asp:ListItem Value="Africa/Djibouti">Africa/Djibouti</asp:ListItem> + <asp:ListItem Value="Africa/Douala">Africa/Douala</asp:ListItem> + <asp:ListItem Value="Africa/El_Aaiun">Africa/El_Aaiun</asp:ListItem> + <asp:ListItem Value="Africa/Freetown">Africa/Freetown</asp:ListItem> + <asp:ListItem Value="Africa/Gaborone">Africa/Gaborone</asp:ListItem> + <asp:ListItem Value="Africa/Harare">Africa/Harare</asp:ListItem> + <asp:ListItem Value="Africa/Johannesburg">Africa/Johannesburg</asp:ListItem> + <asp:ListItem Value="Africa/Kampala">Africa/Kampala</asp:ListItem> + <asp:ListItem Value="Africa/Khartoum">Africa/Khartoum</asp:ListItem> + <asp:ListItem Value="Africa/Kigali">Africa/Kigali</asp:ListItem> + <asp:ListItem Value="Africa/Kinshasa">Africa/Kinshasa</asp:ListItem> + <asp:ListItem Value="Africa/Lagos">Africa/Lagos</asp:ListItem> + <asp:ListItem Value="Africa/Libreville">Africa/Libreville</asp:ListItem> + <asp:ListItem Value="Africa/Lome">Africa/Lome</asp:ListItem> + <asp:ListItem Value="Africa/Luanda">Africa/Luanda</asp:ListItem> + <asp:ListItem Value="Africa/Lubumbashi">Africa/Lubumbashi</asp:ListItem> + <asp:ListItem Value="Africa/Lusaka">Africa/Lusaka</asp:ListItem> + <asp:ListItem Value="Africa/Malabo">Africa/Malabo</asp:ListItem> + <asp:ListItem Value="Africa/Maputo">Africa/Maputo</asp:ListItem> + <asp:ListItem Value="Africa/Maseru">Africa/Maseru</asp:ListItem> + <asp:ListItem Value="Africa/Mbabane">Africa/Mbabane</asp:ListItem> + <asp:ListItem Value="Africa/Mogadishu">Africa/Mogadishu</asp:ListItem> + <asp:ListItem Value="Africa/Monrovia">Africa/Monrovia</asp:ListItem> + <asp:ListItem Value="Africa/Nairobi">Africa/Nairobi</asp:ListItem> + <asp:ListItem Value="Africa/Ndjamena">Africa/Ndjamena</asp:ListItem> + <asp:ListItem Value="Africa/Niamey">Africa/Niamey</asp:ListItem> + <asp:ListItem Value="Africa/Nouakchott">Africa/Nouakchott</asp:ListItem> + <asp:ListItem Value="Africa/Ouagadougou">Africa/Ouagadougou</asp:ListItem> + <asp:ListItem Value="Africa/Porto">Africa/Porto</asp:ListItem> + <asp:ListItem Value="Africa/Sao_Tome">Africa/Sao_Tome</asp:ListItem> + <asp:ListItem Value="Africa/Tripoli">Africa/Tripoli</asp:ListItem> + <asp:ListItem Value="Africa/Tunis">Africa/Tunis</asp:ListItem> + <asp:ListItem Value="Africa/Windhoek">Africa/Windhoek</asp:ListItem> + <asp:ListItem Value="America/Adak">America/Adak</asp:ListItem> + <asp:ListItem Value="America/Anchorage">America/Anchorage</asp:ListItem> + <asp:ListItem Value="America/Anguilla">America/Anguilla</asp:ListItem> + <asp:ListItem Value="America/Antigua">America/Antigua</asp:ListItem> + <asp:ListItem Value="America/Araguaina">America/Araguaina</asp:ListItem> + <asp:ListItem Value="America/Argentina/Buenos_Aires">America/Argentina/Buenos_Aires</asp:ListItem> + <asp:ListItem Value="America/Argentina/Catamarca">America/Argentina/Catamarca</asp:ListItem> + <asp:ListItem Value="America/Argentina/Cordoba">America/Argentina/Cordoba</asp:ListItem> + <asp:ListItem Value="America/Argentina/Jujuy">America/Argentina/Jujuy</asp:ListItem> + <asp:ListItem Value="America/Argentina/La_Rioja">America/Argentina/La_Rioja</asp:ListItem> + <asp:ListItem Value="America/Argentina/Mendoza">America/Argentina/Mendoza</asp:ListItem> + <asp:ListItem Value="America/Argentina/Rio_Gallegos">America/Argentina/Rio_Gallegos</asp:ListItem> + <asp:ListItem Value="America/Argentina/San_Juan">America/Argentina/San_Juan</asp:ListItem> + <asp:ListItem Value="America/Argentina/Tucuman">America/Argentina/Tucuman</asp:ListItem> + <asp:ListItem Value="America/Argentina/Ushuaia">America/Argentina/Ushuaia</asp:ListItem> + <asp:ListItem Value="America/Aruba">America/Aruba</asp:ListItem> + <asp:ListItem Value="America/Asuncion">America/Asuncion</asp:ListItem> + <asp:ListItem Value="America/Bahia">America/Bahia</asp:ListItem> + <asp:ListItem Value="America/Barbados">America/Barbados</asp:ListItem> + <asp:ListItem Value="America/Belem">America/Belem</asp:ListItem> + <asp:ListItem Value="America/Belize">America/Belize</asp:ListItem> + <asp:ListItem Value="America/Boa_Vista">America/Boa_Vista</asp:ListItem> + <asp:ListItem Value="America/Bogota">America/Bogota</asp:ListItem> + <asp:ListItem Value="America/Boise">America/Boise</asp:ListItem> + <asp:ListItem Value="America/Cambridge_Bay">America/Cambridge_Bay</asp:ListItem> + <asp:ListItem Value="America/Campo_Grande">America/Campo_Grande</asp:ListItem> + <asp:ListItem Value="America/Cancun">America/Cancun</asp:ListItem> + <asp:ListItem Value="America/Caracas">America/Caracas</asp:ListItem> + <asp:ListItem Value="America/Cayenne">America/Cayenne</asp:ListItem> + <asp:ListItem Value="America/Cayman">America/Cayman</asp:ListItem> + <asp:ListItem Value="America/Chicago">America/Chicago</asp:ListItem> + <asp:ListItem Value="America/Chihuahua">America/Chihuahua</asp:ListItem> + <asp:ListItem Value="America/Coral_Harbour">America/Coral_Harbour</asp:ListItem> + <asp:ListItem Value="America/Costa_Rica">America/Costa_Rica</asp:ListItem> + <asp:ListItem Value="America/Cuiaba">America/Cuiaba</asp:ListItem> + <asp:ListItem Value="America/Curacao">America/Curacao</asp:ListItem> + <asp:ListItem Value="America/Danmarkshavn">America/Danmarkshavn</asp:ListItem> + <asp:ListItem Value="America/Dawson">America/Dawson</asp:ListItem> + <asp:ListItem Value="America/Dawson_Creek">America/Dawson_Creek</asp:ListItem> + <asp:ListItem Value="America/Denver">America/Denver</asp:ListItem> + <asp:ListItem Value="America/Detroit">America/Detroit</asp:ListItem> + <asp:ListItem Value="America/Dominica">America/Dominica</asp:ListItem> + <asp:ListItem Value="America/Edmonton">America/Edmonton</asp:ListItem> + <asp:ListItem Value="America/Eirunepe">America/Eirunepe</asp:ListItem> + <asp:ListItem Value="America/El_Salvador">America/El_Salvador</asp:ListItem> + <asp:ListItem Value="America/Fortaleza">America/Fortaleza</asp:ListItem> + <asp:ListItem Value="America/Glace_Bay">America/Glace_Bay</asp:ListItem> + <asp:ListItem Value="America/Godthab">America/Godthab</asp:ListItem> + <asp:ListItem Value="America/Goose_Bay">America/Goose_Bay</asp:ListItem> + <asp:ListItem Value="America/Grand_Turk">America/Grand_Turk</asp:ListItem> + <asp:ListItem Value="America/Grenada">America/Grenada</asp:ListItem> + <asp:ListItem Value="America/Guadeloupe">America/Guadeloupe</asp:ListItem> + <asp:ListItem Value="America/Guatemala">America/Guatemala</asp:ListItem> + <asp:ListItem Value="America/Guayaquil">America/Guayaquil</asp:ListItem> + <asp:ListItem Value="America/Guyana">America/Guyana</asp:ListItem> + <asp:ListItem Value="America/Halifax">America/Halifax</asp:ListItem> + <asp:ListItem Value="America/Havana">America/Havana</asp:ListItem> + <asp:ListItem Value="America/Hermosillo">America/Hermosillo</asp:ListItem> + <asp:ListItem Value="America/Indiana/Indianapolis">America/Indiana/Indianapolis</asp:ListItem> + <asp:ListItem Value="America/Indiana/Knox">America/Indiana/Knox</asp:ListItem> + <asp:ListItem Value="America/Indiana/Marengo">America/Indiana/Marengo</asp:ListItem> + <asp:ListItem Value="America/Indiana/Petersburg">America/Indiana/Petersburg</asp:ListItem> + <asp:ListItem Value="America/Indiana/Vevay">America/Indiana/Vevay</asp:ListItem> + <asp:ListItem Value="America/Indiana/Vincennes">America/Indiana/Vincennes</asp:ListItem> + <asp:ListItem Value="America/Inuvik">America/Inuvik</asp:ListItem> + <asp:ListItem Value="America/Iqaluit">America/Iqaluit</asp:ListItem> + <asp:ListItem Value="America/Jamaica">America/Jamaica</asp:ListItem> + <asp:ListItem Value="America/Juneau">America/Juneau</asp:ListItem> + <asp:ListItem Value="America/Kentucky/Louisville">America/Kentucky/Louisville</asp:ListItem> + <asp:ListItem Value="America/Kentucky/Monticello">America/Kentucky/Monticello</asp:ListItem> + <asp:ListItem Value="America/La_Paz">America/La_Paz</asp:ListItem> + <asp:ListItem Value="America/Lima">America/Lima</asp:ListItem> + <asp:ListItem Value="America/Los_Angeles">America/Los_Angeles</asp:ListItem> + <asp:ListItem Value="America/Maceio">America/Maceio</asp:ListItem> + <asp:ListItem Value="America/Managua">America/Managua</asp:ListItem> + <asp:ListItem Value="America/Manaus">America/Manaus</asp:ListItem> + <asp:ListItem Value="America/Martinique">America/Martinique</asp:ListItem> + <asp:ListItem Value="America/Mazatlan">America/Mazatlan</asp:ListItem> + <asp:ListItem Value="America/Menominee">America/Menominee</asp:ListItem> + <asp:ListItem Value="America/Merida">America/Merida</asp:ListItem> + <asp:ListItem Value="America/Mexico_City">America/Mexico_City</asp:ListItem> + <asp:ListItem Value="America/Miquelon">America/Miquelon</asp:ListItem> + <asp:ListItem Value="America/Moncton">America/Moncton</asp:ListItem> + <asp:ListItem Value="America/Monterrey">America/Monterrey</asp:ListItem> + <asp:ListItem Value="America/Montevideo">America/Montevideo</asp:ListItem> + <asp:ListItem Value="America/Montreal">America/Montreal</asp:ListItem> + <asp:ListItem Value="America/Montserrat">America/Montserrat</asp:ListItem> + <asp:ListItem Value="America/Nassau">America/Nassau</asp:ListItem> + <asp:ListItem Value="America/New_York">America/New_York</asp:ListItem> + <asp:ListItem Value="America/Nipigon">America/Nipigon</asp:ListItem> + <asp:ListItem Value="America/Nome">America/Nome</asp:ListItem> + <asp:ListItem Value="America/Noronha">America/Noronha</asp:ListItem> + <asp:ListItem Value="America/North_Dakota/Center">America/North_Dakota/Center</asp:ListItem> + <asp:ListItem Value="America/Panama">America/Panama</asp:ListItem> + <asp:ListItem Value="America/Pangnirtung">America/Pangnirtung</asp:ListItem> + <asp:ListItem Value="America/Paramaribo">America/Paramaribo</asp:ListItem> + <asp:ListItem Value="America/Phoenix">America/Phoenix</asp:ListItem> + <asp:ListItem Value="America/Port">America/Port</asp:ListItem> + <asp:ListItem Value="America/Port_of_Spain">America/Port_of_Spain</asp:ListItem> + <asp:ListItem Value="America/Porto_Velho">America/Porto_Velho</asp:ListItem> + <asp:ListItem Value="America/Puerto_Rico">America/Puerto_Rico</asp:ListItem> + <asp:ListItem Value="America/Rainy_River">America/Rainy_River</asp:ListItem> + <asp:ListItem Value="America/Rankin_Inlet">America/Rankin_Inlet</asp:ListItem> + <asp:ListItem Value="America/Recife">America/Recife</asp:ListItem> + <asp:ListItem Value="America/Regina">America/Regina</asp:ListItem> + <asp:ListItem Value="America/Rio_Branco">America/Rio_Branco</asp:ListItem> + <asp:ListItem Value="America/Santiago">America/Santiago</asp:ListItem> + <asp:ListItem Value="America/Santo_Domingo">America/Santo_Domingo</asp:ListItem> + <asp:ListItem Value="America/Sao_Paulo">America/Sao_Paulo</asp:ListItem> + <asp:ListItem Value="America/Scoresbysund">America/Scoresbysund</asp:ListItem> + <asp:ListItem Value="America/Shiprock">America/Shiprock</asp:ListItem> + <asp:ListItem Value="America/St_Johns">America/St_Johns</asp:ListItem> + <asp:ListItem Value="America/St_Kitts">America/St_Kitts</asp:ListItem> + <asp:ListItem Value="America/St_Lucia">America/St_Lucia</asp:ListItem> + <asp:ListItem Value="America/St_Thomas">America/St_Thomas</asp:ListItem> + <asp:ListItem Value="America/St_Vincent">America/St_Vincent</asp:ListItem> + <asp:ListItem Value="America/Swift_Current">America/Swift_Current</asp:ListItem> + <asp:ListItem Value="America/Tegucigalpa">America/Tegucigalpa</asp:ListItem> + <asp:ListItem Value="America/Thule">America/Thule</asp:ListItem> + <asp:ListItem Value="America/Thunder_Bay">America/Thunder_Bay</asp:ListItem> + <asp:ListItem Value="America/Tijuana">America/Tijuana</asp:ListItem> + <asp:ListItem Value="America/Toronto">America/Toronto</asp:ListItem> + <asp:ListItem Value="America/Tortola">America/Tortola</asp:ListItem> + <asp:ListItem Value="America/Vancouver">America/Vancouver</asp:ListItem> + <asp:ListItem Value="America/Whitehorse">America/Whitehorse</asp:ListItem> + <asp:ListItem Value="America/Winnipeg">America/Winnipeg</asp:ListItem> + <asp:ListItem Value="America/Yakutat">America/Yakutat</asp:ListItem> + <asp:ListItem Value="America/Yellowknife">America/Yellowknife</asp:ListItem> + <asp:ListItem Value="Antarctica/Casey">Antarctica/Casey</asp:ListItem> + <asp:ListItem Value="Antarctica/Davis">Antarctica/Davis</asp:ListItem> + <asp:ListItem Value="Antarctica/DumontDUrville">Antarctica/DumontDUrville</asp:ListItem> + <asp:ListItem Value="Antarctica/Mawson">Antarctica/Mawson</asp:ListItem> + <asp:ListItem Value="Antarctica/McMurdo">Antarctica/McMurdo</asp:ListItem> + <asp:ListItem Value="Antarctica/Palmer">Antarctica/Palmer</asp:ListItem> + <asp:ListItem Value="Antarctica/Rothera">Antarctica/Rothera</asp:ListItem> + <asp:ListItem Value="Antarctica/South_Pole">Antarctica/South_Pole</asp:ListItem> + <asp:ListItem Value="Antarctica/Syowa">Antarctica/Syowa</asp:ListItem> + <asp:ListItem Value="Antarctica/Vostok">Antarctica/Vostok</asp:ListItem> + <asp:ListItem Value="Arctic/Longyearbyen">Arctic/Longyearbyen</asp:ListItem> + <asp:ListItem Value="Asia/Aden">Asia/Aden</asp:ListItem> + <asp:ListItem Value="Asia/Almaty">Asia/Almaty</asp:ListItem> + <asp:ListItem Value="Asia/Amman">Asia/Amman</asp:ListItem> + <asp:ListItem Value="Asia/Anadyr">Asia/Anadyr</asp:ListItem> + <asp:ListItem Value="Asia/Aqtau">Asia/Aqtau</asp:ListItem> + <asp:ListItem Value="Asia/Aqtobe">Asia/Aqtobe</asp:ListItem> + <asp:ListItem Value="Asia/Ashgabat">Asia/Ashgabat</asp:ListItem> + <asp:ListItem Value="Asia/Baghdad">Asia/Baghdad</asp:ListItem> + <asp:ListItem Value="Asia/Bahrain">Asia/Bahrain</asp:ListItem> + <asp:ListItem Value="Asia/Baku">Asia/Baku</asp:ListItem> + <asp:ListItem Value="Asia/Bangkok">Asia/Bangkok</asp:ListItem> + <asp:ListItem Value="Asia/Beirut">Asia/Beirut</asp:ListItem> + <asp:ListItem Value="Asia/Bishkek">Asia/Bishkek</asp:ListItem> + <asp:ListItem Value="Asia/Brunei">Asia/Brunei</asp:ListItem> + <asp:ListItem Value="Asia/Calcutta">Asia/Calcutta</asp:ListItem> + <asp:ListItem Value="Asia/Choibalsan">Asia/Choibalsan</asp:ListItem> + <asp:ListItem Value="Asia/Chongqing">Asia/Chongqing</asp:ListItem> + <asp:ListItem Value="Asia/Colombo">Asia/Colombo</asp:ListItem> + <asp:ListItem Value="Asia/Damascus">Asia/Damascus</asp:ListItem> + <asp:ListItem Value="Asia/Dhaka">Asia/Dhaka</asp:ListItem> + <asp:ListItem Value="Asia/Dili">Asia/Dili</asp:ListItem> + <asp:ListItem Value="Asia/Dubai">Asia/Dubai</asp:ListItem> + <asp:ListItem Value="Asia/Dushanbe">Asia/Dushanbe</asp:ListItem> + <asp:ListItem Value="Asia/Gaza">Asia/Gaza</asp:ListItem> + <asp:ListItem Value="Asia/Harbin">Asia/Harbin</asp:ListItem> + <asp:ListItem Value="Asia/Hong_Kong">Asia/Hong_Kong</asp:ListItem> + <asp:ListItem Value="Asia/Hovd">Asia/Hovd</asp:ListItem> + <asp:ListItem Value="Asia/Irkutsk">Asia/Irkutsk</asp:ListItem> + <asp:ListItem Value="Asia/Jakarta">Asia/Jakarta</asp:ListItem> + <asp:ListItem Value="Asia/Jayapura">Asia/Jayapura</asp:ListItem> + <asp:ListItem Value="Asia/Jerusalem">Asia/Jerusalem</asp:ListItem> + <asp:ListItem Value="Asia/Kabul">Asia/Kabul</asp:ListItem> + <asp:ListItem Value="Asia/Kamchatka">Asia/Kamchatka</asp:ListItem> + <asp:ListItem Value="Asia/Karachi">Asia/Karachi</asp:ListItem> + <asp:ListItem Value="Asia/Kashgar">Asia/Kashgar</asp:ListItem> + <asp:ListItem Value="Asia/Katmandu">Asia/Katmandu</asp:ListItem> + <asp:ListItem Value="Asia/Krasnoyarsk">Asia/Krasnoyarsk</asp:ListItem> + <asp:ListItem Value="Asia/Kuala_Lumpur">Asia/Kuala_Lumpur</asp:ListItem> + <asp:ListItem Value="Asia/Kuching">Asia/Kuching</asp:ListItem> + <asp:ListItem Value="Asia/Kuwait">Asia/Kuwait</asp:ListItem> + <asp:ListItem Value="Asia/Macau">Asia/Macau</asp:ListItem> + <asp:ListItem Value="Asia/Magadan">Asia/Magadan</asp:ListItem> + <asp:ListItem Value="Asia/Makassar">Asia/Makassar</asp:ListItem> + <asp:ListItem Value="Asia/Manila">Asia/Manila</asp:ListItem> + <asp:ListItem Value="Asia/Muscat">Asia/Muscat</asp:ListItem> + <asp:ListItem Value="Asia/Nicosia">Asia/Nicosia</asp:ListItem> + <asp:ListItem Value="Asia/Novosibirsk">Asia/Novosibirsk</asp:ListItem> + <asp:ListItem Value="Asia/Omsk">Asia/Omsk</asp:ListItem> + <asp:ListItem Value="Asia/Oral">Asia/Oral</asp:ListItem> + <asp:ListItem Value="Asia/Phnom_Penh">Asia/Phnom_Penh</asp:ListItem> + <asp:ListItem Value="Asia/Pontianak">Asia/Pontianak</asp:ListItem> + <asp:ListItem Value="Asia/Pyongyang">Asia/Pyongyang</asp:ListItem> + <asp:ListItem Value="Asia/Qatar">Asia/Qatar</asp:ListItem> + <asp:ListItem Value="Asia/Qyzylorda">Asia/Qyzylorda</asp:ListItem> + <asp:ListItem Value="Asia/Rangoon">Asia/Rangoon</asp:ListItem> + <asp:ListItem Value="Asia/Riyadh">Asia/Riyadh</asp:ListItem> + <asp:ListItem Value="Asia/Saigon">Asia/Saigon</asp:ListItem> + <asp:ListItem Value="Asia/Sakhalin">Asia/Sakhalin</asp:ListItem> + <asp:ListItem Value="Asia/Samarkand">Asia/Samarkand</asp:ListItem> + <asp:ListItem Value="Asia/Seoul">Asia/Seoul</asp:ListItem> + <asp:ListItem Value="Asia/Shanghai">Asia/Shanghai</asp:ListItem> + <asp:ListItem Value="Asia/Singapore">Asia/Singapore</asp:ListItem> + <asp:ListItem Value="Asia/Taipei">Asia/Taipei</asp:ListItem> + <asp:ListItem Value="Asia/Tashkent">Asia/Tashkent</asp:ListItem> + <asp:ListItem Value="Asia/Tbilisi">Asia/Tbilisi</asp:ListItem> + <asp:ListItem Value="Asia/Tehran">Asia/Tehran</asp:ListItem> + <asp:ListItem Value="Asia/Thimphu">Asia/Thimphu</asp:ListItem> + <asp:ListItem Value="Asia/Tokyo">Asia/Tokyo</asp:ListItem> + <asp:ListItem Value="Asia/Ulaanbaatar">Asia/Ulaanbaatar</asp:ListItem> + <asp:ListItem Value="Asia/Urumqi">Asia/Urumqi</asp:ListItem> + <asp:ListItem Value="Asia/Vientiane">Asia/Vientiane</asp:ListItem> + <asp:ListItem Value="Asia/Vladivostok">Asia/Vladivostok</asp:ListItem> + <asp:ListItem Value="Asia/Yakutsk">Asia/Yakutsk</asp:ListItem> + <asp:ListItem Value="Asia/Yekaterinburg">Asia/Yekaterinburg</asp:ListItem> + <asp:ListItem Value="Asia/Yerevan">Asia/Yerevan</asp:ListItem> + <asp:ListItem Value="Atlantic/Azores">Atlantic/Azores</asp:ListItem> + <asp:ListItem Value="Atlantic/Bermuda">Atlantic/Bermuda</asp:ListItem> + <asp:ListItem Value="Atlantic/Canary">Atlantic/Canary</asp:ListItem> + <asp:ListItem Value="Atlantic/Cape_Verde">Atlantic/Cape_Verde</asp:ListItem> + <asp:ListItem Value="Atlantic/Faeroe">Atlantic/Faeroe</asp:ListItem> + <asp:ListItem Value="Atlantic/Jan_Mayen">Atlantic/Jan_Mayen</asp:ListItem> + <asp:ListItem Value="Atlantic/Madeira">Atlantic/Madeira</asp:ListItem> + <asp:ListItem Value="Atlantic/Reykjavik">Atlantic/Reykjavik</asp:ListItem> + <asp:ListItem Value="Atlantic/South_Georgia">Atlantic/South_Georgia</asp:ListItem> + <asp:ListItem Value="Atlantic/St_Helena">Atlantic/St_Helena</asp:ListItem> + <asp:ListItem Value="Atlantic/Stanley">Atlantic/Stanley</asp:ListItem> + <asp:ListItem Value="Australia/Adelaide">Australia/Adelaide</asp:ListItem> + <asp:ListItem Value="Australia/Brisbane">Australia/Brisbane</asp:ListItem> + <asp:ListItem Value="Australia/Broken_Hill">Australia/Broken_Hill</asp:ListItem> + <asp:ListItem Value="Australia/Currie">Australia/Currie</asp:ListItem> + <asp:ListItem Value="Australia/Darwin">Australia/Darwin</asp:ListItem> + <asp:ListItem Value="Australia/Hobart">Australia/Hobart</asp:ListItem> + <asp:ListItem Value="Australia/Lindeman">Australia/Lindeman</asp:ListItem> + <asp:ListItem Value="Australia/Lord_Howe">Australia/Lord_Howe</asp:ListItem> + <asp:ListItem Value="Australia/Melbourne">Australia/Melbourne</asp:ListItem> + <asp:ListItem Value="Australia/Perth">Australia/Perth</asp:ListItem> + <asp:ListItem Value="Australia/Sydney">Australia/Sydney</asp:ListItem> + <asp:ListItem Value="Europe/Amsterdam">Europe/Amsterdam</asp:ListItem> + <asp:ListItem Value="Europe/Andorra">Europe/Andorra</asp:ListItem> + <asp:ListItem Value="Europe/Athens">Europe/Athens</asp:ListItem> + <asp:ListItem Value="Europe/Belgrade">Europe/Belgrade</asp:ListItem> + <asp:ListItem Value="Europe/Berlin">Europe/Berlin</asp:ListItem> + <asp:ListItem Value="Europe/Bratislava">Europe/Bratislava</asp:ListItem> + <asp:ListItem Value="Europe/Brussels">Europe/Brussels</asp:ListItem> + <asp:ListItem Value="Europe/Bucharest">Europe/Bucharest</asp:ListItem> + <asp:ListItem Value="Europe/Budapest">Europe/Budapest</asp:ListItem> + <asp:ListItem Value="Europe/Chisinau">Europe/Chisinau</asp:ListItem> + <asp:ListItem Value="Europe/Copenhagen">Europe/Copenhagen</asp:ListItem> + <asp:ListItem Value="Europe/Dublin">Europe/Dublin</asp:ListItem> + <asp:ListItem Value="Europe/Gibraltar">Europe/Gibraltar</asp:ListItem> + <asp:ListItem Value="Europe/Helsinki">Europe/Helsinki</asp:ListItem> + <asp:ListItem Value="Europe/Istanbul">Europe/Istanbul</asp:ListItem> + <asp:ListItem Value="Europe/Kaliningrad">Europe/Kaliningrad</asp:ListItem> + <asp:ListItem Value="Europe/Kiev">Europe/Kiev</asp:ListItem> + <asp:ListItem Value="Europe/Lisbon">Europe/Lisbon</asp:ListItem> + <asp:ListItem Value="Europe/Ljubljana">Europe/Ljubljana</asp:ListItem> + <asp:ListItem Value="Europe/Luxembourg">Europe/Luxembourg</asp:ListItem> + <asp:ListItem Value="Europe/Madrid">Europe/Madrid</asp:ListItem> + <asp:ListItem Value="Europe/Malta">Europe/Malta</asp:ListItem> + <asp:ListItem Value="Europe/Mariehamn">Europe/Mariehamn</asp:ListItem> + <asp:ListItem Value="Europe/Minsk">Europe/Minsk</asp:ListItem> + <asp:ListItem Value="Europe/Monaco">Europe/Monaco</asp:ListItem> + <asp:ListItem Value="Europe/Moscow">Europe/Moscow</asp:ListItem> + <asp:ListItem Value="Europe/Oslo">Europe/Oslo</asp:ListItem> + <asp:ListItem Value="Europe/Paris">Europe/Paris</asp:ListItem> + <asp:ListItem Value="Europe/Prague">Europe/Prague</asp:ListItem> + <asp:ListItem Value="Europe/Riga">Europe/Riga</asp:ListItem> + <asp:ListItem Value="Europe/Rome">Europe/Rome</asp:ListItem> + <asp:ListItem Value="Europe/Samara">Europe/Samara</asp:ListItem> + <asp:ListItem Value="Europe/San_Marino">Europe/San_Marino</asp:ListItem> + <asp:ListItem Value="Europe/Sarajevo">Europe/Sarajevo</asp:ListItem> + <asp:ListItem Value="Europe/Simferopol">Europe/Simferopol</asp:ListItem> + <asp:ListItem Value="Europe/Skopje">Europe/Skopje</asp:ListItem> + <asp:ListItem Value="Europe/Sofia">Europe/Sofia</asp:ListItem> + <asp:ListItem Value="Europe/Stockholm">Europe/Stockholm</asp:ListItem> + <asp:ListItem Value="Europe/Tallinn">Europe/Tallinn</asp:ListItem> + <asp:ListItem Value="Europe/Tirane">Europe/Tirane</asp:ListItem> + <asp:ListItem Value="Europe/Uzhgorod">Europe/Uzhgorod</asp:ListItem> + <asp:ListItem Value="Europe/Vaduz">Europe/Vaduz</asp:ListItem> + <asp:ListItem Value="Europe/Vatican">Europe/Vatican</asp:ListItem> + <asp:ListItem Value="Europe/Vienna">Europe/Vienna</asp:ListItem> + <asp:ListItem Value="Europe/Vilnius">Europe/Vilnius</asp:ListItem> + <asp:ListItem Value="Europe/Warsaw">Europe/Warsaw</asp:ListItem> + <asp:ListItem Value="Europe/Zagreb">Europe/Zagreb</asp:ListItem> + <asp:ListItem Value="Europe/Zaporozhye">Europe/Zaporozhye</asp:ListItem> + <asp:ListItem Value="Europe/Zurich">Europe/Zurich</asp:ListItem> + <asp:ListItem Value="Indian/Antananarivo">Indian/Antananarivo</asp:ListItem> + <asp:ListItem Value="Indian/Chagos">Indian/Chagos</asp:ListItem> + <asp:ListItem Value="Indian/Christmas">Indian/Christmas</asp:ListItem> + <asp:ListItem Value="Indian/Cocos">Indian/Cocos</asp:ListItem> + <asp:ListItem Value="Indian/Comoro">Indian/Comoro</asp:ListItem> + <asp:ListItem Value="Indian/Kerguelen">Indian/Kerguelen</asp:ListItem> + <asp:ListItem Value="Indian/Mahe">Indian/Mahe</asp:ListItem> + <asp:ListItem Value="Indian/Maldives">Indian/Maldives</asp:ListItem> + <asp:ListItem Value="Indian/Mauritius">Indian/Mauritius</asp:ListItem> + <asp:ListItem Value="Indian/Mayotte">Indian/Mayotte</asp:ListItem> + <asp:ListItem Value="Indian/Reunion">Indian/Reunion</asp:ListItem> + <asp:ListItem Value="Pacific/Apia">Pacific/Apia</asp:ListItem> + <asp:ListItem Value="Pacific/Auckland">Pacific/Auckland</asp:ListItem> + <asp:ListItem Value="Pacific/Chatham">Pacific/Chatham</asp:ListItem> + <asp:ListItem Value="Pacific/Easter">Pacific/Easter</asp:ListItem> + <asp:ListItem Value="Pacific/Efate">Pacific/Efate</asp:ListItem> + <asp:ListItem Value="Pacific/Enderbury">Pacific/Enderbury</asp:ListItem> + <asp:ListItem Value="Pacific/Fakaofo">Pacific/Fakaofo</asp:ListItem> + <asp:ListItem Value="Pacific/Fiji">Pacific/Fiji</asp:ListItem> + <asp:ListItem Value="Pacific/Funafuti">Pacific/Funafuti</asp:ListItem> + <asp:ListItem Value="Pacific/Galapagos">Pacific/Galapagos</asp:ListItem> + <asp:ListItem Value="Pacific/Gambier">Pacific/Gambier</asp:ListItem> + <asp:ListItem Value="Pacific/Guadalcanal">Pacific/Guadalcanal</asp:ListItem> + <asp:ListItem Value="Pacific/Guam">Pacific/Guam</asp:ListItem> + <asp:ListItem Value="Pacific/Honolulu">Pacific/Honolulu</asp:ListItem> + <asp:ListItem Value="Pacific/Johnston">Pacific/Johnston</asp:ListItem> + <asp:ListItem Value="Pacific/Kiritimati">Pacific/Kiritimati</asp:ListItem> + <asp:ListItem Value="Pacific/Kosrae">Pacific/Kosrae</asp:ListItem> + <asp:ListItem Value="Pacific/Kwajalein">Pacific/Kwajalein</asp:ListItem> + <asp:ListItem Value="Pacific/Majuro">Pacific/Majuro</asp:ListItem> + <asp:ListItem Value="Pacific/Marquesas">Pacific/Marquesas</asp:ListItem> + <asp:ListItem Value="Pacific/Midway">Pacific/Midway</asp:ListItem> + <asp:ListItem Value="Pacific/Nauru">Pacific/Nauru</asp:ListItem> + <asp:ListItem Value="Pacific/Niue">Pacific/Niue</asp:ListItem> + <asp:ListItem Value="Pacific/Norfolk">Pacific/Norfolk</asp:ListItem> + <asp:ListItem Value="Pacific/Noumea">Pacific/Noumea</asp:ListItem> + <asp:ListItem Value="Pacific/Pago_Pago">Pacific/Pago_Pago</asp:ListItem> + <asp:ListItem Value="Pacific/Palau">Pacific/Palau</asp:ListItem> + <asp:ListItem Value="Pacific/Pitcairn">Pacific/Pitcairn</asp:ListItem> + <asp:ListItem Value="Pacific/Ponape">Pacific/Ponape</asp:ListItem> + <asp:ListItem Value="Pacific/Port_Moresby">Pacific/Port_Moresby</asp:ListItem> + <asp:ListItem Value="Pacific/Rarotonga">Pacific/Rarotonga</asp:ListItem> + <asp:ListItem Value="Pacific/Saipan">Pacific/Saipan</asp:ListItem> + <asp:ListItem Value="Pacific/Tahiti">Pacific/Tahiti</asp:ListItem> + <asp:ListItem Value="Pacific/Tarawa">Pacific/Tarawa</asp:ListItem> + <asp:ListItem Value="Pacific/Tongatapu">Pacific/Tongatapu</asp:ListItem> + <asp:ListItem Value="Pacific/Truk">Pacific/Truk</asp:ListItem> + <asp:ListItem Value="Pacific/Wake">Pacific/Wake</asp:ListItem> + <asp:ListItem Value="Pacific/Wallis">Pacific/Wallis</asp:ListItem> + </asp:DropDownList> + + </td> + </tr> + <tr> + <td> + </td> + <td> + </td> + </tr> + <tr> + <td colspan="2"> + Note: Fields marked with a * are required by the consumer + </td> + </tr> +</table> diff --git a/src/OpenID/OpenIdProviderWebForms/ProfileFields.ascx.cs b/src/OpenID/OpenIdProviderWebForms/ProfileFields.ascx.cs new file mode 100644 index 0000000..6954aa6 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/ProfileFields.ascx.cs @@ -0,0 +1,137 @@ +namespace OpenIdProviderWebForms { + using System; + using DotNetOpenAuth.OpenId.Extensions; + using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; + + /// <summary> + /// Handles the collection of the simple registration fields. + /// Only mandatory or optional fields are displayed. Mandatory fields have a '*' next to them. + /// No validation occurs here. + /// </summary> + public partial class ProfileFields : System.Web.UI.UserControl { + public bool DoesAnyFieldHaveAValue { + get { + return !((this.DateOfBirth == null) + && string.IsNullOrEmpty(this.countryDropdownList.SelectedValue) + && string.IsNullOrEmpty(this.emailTextBox.Text) + && string.IsNullOrEmpty(this.fullnameTextBox.Text) + && (this.Gender == null) + && string.IsNullOrEmpty(this.languageDropdownList.SelectedValue) + && string.IsNullOrEmpty(this.nicknameTextBox.Text) + && string.IsNullOrEmpty(this.postcodeTextBox.Text) + && string.IsNullOrEmpty(this.timezoneDropdownList.SelectedValue)); + } + } + + public DateTime? DateOfBirth { + get { + try { + int day = Convert.ToInt32(this.dobDayDropdownlist.SelectedValue); + int month = Convert.ToInt32(this.dobMonthDropdownlist.SelectedValue); + int year = Convert.ToInt32(this.dobYearDropdownlist.SelectedValue); + DateTime newDate = new DateTime(year, month, day); + return newDate; + } catch (Exception) { + return null; + } + } + + set { + if (value.HasValue) { + this.dobDayDropdownlist.SelectedValue = value.Value.Day.ToString(); + this.dobMonthDropdownlist.SelectedValue = value.Value.Month.ToString(); + this.dobYearDropdownlist.SelectedValue = value.Value.Year.ToString(); + } else { + this.dobDayDropdownlist.SelectedValue = string.Empty; + this.dobMonthDropdownlist.SelectedValue = string.Empty; + this.dobYearDropdownlist.SelectedValue = string.Empty; + } + } + } + + public Gender? Gender { + get { + if (this.genderDropdownList.SelectedValue == "Male") { + return DotNetOpenAuth.OpenId.Extensions.SimpleRegistration.Gender.Male; + } + if (this.genderDropdownList.SelectedValue == "Female") { + return DotNetOpenAuth.OpenId.Extensions.SimpleRegistration.Gender.Female; + } + return null; + } + + set { + if (value.HasValue) { + this.genderDropdownList.SelectedValue = value.Value.ToString(); + } else { + this.genderDropdownList.SelectedIndex = -1; + } + } + } + + public void SetRequiredFieldsFromRequest(ClaimsRequest requestFields) { + if (requestFields.PolicyUrl != null) { + this.privacyLink.NavigateUrl = requestFields.PolicyUrl.AbsoluteUri; + } else { + this.privacyLink.Visible = false; + } + + this.dobRequiredLabel.Visible = requestFields.BirthDate == DemandLevel.Require; + this.countryRequiredLabel.Visible = requestFields.Country == DemandLevel.Require; + this.emailRequiredLabel.Visible = requestFields.Email == DemandLevel.Require; + this.fullnameRequiredLabel.Visible = requestFields.FullName == DemandLevel.Require; + this.genderRequiredLabel.Visible = requestFields.Gender == DemandLevel.Require; + this.languageRequiredLabel.Visible = requestFields.Language == DemandLevel.Require; + this.nicknameRequiredLabel.Visible = requestFields.Nickname == DemandLevel.Require; + this.postcodeRequiredLabel.Visible = requestFields.PostalCode == DemandLevel.Require; + this.timezoneRequiredLabel.Visible = requestFields.TimeZone == DemandLevel.Require; + + this.dateOfBirthRow.Visible = !(requestFields.BirthDate == DemandLevel.NoRequest); + this.countryRow.Visible = !(requestFields.Country == DemandLevel.NoRequest); + this.emailRow.Visible = !(requestFields.Email == DemandLevel.NoRequest); + this.fullnameRow.Visible = !(requestFields.FullName == DemandLevel.NoRequest); + this.genderRow.Visible = !(requestFields.Gender == DemandLevel.NoRequest); + this.languageRow.Visible = !(requestFields.Language == DemandLevel.NoRequest); + this.nicknameRow.Visible = !(requestFields.Nickname == DemandLevel.NoRequest); + this.postcodeRow.Visible = !(requestFields.PostalCode == DemandLevel.NoRequest); + this.timezoneRow.Visible = !(requestFields.TimeZone == DemandLevel.NoRequest); + } + + public ClaimsResponse GetOpenIdProfileFields(ClaimsRequest request) { + if (request == null) { + throw new ArgumentNullException("request"); + } + + ClaimsResponse fields = request.CreateResponse(); + fields.BirthDate = this.DateOfBirth; + fields.Country = this.countryDropdownList.SelectedValue; + fields.Email = this.emailTextBox.Text; + fields.FullName = this.fullnameTextBox.Text; + fields.Gender = this.Gender; + fields.Language = this.languageDropdownList.SelectedValue; + fields.Nickname = this.nicknameTextBox.Text; + fields.PostalCode = this.postcodeTextBox.Text; + fields.TimeZone = this.timezoneDropdownList.SelectedValue; + return fields; + } + + public void SetOpenIdProfileFields(ClaimsResponse value) { + if (value == null) { + throw new ArgumentNullException("value"); + } + + this.DateOfBirth = value.BirthDate; + this.countryDropdownList.SelectedValue = value.Country; + this.emailTextBox.Text = value.Email; + this.fullnameTextBox.Text = value.FullName; + this.Gender = value.Gender; + this.languageDropdownList.SelectedValue = value.Language; + this.nicknameTextBox.Text = value.Nickname; + this.postcodeTextBox.Text = value.PostalCode; + this.timezoneDropdownList.SelectedValue = value.TimeZone; + } + + protected void Page_Load(object sender, EventArgs e) { + } + } +}
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/ProfileFields.ascx.designer.cs b/src/OpenID/OpenIdProviderWebForms/ProfileFields.ascx.designer.cs new file mode 100644 index 0000000..e546539 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/ProfileFields.ascx.designer.cs @@ -0,0 +1,286 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:2.0.50727.3521 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace OpenIdProviderWebForms { + + + public partial class ProfileFields { + + /// <summary> + /// privacyLink 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.HyperLink privacyLink; + + /// <summary> + /// nicknameRow 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.HtmlTableRow nicknameRow; + + /// <summary> + /// nicknameRequiredLabel 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 nicknameRequiredLabel; + + /// <summary> + /// nicknameTextBox 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 nicknameTextBox; + + /// <summary> + /// emailRow 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.HtmlTableRow emailRow; + + /// <summary> + /// emailRequiredLabel 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 emailRequiredLabel; + + /// <summary> + /// emailTextBox 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 emailTextBox; + + /// <summary> + /// fullnameRow 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.HtmlTableRow fullnameRow; + + /// <summary> + /// fullnameRequiredLabel 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 fullnameRequiredLabel; + + /// <summary> + /// fullnameTextBox 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 fullnameTextBox; + + /// <summary> + /// dateOfBirthRow 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.HtmlTableRow dateOfBirthRow; + + /// <summary> + /// dobRequiredLabel 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 dobRequiredLabel; + + /// <summary> + /// dobDayDropdownlist 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.DropDownList dobDayDropdownlist; + + /// <summary> + /// dobMonthDropdownlist 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.DropDownList dobMonthDropdownlist; + + /// <summary> + /// dobYearDropdownlist 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.DropDownList dobYearDropdownlist; + + /// <summary> + /// genderRow 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.HtmlTableRow genderRow; + + /// <summary> + /// genderRequiredLabel 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 genderRequiredLabel; + + /// <summary> + /// genderDropdownList 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.DropDownList genderDropdownList; + + /// <summary> + /// postcodeRow 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.HtmlTableRow postcodeRow; + + /// <summary> + /// postcodeRequiredLabel 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 postcodeRequiredLabel; + + /// <summary> + /// postcodeTextBox 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 postcodeTextBox; + + /// <summary> + /// countryRow 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.HtmlTableRow countryRow; + + /// <summary> + /// countryRequiredLabel 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 countryRequiredLabel; + + /// <summary> + /// countryDropdownList 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.DropDownList countryDropdownList; + + /// <summary> + /// languageRow 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.HtmlTableRow languageRow; + + /// <summary> + /// languageRequiredLabel 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 languageRequiredLabel; + + /// <summary> + /// languageDropdownList 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.DropDownList languageDropdownList; + + /// <summary> + /// timezoneRow 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.HtmlTableRow timezoneRow; + + /// <summary> + /// timezoneRequiredLabel 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 timezoneRequiredLabel; + + /// <summary> + /// timezoneDropdownList 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.DropDownList timezoneDropdownList; + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/Properties/AssemblyInfo.cs b/src/OpenID/OpenIdProviderWebForms/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..bfc15db --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenIdProviderWebForms sample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ProviderPortal")] +[assembly: AssemblyCopyright("Copyright © 2011 Outercurve Foundation")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/OpenID/OpenIdProviderWebForms/Provider.ashx b/src/OpenID/OpenIdProviderWebForms/Provider.ashx new file mode 100644 index 0000000..aa90b8f --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Provider.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="C#" CodeBehind="Provider.ashx.cs" Class="OpenIdProviderWebForms.Provider" %> diff --git a/src/OpenID/OpenIdProviderWebForms/Provider.ashx.cs b/src/OpenID/OpenIdProviderWebForms/Provider.ashx.cs new file mode 100644 index 0000000..f8fa4a3 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Provider.ashx.cs @@ -0,0 +1,62 @@ +namespace OpenIdProviderWebForms { + using System.Web; + using System.Web.SessionState; + using DotNetOpenAuth.OpenId.Provider; + + /// <summary> + /// A fast OpenID message handler that responds to OpenID messages + /// directed at the Provider. + /// </summary> + /// <remarks> + /// This performs the same function as server.aspx, which uses the ProviderEndpoint + /// control to reduce the amount of source code in the web site. A typical Provider + /// site will have EITHER this .ashx handler OR the .aspx page -- NOT both. + /// </remarks> + public class Provider : IHttpHandler, IRequiresSessionState { + public bool IsReusable { + get { return true; } + } + + public void ProcessRequest(HttpContext context) { + IRequest request = ProviderEndpoint.Provider.GetRequest(); + if (request != null) { + // Some OpenID requests are automatable and can be responded to immediately. + // But authentication requests cannot be responded to until something on + // this site decides whether to approve or disapprove the authentication. + if (!request.IsResponseReady) { + // We store the request in the user's session so that + // redirects and user prompts can appear and eventually some page can decide + // to respond to the OpenID authentication request either affirmatively or + // negatively. + ProviderEndpoint.PendingRequest = request as IHostProcessedRequest; + + // We delegate that approval process to our utility method that we share + // with our other Provider sample page server.aspx. + if (ProviderEndpoint.PendingAuthenticationRequest != null) { + Code.Util.ProcessAuthenticationChallenge(ProviderEndpoint.PendingAuthenticationRequest); + } else if (ProviderEndpoint.PendingAnonymousRequest != null) { + Code.Util.ProcessAnonymousRequest(ProviderEndpoint.PendingAnonymousRequest); + } + + // As part of authentication approval, the user may need to authenticate + // to this Provider and/or decide whether to allow the requesting RP site + // to log this user in. If any UI needs to be presented to the user, + // the previous call to ProcessAuthenticationChallenge MAY not return + // due to a redirect to some ASPX page. + } + + // Whether this was an automated message or an authentication message, + // if there is a response ready to send back immediately, do so. + if (request.IsResponseReady) { + // We DON'T use ProviderEndpoint.SendResponse because + // that only sends responses to requests in PendingAuthenticationRequest, + // but we don't set that for associate and other non-checkid requests. + ProviderEndpoint.Provider.Respond(request); + + // Make sure that any PendingAuthenticationRequest that MAY be set is cleared. + ProviderEndpoint.PendingRequest = null; + } + } + } + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/Site.Master b/src/OpenID/OpenIdProviderWebForms/Site.Master new file mode 100644 index 0000000..bc4f933 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Site.Master @@ -0,0 +1,20 @@ +<%@ 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"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head id="Head1" runat="server"> + <title>OpenID Provider, by DotNetOpenAuth</title> + <link href="/styles.css" rel="stylesheet" type="text/css" /> + <asp:ContentPlaceHolder ID="head" runat="server" /> +</head> +<body> + <form id="form1" runat="server"> + <div><a href="http://dotnetopenauth.net"> + <img runat="server" src="~/images/DotNetOpenAuth.png" title="Jump to the project web site." + alt="DotNetOpenAuth" border='0' /></a> </div> + <div> + <asp:ContentPlaceHolder ID="Main" runat="server" /> + </div> + </form> +</body> +</html> diff --git a/src/OpenID/OpenIdProviderWebForms/TracePage.aspx b/src/OpenID/OpenIdProviderWebForms/TracePage.aspx new file mode 100644 index 0000000..615b445 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/TracePage.aspx @@ -0,0 +1,16 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TracePage.aspx.cs" Inherits="OpenIdProviderWebForms.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/src/OpenID/OpenIdProviderWebForms/TracePage.aspx.cs b/src/OpenID/OpenIdProviderWebForms/TracePage.aspx.cs new file mode 100644 index 0000000..4ca22bd --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/TracePage.aspx.cs @@ -0,0 +1,21 @@ +namespace OpenIdProviderWebForms { + using System; + using System.Collections.Generic; + using System.Web; + using System.Web.UI; + using System.Web.UI.WebControls; + using OpenIdProviderWebForms.Code; + + public partial class TracePage : System.Web.UI.Page { + protected void Page_Load(object sender, EventArgs e) { + this.placeHolder1.Controls.Add(new Label { Text = HttpUtility.HtmlEncode(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); + } + } +}
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/TracePage.aspx.designer.cs b/src/OpenID/OpenIdProviderWebForms/TracePage.aspx.designer.cs new file mode 100644 index 0000000..6760f9b --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/TracePage.aspx.designer.cs @@ -0,0 +1,43 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:2.0.50727.3521 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace OpenIdProviderWebForms { + + + 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/src/OpenID/OpenIdProviderWebForms/Web.config b/src/OpenID/OpenIdProviderWebForms/Web.config new file mode 100644 index 0000000..49058f0 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/Web.config @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <configSections>
+ <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler" requirePermission="false" />
+ <sectionGroup name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth.Core">
+ <section name="openid" type="DotNetOpenAuth.Configuration.OpenIdElement, DotNetOpenAuth.OpenId" requirePermission="false" allowLocation="true" />
+ <section name="messaging" type="DotNetOpenAuth.Configuration.MessagingElement, DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" />
+ <section name="reporting" type="DotNetOpenAuth.Configuration.ReportingElement, DotNetOpenAuth.Core" requirePermission="false" allowLocation="true" />
+ <section name="oauth" type="DotNetOpenAuth.Configuration.OAuthElement, DotNetOpenAuth.OAuth" requirePermission="false" allowLocation="true" />
+ </sectionGroup>
+ </configSections>
+ <!-- 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.
+ It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. -->
+ <!-- this is an optional configuration section where aspects of DotNetOpenAuth can be customized -->
+ <dotNetOpenAuth>
+ <openid>
+ <provider>
+ <security requireSsl="false" />
+ <behaviors>
+ <!-- Behaviors activate themselves automatically for individual matching requests.
+ The first one in this list to match an incoming request "owns" the request. If no
+ profile matches, the default behavior is assumed. -->
+ <!--<add type="DotNetOpenAuth.OpenId.Provider.Behaviors.PpidGeneration, DotNetOpenAuth.OpenId.Provider" />-->
+ </behaviors>
+ <!-- Uncomment the following to activate the sample custom store. -->
+ <!--<store type="OpenIdProviderWebForms.Code.CustomStore, OpenIdProviderWebForms" />-->
+ </provider>
+ </openid>
+ <messaging>
+ <untrustedWebRequest>
+ <whitelistHosts>
+ <!-- since this is a sample, and will often be used with localhost -->
+ <add name="localhost" />
+ </whitelistHosts>
+ </untrustedWebRequest>
+ </messaging>
+ <!-- Allow DotNetOpenAuth to publish usage statistics to library authors to improve the library. -->
+ <reporting enabled="true" />
+ </dotNetOpenAuth>
+ <appSettings>
+ <!-- Get your own Yubico API key here: https://upgrade.yubico.com/getapikey/ -->
+ <add key="YubicoAPIKey" value="3961" />
+ </appSettings>
+ <system.web>
+ <!--
+ Set compilation debug="true" to insert debugging
+ symbols into the compiled page. Because this
+ affects performance, set this value to true only
+ during development.
+ -->
+ <compilation debug="true" targetFramework="4.0">
+ <assemblies>
+ <remove assembly="DotNetOpenAuth.Contracts" />
+ </assemblies>
+ </compilation>
+ <sessionState mode="InProc" cookieless="false" />
+ <membership defaultProvider="AspNetReadOnlyXmlMembershipProvider">
+ <providers>
+ <clear />
+ <add name="AspNetReadOnlyXmlMembershipProvider" type="OpenIdProviderWebForms.Code.ReadOnlyXmlMembershipProvider" description="Read-only XML membership provider" xmlFileName="~/App_Data/Users.xml" />
+ </providers>
+ </membership>
+ <authentication mode="Forms">
+ <!-- named cookie prevents conflicts with other samples -->
+ <forms name="OpenIdProviderWebForms" />
+ </authentication>
+ <customErrors mode="RemoteOnly" />
+ <!-- Trust level discussion:
+ Full: everything works (this is required for Google Apps for Domains support)
+ High: TRACE compilation symbol must NOT be defined
+ Medium: doesn't work unless originUrl=".*" or WebPermission.Connect is extended, and Google Apps doesn't work.
+ Low: doesn't work because WebPermission.Connect is denied.
+ -->
+ <trust level="Medium" originUrl=".*" />
+ <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
+ </system.web>
+ <location path="decide.aspx">
+ <system.web>
+ <authorization>
+ <deny users="?" />
+ </authorization>
+ </system.web>
+ </location>
+ <!-- log4net is a 3rd party (free) logger library that DotNetOpenAuth will use if present but does not require. -->
+ <log4net>
+ <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
+ <file value="Provider.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="OpenIdProviderWebForms.Code.TracePageAppender, OpenIdProviderWebForms">
+ <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="DotNetOpenAuth">
+ <level value="INFO" />
+ </logger>
+ </log4net>
+ <uri>
+ <!-- See an error due to this section? When targeting .NET 3.5, please add the following line to your <configSections> at the top of this file:
+ <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ -->
+ <!-- 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.
+ It is also required to put the Uri class into RFC 3986 escaping mode, which OpenID and OAuth require. -->
+ <idn enabled="All" />
+ <iriParsing enabled="true" />
+ </uri>
+ <system.net>
+ <defaultProxy enabled="true" />
+ <settings>
+ <!-- This setting causes .NET to check certificate revocation lists (CRL)
+ before trusting HTTPS certificates. But this setting tends to not
+ be allowed in shared hosting environments. -->
+ <!--<servicePointManager checkCertificateRevocationList="true"/>-->
+ </settings>
+ </system.net>
+ <runtime>
+ <!-- This prevents the Windows Event Log from frequently logging that HMAC1 is being used (when the other party needs it). -->
+ <legacyHMACWarning enabled="0" />
+ </runtime>
+</configuration>
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/access_token.ashx b/src/OpenID/OpenIdProviderWebForms/access_token.ashx new file mode 100644 index 0000000..dcb088e --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/access_token.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="C#" CodeBehind="access_token.ashx.cs" Class="OpenIdProviderWebForms.access_token" %> diff --git a/src/OpenID/OpenIdProviderWebForms/access_token.ashx.cs b/src/OpenID/OpenIdProviderWebForms/access_token.ashx.cs new file mode 100644 index 0000000..1e3d27c --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/access_token.ashx.cs @@ -0,0 +1,23 @@ +namespace OpenIdProviderWebForms { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Web; + using System.Web.Services; + using DotNetOpenAuth.OAuth; + using OpenIdProviderWebForms.Code; + + [WebService(Namespace = "http://tempuri.org/")] + [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] + public class access_token : IHttpHandler { + public bool IsReusable { + get { return true; } + } + + public void ProcessRequest(HttpContext context) { + var request = OAuthHybrid.ServiceProvider.ReadAccessTokenRequest(); + var response = OAuthHybrid.ServiceProvider.PrepareAccessTokenMessage(request); + OAuthHybrid.ServiceProvider.Channel.Respond(response); + } + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/decide.aspx b/src/OpenID/OpenIdProviderWebForms/decide.aspx new file mode 100644 index 0000000..d63364e --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/decide.aspx @@ -0,0 +1,28 @@ +<%@ Page Language="C#" AutoEventWireup="true" Inherits="OpenIdProviderWebForms.decide" + CodeBehind="decide.aspx.cs" MasterPageFile="~/Site.Master" %> + +<%@ Register Src="ProfileFields.ascx" TagName="ProfileFields" TagPrefix="uc1" %> +<asp:Content runat="server" ContentPlaceHolderID="Main"> + <p><asp:Label ID="siteRequestLabel" runat="server" Text="A site has asked to authenticate that you own the identifier below." /> + You should only do this if you wish to log in to the site given by the Realm.</p> + <p>This site <asp:Label ID="relyingPartyVerificationResultLabel" runat="server" Font-Bold="True" + Text="failed" /> verification. </p> + <table> + <tr> + <td>Identifier: </td> + <td><asp:Label runat="server" ID='identityUrlLabel' /> </td> + </tr> + <tr> + <td>Realm: </td> + <td><asp:Label runat="server" ID='realmLabel' /> </td> + </tr> + </table> + <asp:Panel runat="server" ID="OAuthPanel" Visible="false"> + <p>In addition the relying party has asked for permission to access your private data. </p> + <asp:CheckBox runat="server" Text="Allow the relying party to access my private data" ID="oauthPermission" /> + </asp:Panel> + <p>Allow this to proceed? </p> + <uc1:ProfileFields ID="profileFields" runat="server" Visible="false" /> + <asp:Button ID="yes_button" OnClick="Yes_Click" Text=" yes " runat="Server" /> + <asp:Button ID="no_button" OnClick="No_Click" Text=" no " runat="Server" /> +</asp:Content> diff --git a/src/OpenID/OpenIdProviderWebForms/decide.aspx.cs b/src/OpenID/OpenIdProviderWebForms/decide.aspx.cs new file mode 100644 index 0000000..8c8f927 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/decide.aspx.cs @@ -0,0 +1,114 @@ +namespace OpenIdProviderWebForms { + using System; + using System.Diagnostics; + using System.Web.Security; + using System.Web.UI; + using DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy; + using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration; + using DotNetOpenAuth.OpenId.Provider; + using OpenIdProviderWebForms.Code; + + /// <summary> + /// Page for giving the user the option to continue or cancel out of authentication with a consumer. + /// </summary> + public partial class decide : Page { + protected void Page_Load(object src, EventArgs e) { + if (ProviderEndpoint.PendingRequest == null) { + Response.Redirect("~/"); + } + + this.relyingPartyVerificationResultLabel.Text = + ProviderEndpoint.PendingRequest.IsReturnUrlDiscoverable(ProviderEndpoint.Provider.Channel.WebRequestHandler) == RelyingPartyDiscoveryResult.Success ? "passed" : "failed"; + + this.realmLabel.Text = ProviderEndpoint.PendingRequest.Realm.ToString(); + + var oauthRequest = OAuthHybrid.ServiceProvider.ReadAuthorizationRequest(ProviderEndpoint.PendingRequest); + if (oauthRequest != null) { + this.OAuthPanel.Visible = true; + } + + if (ProviderEndpoint.PendingAuthenticationRequest != null) { + if (ProviderEndpoint.PendingAuthenticationRequest.IsDirectedIdentity) { + ProviderEndpoint.PendingAuthenticationRequest.LocalIdentifier = Code.Util.BuildIdentityUrl(); + } + this.identityUrlLabel.Text = ProviderEndpoint.PendingAuthenticationRequest.LocalIdentifier.ToString(); + + // check that the logged in user is the same as the user requesting authentication to the consumer. If not, then log them out. + if (!string.Equals(User.Identity.Name, Code.Util.ExtractUserName(ProviderEndpoint.PendingAuthenticationRequest.LocalIdentifier), StringComparison.OrdinalIgnoreCase)) { + FormsAuthentication.SignOut(); + Response.Redirect(Request.Url.AbsoluteUri); + } + } else { + this.identityUrlLabel.Text = "(not applicable)"; + this.siteRequestLabel.Text = "A site has asked for information about you."; + } + + // if simple registration fields were used, then prompt the user for them + var requestedFields = ProviderEndpoint.PendingRequest.GetExtension<ClaimsRequest>(); + if (requestedFields != null) { + this.profileFields.Visible = true; + this.profileFields.SetRequiredFieldsFromRequest(requestedFields); + if (!IsPostBack) { + var sregResponse = requestedFields.CreateResponse(); + + // We MAY not have an entry for this user if they used Yubikey to log in. + MembershipUser user = Membership.GetUser(); + if (user != null) { + sregResponse.Email = Membership.GetUser().Email; + } + this.profileFields.SetOpenIdProfileFields(sregResponse); + } + } + } + + protected void Yes_Click(object sender, EventArgs e) { + if (!Page.IsValid) { + return; + } + + if (this.OAuthPanel.Visible) { + string grantedScope = null; + if (this.oauthPermission.Checked) { + // This SIMPLE sample merely uses the realm as the consumerKey, + // but in a real app this will probably involve a database lookup to translate + // the realm to a known consumerKey. + grantedScope = string.Empty; // we don't scope individual access rights on this sample + } + + OAuthHybrid.ServiceProvider.AttachAuthorizationResponse(ProviderEndpoint.PendingRequest, grantedScope); + } + + var sregRequest = ProviderEndpoint.PendingRequest.GetExtension<ClaimsRequest>(); + ClaimsResponse sregResponse = null; + if (sregRequest != null) { + sregResponse = this.profileFields.GetOpenIdProfileFields(sregRequest); + ProviderEndpoint.PendingRequest.AddResponseExtension(sregResponse); + } + var papeRequest = ProviderEndpoint.PendingRequest.GetExtension<PolicyRequest>(); + PolicyResponse papeResponse = null; + if (papeRequest != null) { + papeResponse = new PolicyResponse(); + papeResponse.NistAssuranceLevel = NistAssuranceLevel.InsufficientForLevel1; + ProviderEndpoint.PendingRequest.AddResponseExtension(papeResponse); + } + + if (ProviderEndpoint.PendingAuthenticationRequest != null) { + ProviderEndpoint.PendingAuthenticationRequest.IsAuthenticated = true; + } else { + ProviderEndpoint.PendingAnonymousRequest.IsApproved = true; + } + Debug.Assert(ProviderEndpoint.PendingRequest.IsResponseReady, "Setting authentication should be all that's necessary."); + ProviderEndpoint.SendResponse(); + } + + protected void No_Click(object sender, EventArgs e) { + if (ProviderEndpoint.PendingAuthenticationRequest != null) { + ProviderEndpoint.PendingAuthenticationRequest.IsAuthenticated = false; + } else { + ProviderEndpoint.PendingAnonymousRequest.IsApproved = false; + } + Debug.Assert(ProviderEndpoint.PendingRequest.IsResponseReady, "Setting authentication should be all that's necessary."); + ProviderEndpoint.SendResponse(); + } + } +}
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/decide.aspx.designer.cs b/src/OpenID/OpenIdProviderWebForms/decide.aspx.designer.cs new file mode 100644 index 0000000..3aa6271 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/decide.aspx.designer.cs @@ -0,0 +1,97 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:2.0.50727.4918 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace OpenIdProviderWebForms { + + + public partial class decide { + + /// <summary> + /// siteRequestLabel 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 siteRequestLabel; + + /// <summary> + /// relyingPartyVerificationResultLabel 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 relyingPartyVerificationResultLabel; + + /// <summary> + /// identityUrlLabel 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 identityUrlLabel; + + /// <summary> + /// realmLabel 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 realmLabel; + + /// <summary> + /// OAuthPanel 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.Panel OAuthPanel; + + /// <summary> + /// oauthPermission 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.CheckBox oauthPermission; + + /// <summary> + /// profileFields control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::OpenIdProviderWebForms.ProfileFields profileFields; + + /// <summary> + /// yes_button 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 yes_button; + + /// <summary> + /// no_button 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 no_button; + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/favicon.ico b/src/OpenID/OpenIdProviderWebForms/favicon.ico Binary files differnew file mode 100644 index 0000000..e227dbe --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/favicon.ico diff --git a/src/OpenID/OpenIdProviderWebForms/images/DotNetOpenAuth.png b/src/OpenID/OpenIdProviderWebForms/images/DotNetOpenAuth.png Binary files differnew file mode 100644 index 0000000..442b986 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/images/DotNetOpenAuth.png diff --git a/src/OpenID/OpenIdProviderWebForms/login.aspx b/src/OpenID/OpenIdProviderWebForms/login.aspx new file mode 100644 index 0000000..f7898cc --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/login.aspx @@ -0,0 +1,27 @@ +<%@ Page Language="C#" AutoEventWireup="true" Inherits="OpenIdProviderWebForms.login" CodeBehind="login.aspx.cs" MasterPageFile="~/Site.Master" %> +<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main"> + <p> + Usernames are defined in the App_Data\Users.xml file. + </p> + <asp:Login runat="server" ID="login1" /> + + <p>Credentials to try (each with their own OpenID)</p> + <table> + <tr><td>Username</td><td>Password</td></tr> + <tr><td>bob</td><td>test</td></tr> + <tr><td>bob1</td><td>test</td></tr> + <tr><td>bob2</td><td>test</td></tr> + <tr><td>bob3</td><td>test</td></tr> + <tr><td>bob4</td><td>test</td></tr> + </table> + + <asp:Panel DefaultButton="yubicoButton" runat="server" style="margin-top: 25px" ID="yubicoPanel"> + Login with Yubikey: + <asp:TextBox runat="server" type="text" ID="yubicoBox" ToolTip="Click here and press your Yubikey button." + style="background-image: url(http://yubico.com/favicon.ico); background-repeat: no-repeat; background-position: 0px 1px; padding-left: 18px; width: 20em;" + MaxLength="44" AutoCompleteType="Disabled" /> + <asp:Button runat="server" ID="yubicoButton" Text="Login" + onclick="yubicoButton_Click" /> + <asp:Label Text="[Yubikey Result]" runat="server" EnableViewState="false" Visible="false" ForeColor="Red" ID="yubikeyFailureLabel" /> + </asp:Panel> +</asp:Content>
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/login.aspx.cs b/src/OpenID/OpenIdProviderWebForms/login.aspx.cs new file mode 100644 index 0000000..ef5b2c4 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/login.aspx.cs @@ -0,0 +1,50 @@ +namespace OpenIdProviderWebForms { + using System; + using System.Configuration; + using System.Globalization; + using System.Web.Security; + using System.Web.UI.WebControls; + using DotNetOpenAuth.ApplicationBlock; + using DotNetOpenAuth.OpenId.Provider; + + /// <summary> + /// Page for handling logins to this server. + /// </summary> + public partial class login : System.Web.UI.Page { + protected void Page_Load(object src, EventArgs e) { + if (!IsPostBack) { + this.yubicoPanel.Visible = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["YubicoAPIKey"]); + + if (ProviderEndpoint.PendingAuthenticationRequest != null && + !ProviderEndpoint.PendingAuthenticationRequest.IsDirectedIdentity) { + this.login1.UserName = Code.Util.ExtractUserName( + ProviderEndpoint.PendingAuthenticationRequest.LocalIdentifier); + ((TextBox)this.login1.FindControl("UserName")).ReadOnly = true; + this.login1.FindControl("Password").Focus(); + } + } + } + + protected void yubicoButton_Click(object sender, EventArgs e) { + string username; + if (this.TryVerifyYubikeyAndGetUsername(this.yubicoBox.Text, out username)) { + FormsAuthentication.RedirectFromLoginPage(username, false); + } + } + + private bool TryVerifyYubikeyAndGetUsername(string token, out string username) { + var yubikey = new YubikeyRelyingParty(int.Parse(ConfigurationManager.AppSettings["YubicoAPIKey"], CultureInfo.InvariantCulture)); + YubikeyResult result = yubikey.IsValid(token); + switch (result) { + case YubikeyResult.Ok: + username = YubikeyRelyingParty.ExtractUsername(token); + return true; + default: + this.yubikeyFailureLabel.Visible = true; + this.yubikeyFailureLabel.Text = result.ToString(); + username = null; + return false; + } + } + } +}
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/login.aspx.designer.cs b/src/OpenID/OpenIdProviderWebForms/login.aspx.designer.cs new file mode 100644 index 0000000..307dd96 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/login.aspx.designer.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace OpenIdProviderWebForms { + + + public partial class login { + + /// <summary> + /// login1 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.Login login1; + + /// <summary> + /// yubicoPanel 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.Panel yubicoPanel; + + /// <summary> + /// yubicoBox 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 yubicoBox; + + /// <summary> + /// yubicoButton 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 yubicoButton; + + /// <summary> + /// yubikeyFailureLabel 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 yubikeyFailureLabel; + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/op_xrds.aspx b/src/OpenID/OpenIdProviderWebForms/op_xrds.aspx new file mode 100644 index 0000000..afcfc75 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/op_xrds.aspx @@ -0,0 +1,19 @@ +<%@ Page Language="C#" AutoEventWireup="true" ContentType="application/xrds+xml" %><?xml version="1.0" encoding="UTF-8"?> +<%-- +This page is a required as part of the service discovery phase of the openid +protocol (step 1). It simply renders the xml for doing service discovery of +server.aspx using the xrds mechanism. +This XRDS doc is discovered via the user.aspx page. +--%> +<xrds:XRDS + xmlns:xrds="xri://$xrds" + xmlns:openid="http://openid.net/xmlns/1.0" + xmlns="xri://$xrd*($v*2.0)"> + <XRD> + <Service priority="10"> + <Type>http://specs.openid.net/auth/2.0/server</Type> + <Type>http://openid.net/extensions/sreg/1.1</Type> + <URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/server.aspx"))%></URI> + </Service> + </XRD> +</xrds:XRDS> diff --git a/src/OpenID/OpenIdProviderWebForms/packages.config b/src/OpenID/OpenIdProviderWebForms/packages.config new file mode 100644 index 0000000..f09d52e --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/packages.config @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="CodeContracts.Unofficial" version="1.0.0.2" />
+ <package id="DotNetOpenAuth.Core" version="4.0.0.12084" />
+ <package id="DotNetOpenAuth.Core.UI" version="4.0.0.12084" />
+ <package id="DotNetOpenAuth.OAuth.Common" version="4.0.0.12084" />
+ <package id="DotNetOpenAuth.OAuth.Consumer" version="4.0.0.12084" />
+ <package id="DotNetOpenAuth.OAuth.Core" version="4.0.0.12084" />
+ <package id="DotNetOpenAuth.OAuth.ServiceProvider" version="4.0.0.12084" />
+ <package id="DotNetOpenAuth.OpenId.Core" version="4.0.0.12084" />
+ <package id="DotNetOpenAuth.OpenId.Core.UI" version="4.0.0.12084" />
+ <package id="DotNetOpenAuth.OpenId.Provider" version="4.0.0.12084" />
+ <package id="DotNetOpenAuth.OpenId.Provider.UI" version="4.0.0.12084" />
+ <package id="DotNetOpenAuth.OpenIdOAuth" version="4.0.0.12084" />
+ <package id="log4net" version="2.0.0" />
+</packages>
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/server.aspx b/src/OpenID/OpenIdProviderWebForms/server.aspx new file mode 100644 index 0000000..101aeee --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/server.aspx @@ -0,0 +1,53 @@ +<%@ Page Language="C#" AutoEventWireup="true" Inherits="OpenIdProviderWebForms.server" CodeBehind="server.aspx.cs" ValidateRequest="false" %> + +<%@ Register Assembly="DotNetOpenAuth.OpenId.Provider.UI" Namespace="DotNetOpenAuth.OpenId.Provider" TagPrefix="openid" %> +<html> +<head> + <title>This is an OpenID server</title> +</head> +<body> + <form runat='server'> + <%-- This page provides an example of how to use the ProviderEndpoint control on an ASPX page + to host an OpenID Provider. Alternatively for greater performance an .ashx file can be used. + See Provider.ashx for an example. A typical web site will NOT use both .ashx and .aspx + provider endpoints. + This server.aspx page is the default provider endpoint to use. To switch to the .ashx handler, + change the user_xrds.aspx and op_xrds.aspx files to point to provider.ashx instead of server.aspx. + --%> + <openid:ProviderEndpoint runat="server" OnAuthenticationChallenge="provider_AuthenticationChallenge" OnAnonymousRequest="provider_AnonymousRequest" /> + <p> + <asp:Label ID="serverEndpointUrl" runat="server" EnableViewState="false" /> + is an OpenID server endpoint. + </p> + <p> + For more information about OpenID, see: + </p> + <table> + <tr> + <td> + <a href="http://dotnetopenauth.net/">http://dotnetopenauth.net/</a> + </td> + <td> + Home of this library + </td> + </tr> + <tr> + <td> + <a href="http://www.openid.net/">http://www.openid.net/</a> + </td> + <td> + The official OpenID Web site + </td> + </tr> + <tr> + <td> + <a href="http://www.openidenabled.com/">http://www.openidenabled.com/</a> + </td> + <td> + An OpenID community Web site + </td> + </tr> + </table> + </form> +</body> +</html> diff --git a/src/OpenID/OpenIdProviderWebForms/server.aspx.cs b/src/OpenID/OpenIdProviderWebForms/server.aspx.cs new file mode 100644 index 0000000..89e14f4 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/server.aspx.cs @@ -0,0 +1,22 @@ +namespace OpenIdProviderWebForms { + using System; + using DotNetOpenAuth.OpenId.Provider; + + /// <summary> + /// This is the primary page for this open-id provider. + /// This page is responsible for handling all open-id compliant requests. + /// </summary> + public partial class server : System.Web.UI.Page { + protected void Page_Load(object src, System.EventArgs evt) { + this.serverEndpointUrl.Text = Request.Url.ToString(); + } + + protected void provider_AuthenticationChallenge(object sender, AuthenticationChallengeEventArgs e) { + Code.Util.ProcessAuthenticationChallenge(e.Request); + } + + protected void provider_AnonymousRequest(object sender, AnonymousRequestEventArgs e) { + Code.Util.ProcessAnonymousRequest(e.Request); + } + } +}
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/server.aspx.designer.cs b/src/OpenID/OpenIdProviderWebForms/server.aspx.designer.cs new file mode 100644 index 0000000..562e06e --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/server.aspx.designer.cs @@ -0,0 +1,24 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace OpenIdProviderWebForms { + + + public partial class server { + + /// <summary> + /// serverEndpointUrl 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 serverEndpointUrl; + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/styles.css b/src/OpenID/OpenIdProviderWebForms/styles.css new file mode 100644 index 0000000..2e4d3db --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/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/src/OpenID/OpenIdProviderWebForms/user.aspx b/src/OpenID/OpenIdProviderWebForms/user.aspx new file mode 100644 index 0000000..455434e --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/user.aspx @@ -0,0 +1,17 @@ +<%@ Page Language="C#" AutoEventWireup="true" Inherits="OpenIdProviderWebForms.user" CodeBehind="user.aspx.cs" MasterPageFile="~/Site.Master" %> + +<%@ Register Assembly="DotNetOpenAuth.OpenId.Provider.UI" Namespace="DotNetOpenAuth.OpenId.Provider" TagPrefix="openid" %> +<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="head"> + <openid:IdentityEndpoint ID="IdentityEndpoint20" runat="server" ProviderEndpointUrl="~/Server.aspx" + XrdsUrl="~/user_xrds.aspx" ProviderVersion="V20" + AutoNormalizeRequest="true" OnNormalizeUri="IdentityEndpoint20_NormalizeUri" /> + <!-- and for backward compatibility with OpenID 1.x RPs... --> + <openid:IdentityEndpoint ID="IdentityEndpoint11" runat="server" ProviderEndpointUrl="~/Server.aspx" + ProviderVersion="V11" /> +</asp:Content> +<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="Main"> + <p> + OpenID identity page for + <asp:Label runat="server" ID="usernameLabel" EnableViewState="false" /> + </p> +</asp:Content>
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/user.aspx.cs b/src/OpenID/OpenIdProviderWebForms/user.aspx.cs new file mode 100644 index 0000000..5cd84c9 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/user.aspx.cs @@ -0,0 +1,23 @@ +namespace OpenIdProviderWebForms { + using System; + using DotNetOpenAuth.OpenId.Provider; + using OpenIdProviderWebForms.Code; + + /// <summary> + /// This page is a required as part of the service discovery phase of the openid protocol (step 1). + /// </summary> + /// <remarks> + /// <para>The XRDS (or Yadis) content is also rendered to provide the consumer with an alternative discovery mechanism. The Yadis protocol allows the consumer + /// to provide the user with a more flexible range of authentication mechanisms (which ever has been defined in xrds.aspx). See http://en.wikipedia.org/wiki/Yadis.</para> + /// </remarks> + public partial class user : System.Web.UI.Page { + protected void Page_Load(object sender, EventArgs e) { + this.usernameLabel.Text = Util.ExtractUserName(Page.Request.Url); + } + + protected void IdentityEndpoint20_NormalizeUri(object sender, IdentityEndpointNormalizationEventArgs e) { + string username = Util.ExtractUserName(Page.Request.Url); + e.NormalizedIdentifier = new Uri(Util.BuildIdentityUrl(username)); + } + } +}
\ No newline at end of file diff --git a/src/OpenID/OpenIdProviderWebForms/user.aspx.designer.cs b/src/OpenID/OpenIdProviderWebForms/user.aspx.designer.cs new file mode 100644 index 0000000..4509a6e --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/user.aspx.designer.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace OpenIdProviderWebForms { + + + public partial class user { + + /// <summary> + /// IdentityEndpoint20 control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::DotNetOpenAuth.OpenId.Provider.IdentityEndpoint IdentityEndpoint20; + + /// <summary> + /// IdentityEndpoint11 control. + /// </summary> + /// <remarks> + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// </remarks> + protected global::DotNetOpenAuth.OpenId.Provider.IdentityEndpoint IdentityEndpoint11; + + /// <summary> + /// usernameLabel 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 usernameLabel; + } +} diff --git a/src/OpenID/OpenIdProviderWebForms/user_xrds.aspx b/src/OpenID/OpenIdProviderWebForms/user_xrds.aspx new file mode 100644 index 0000000..275e413 --- /dev/null +++ b/src/OpenID/OpenIdProviderWebForms/user_xrds.aspx @@ -0,0 +1,24 @@ +<%@ Page Language="C#" AutoEventWireup="true" ContentType="application/xrds+xml" %><?xml version="1.0" encoding="UTF-8"?> +<%-- +This page is a required as part of the service discovery phase of the openid +protocol (step 1). It simply renders the xml for doing service discovery of +server.aspx using the xrds mechanism. +This XRDS doc is discovered via the user.aspx page. +--%> +<xrds:XRDS + xmlns:xrds="xri://$xrds" + xmlns:openid="http://openid.net/xmlns/1.0" + xmlns="xri://$xrd*($v*2.0)"> + <XRD> + <Service priority="10"> + <Type>http://specs.openid.net/auth/2.0/signon</Type> + <Type>http://openid.net/extensions/sreg/1.1</Type> + <URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/server.aspx"))%></URI> + </Service> + <Service priority="20"> + <Type>http://openid.net/signon/1.0</Type> + <Type>http://openid.net/extensions/sreg/1.1</Type> + <URI><%=new Uri(Request.Url, Response.ApplyAppPathModifier("~/server.aspx"))%></URI> + </Service> + </XRD> +</xrds:XRDS> |