summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/DotNetOpenAuth/OpenId/Identifier.cs1
-rw-r--r--src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs8
-rw-r--r--src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdLogin.cs8
-rw-r--r--src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs37
-rw-r--r--src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs125
-rw-r--r--src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdTextBox.cs1
6 files changed, 99 insertions, 81 deletions
diff --git a/src/DotNetOpenAuth/OpenId/Identifier.cs b/src/DotNetOpenAuth/OpenId/Identifier.cs
index f3de903..074a772 100644
--- a/src/DotNetOpenAuth/OpenId/Identifier.cs
+++ b/src/DotNetOpenAuth/OpenId/Identifier.cs
@@ -27,6 +27,7 @@ namespace DotNetOpenAuth.OpenId {
/// <param name="originalString">The original string before any normalization.</param>
/// <param name="isDiscoverySecureEndToEnd">Whether the derived class is prepared to guarantee end-to-end discovery
/// and initial redirect for authentication is performed using SSL.</param>
+ [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "string", Justification = "Emphasis on string instead of the strong-typed Identifier.")]
protected Identifier(string originalString, bool isDiscoverySecureEndToEnd) {
this.OriginalString = originalString;
this.IsDiscoverySecureEndToEnd = isDiscoverySecureEndToEnd;
diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs
index 0933e9c..0c15b88 100644
--- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs
+++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs
@@ -18,6 +18,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
+ using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Text;
@@ -229,12 +230,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
#endregion
- /// <summary>
- /// A dictionary of extension response types and the javascript member
- /// name to map them to on the user agent.
- /// </summary>
- private Dictionary<Type, string> clientScriptExtensions = new Dictionary<Type, string>();
-
#region Events
/// <summary>
@@ -627,6 +622,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// <summary>
/// When implemented by a class, signals the server control to notify the ASP.NET application that the state of the control has changed.
/// </summary>
+ [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate", Justification = "Preserve signature of interface we're implementing.")]
protected virtual void RaisePostDataChangedEvent() {
this.OnTextChanged();
}
diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdLogin.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdLogin.cs
index d262d14..3e13ef0 100644
--- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdLogin.cs
+++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdLogin.cs
@@ -551,8 +551,8 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
[DefaultValue(RememberMeDefault)]
[Description("Whether a successful authentication should result in a persistent cookie being saved to the browser.")]
public bool RememberMe {
- get { return this.UsePersistentCookie != LoginPersistence.Session; }
- set { this.UsePersistentCookie = value ? LoginPersistence.PersistentAuthentication : LoginPersistence.Session; }
+ get { return this.UsePersistentCookie != LogOnPersistence.Session; }
+ set { this.UsePersistentCookie = value ? LogOnPersistence.PersistentAuthentication : LogOnPersistence.Session; }
}
/// <summary>
@@ -635,7 +635,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// cookie should persist across user sessions.
/// </summary>
[Browsable(false), Bindable(false)]
- public override LoginPersistence UsePersistentCookie {
+ public override LogOnPersistence UsePersistentCookie {
get {
return base.UsePersistentCookie;
}
@@ -645,7 +645,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
// use conditional here to prevent infinite recursion
// with CheckedChanged event.
- bool rememberMe = value != LoginPersistence.Session;
+ bool rememberMe = value != LogOnPersistence.Session;
if (this.rememberMeCheckBox.Checked != rememberMe) {
this.rememberMeCheckBox.Checked = rememberMe;
}
diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs
index 480b08c..6b4717b 100644
--- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs
+++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs
@@ -32,12 +32,12 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// <summary>
/// The name of the javascript function that will initiate a synchronous callback.
/// </summary>
- protected const string CallbackJsFunction = "window.dnoa_internal.callback";
+ protected const string CallbackJSFunction = "window.dnoa_internal.callback";
/// <summary>
/// The name of the javascript function that will initiate an asynchronous callback.
/// </summary>
- protected const string CallbackJsFunctionAsync = "window.dnoa_internal.callbackAsync";
+ protected const string CallbackJSFunctionAsync = "window.dnoa_internal.callbackAsync";
/// <summary>
/// The "dnoa.op_endpoint" string.
@@ -98,7 +98,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
base.Popup = PopupBehavior.Always;
// The expected use case for the AJAX login box is for comments... not logging in.
- this.LoginMode = LoginSiteNotification.None;
+ this.LogOnMode = LogOnSiteNotification.None;
}
/// <summary>
@@ -216,8 +216,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// <returns>The result of the callback.</returns>
/// <value>A whitespace delimited list of URLs that can be used to initiate authentication.</value>
string ICallbackEventHandler.GetCallbackResult() {
- this.Page.Response.ContentType = "text/javascript";
- return this.discoveryResult;
+ return this.GetCallbackResult();
}
/// <summary>
@@ -225,7 +224,29 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// AJAX callback mechanisms.
/// </summary>
/// <param name="eventArgument">The identifier to perform discovery on.</param>
+ [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate", Justification = "We want to preserve the signature of the interface.")]
void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument) {
+ this.RaiseCallbackEvent(eventArgument);
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Returns the results of a callback event that targets a control.
+ /// </summary>
+ /// <returns>The result of the callback.</returns>
+ [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "We want to preserve the signature of the interface.")]
+ protected virtual string GetCallbackResult() {
+ this.Page.Response.ContentType = "text/javascript";
+ return this.discoveryResult;
+ }
+
+ /// <summary>
+ /// Processes a callback event that targets a control.
+ /// </summary>
+ /// <param name="eventArgument">A string that represents an event argument to pass to the event handler.</param>
+ [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate", Justification = "We want to preserve the signature of the interface.")]
+ protected virtual void RaiseCallbackEvent(string eventArgument) {
string userSuppliedIdentifier = eventArgument;
ErrorUtilities.VerifyNonZeroLength(userSuppliedIdentifier, "userSuppliedIdentifier");
@@ -277,8 +298,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
this.discoveryResult = discoveryResultBuilder.ToString();
}
- #endregion
-
/// <summary>
/// Fires the <see cref="UnconfirmedPositiveAssertion"/> event.
/// </summary>
@@ -336,8 +355,8 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
StringBuilder initScript = new StringBuilder();
- initScript.AppendLine(CallbackJsFunctionAsync + " = " + this.GetJsCallbackConvenienceFunction(true));
- initScript.AppendLine(CallbackJsFunction + " = " + this.GetJsCallbackConvenienceFunction(false));
+ initScript.AppendLine(CallbackJSFunctionAsync + " = " + this.GetJsCallbackConvenienceFunction(true));
+ initScript.AppendLine(CallbackJSFunction + " = " + this.GetJsCallbackConvenienceFunction(false));
this.Page.ClientScript.RegisterClientScriptBlock(typeof(OpenIdRelyingPartyControlBase), "initializer", initScript.ToString(), true);
}
diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs
index 6baeab9..aff9ef6 100644
--- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs
+++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs
@@ -27,6 +27,50 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using DotNetOpenAuth.OpenId.Extensions.UI;
/// <summary>
+ /// Methods of indicating to the rest of the web site that the user has logged in.
+ /// </summary>
+ [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "OnSite", Justification = "Two words intended.")]
+ public enum LogOnSiteNotification {
+ /// <summary>
+ /// The rest of the web site is unaware that the user just completed an OpenID login.
+ /// </summary>
+ None,
+
+ /// <summary>
+ /// After the <see cref="OpenIdRelyingPartyControlBase.LoggedIn"/> event is fired
+ /// the control automatically calls <see cref="System.Web.Security.FormsAuthentication.RedirectFromLoginPage(string, bool)"/>
+ /// with the <see cref="IAuthenticationResponse.ClaimedIdentifier"/> as the username
+ /// unless the <see cref="OpenIdRelyingPartyControlBase.LoggedIn"/> event handler sets
+ /// <see cref="OpenIdEventArgs.Cancel"/> property to true.
+ /// </summary>
+ FormsAuthentication,
+ }
+
+ /// <summary>
+ /// How an OpenID user session should be persisted across visits.
+ /// </summary>
+ public enum LogOnPersistence {
+ /// <summary>
+ /// The user should only be logged in as long as the browser window remains open.
+ /// Nothing is persisted to help the user on a return visit. Public kiosk mode.
+ /// </summary>
+ Session,
+
+ /// <summary>
+ /// The user should only be logged in as long as the browser window remains open.
+ /// The OpenID Identifier is persisted to help expedite re-authentication when
+ /// the user visits the next time.
+ /// </summary>
+ SessionAndPersistentIdentifier,
+
+ /// <summary>
+ /// The user is issued a persistent authentication ticket so that no login is
+ /// necessary on their return visit.
+ /// </summary>
+ PersistentAuthentication,
+ }
+
+ /// <summary>
/// A common base class for OpenID Relying Party controls.
/// </summary>
[DefaultProperty("Identifier"), ValidationProperty("Identifier")]
@@ -76,7 +120,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// The parameter name to include in the formulated auth request so that javascript can know whether
/// the OP advertises support for the UI extension.
/// </summary>
- protected const string PopupUISupportedJsHint = OpenIdUtilities.CustomParameterPrefix + "popupUISupported";
+ protected const string PopupUISupportedJSHint = OpenIdUtilities.CustomParameterPrefix + "popupUISupported";
/// <summary>
/// The callback parameter for use with persisting the <see cref="UsePersistentCookie"/> property.
@@ -105,12 +149,12 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// <summary>
/// Default value of <see cref="UsePersistentCookie"/>.
/// </summary>
- private const LoginPersistence UsePersistentCookieDefault = LoginPersistence.Session;
+ private const LogOnPersistence UsePersistentCookieDefault = LogOnPersistence.Session;
/// <summary>
- /// Default value of <see cref="LoginMode"/>.
+ /// Default value of <see cref="LogOnMode"/>.
/// </summary>
- private const LoginSiteNotification LoginModeDefault = LoginSiteNotification.FormsAuthentication;
+ private const LogOnSiteNotification LogOnModeDefault = LogOnSiteNotification.FormsAuthentication;
/// <summary>
/// The default value for the <see cref="RealmUrl"/> property.
@@ -142,9 +186,9 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
private const string UsePersistentCookieViewStateKey = "UsePersistentCookie";
/// <summary>
- /// The viewstate key to use for the <see cref="LoginMode"/> property.
+ /// The viewstate key to use for the <see cref="LogOnMode"/> property.
/// </summary>
- private const string LoginModeViewStateKey = "LoginMode";
+ private const string LogOnModeViewStateKey = "LogOnMode";
/// <summary>
/// The viewstate key to use for the <see cref="RealmUrl"/> property.
@@ -230,49 +274,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
#endregion
/// <summary>
- /// Methods of indicating to the rest of the web site that the user has logged in.
- /// </summary>
- public enum LoginSiteNotification {
- /// <summary>
- /// The rest of the web site is unaware that the user just completed an OpenID login.
- /// </summary>
- None,
-
- /// <summary>
- /// After the <see cref="OpenIdRelyingPartyControlBase.LoggedIn"/> event is fired
- /// the control automatically calls <see cref="System.Web.Security.FormsAuthentication.RedirectFromLoginPage(string, bool)"/>
- /// with the <see cref="IAuthenticationResponse.ClaimedIdentifier"/> as the username
- /// unless the <see cref="OpenIdRelyingPartyControlBase.LoggedIn"/> event handler sets
- /// <see cref="OpenIdEventArgs.Cancel"/> property to true.
- /// </summary>
- FormsAuthentication,
- }
-
- /// <summary>
- /// How an OpenID user session should be persisted across visits.
- /// </summary>
- public enum LoginPersistence {
- /// <summary>
- /// The user should only be logged in as long as the browser window remains open.
- /// Nothing is persisted to help the user on a return visit. Public kiosk mode.
- /// </summary>
- Session,
-
- /// <summary>
- /// The user should only be logged in as long as the browser window remains open.
- /// The OpenID Identifier is persisted to help expedite re-authentication when
- /// the user visits the next time.
- /// </summary>
- SessionAndPersistentIdentifier,
-
- /// <summary>
- /// The user is issued a persistent authentication ticket so that no login is
- /// necessary on their return visit.
- /// </summary>
- PersistentAuthentication,
- }
-
- /// <summary>
/// Gets or sets the <see cref="OpenIdRelyingParty"/> instance to use.
/// </summary>
/// <value>The default value is an <see cref="OpenIdRelyingParty"/> instance initialized according to the web.config file.</value>
@@ -385,19 +386,19 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
[Bindable(true), DefaultValue(UsePersistentCookieDefault), Category(BehaviorCategory)]
[Description("Whether to send a persistent cookie upon successful " +
"login so the user does not have to log in upon returning to this site.")]
- public virtual LoginPersistence UsePersistentCookie {
- get { return (LoginPersistence)(this.ViewState[UsePersistentCookieViewStateKey] ?? UsePersistentCookieDefault); }
+ public virtual LogOnPersistence UsePersistentCookie {
+ get { return (LogOnPersistence)(this.ViewState[UsePersistentCookieViewStateKey] ?? UsePersistentCookieDefault); }
set { this.ViewState[UsePersistentCookieViewStateKey] = value; }
}
/// <summary>
/// Gets or sets the way a completed login is communicated to the rest of the web site.
/// </summary>
- [Bindable(true), DefaultValue(LoginModeDefault), Category(BehaviorCategory)]
+ [Bindable(true), DefaultValue(LogOnModeDefault), Category(BehaviorCategory)]
[Description("The way a completed login is communicated to the rest of the web site.")]
- public virtual LoginSiteNotification LoginMode {
- get { return (LoginSiteNotification)(this.ViewState[LoginModeViewStateKey] ?? LoginModeDefault); }
- set { this.ViewState[LoginModeViewStateKey] = value; }
+ public virtual LogOnSiteNotification LogOnMode {
+ get { return (LogOnSiteNotification)(this.ViewState[LogOnModeViewStateKey] ?? LogOnModeDefault); }
+ set { this.ViewState[LogOnModeViewStateKey] = value; }
}
/// <summary>
@@ -553,7 +554,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
// This is so the window can be made the correct size for the extension.
// If the OP doesn't advertise support for the extension, the javascript will use
// a bigger popup window.
- req.SetCallbackArgument(PopupUISupportedJsHint, "1");
+ req.SetCallbackArgument(PopupUISupportedJSHint, "1");
}
}
@@ -624,7 +625,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
}
string persistentString = response.GetCallbackArgument(UsePersistentCookieCallbackKey);
if (persistentString != null) {
- this.UsePersistentCookie = (LoginPersistence)Enum.Parse(typeof(LoginPersistence), persistentString);
+ this.UsePersistentCookie = (LogOnPersistence)Enum.Parse(typeof(LogOnPersistence), persistentString);
}
switch (response.Status) {
@@ -675,15 +676,15 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
}
if (!args.Cancel) {
- if (this.UsePersistentCookie == LoginPersistence.SessionAndPersistentIdentifier) {
+ if (this.UsePersistentCookie == LogOnPersistence.SessionAndPersistentIdentifier) {
Page.Response.SetCookie(CreateIdentifierPersistingCookie(response));
}
- switch (this.LoginMode) {
- case LoginSiteNotification.FormsAuthentication:
- FormsAuthentication.RedirectFromLoginPage(response.ClaimedIdentifier, this.UsePersistentCookie == LoginPersistence.PersistentAuthentication);
+ switch (this.LogOnMode) {
+ case LogOnSiteNotification.FormsAuthentication:
+ FormsAuthentication.RedirectFromLoginPage(response.ClaimedIdentifier, this.UsePersistentCookie == LogOnPersistence.PersistentAuthentication);
break;
- case LoginSiteNotification.None:
+ case LogOnSiteNotification.None:
default:
break;
}
diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdTextBox.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdTextBox.cs
index 7f2d821..0544d40 100644
--- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdTextBox.cs
+++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdTextBox.cs
@@ -633,6 +633,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// <summary>
/// When implemented by a class, signals the server control to notify the ASP.NET application that the state of the control has changed.
/// </summary>
+ [SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate", Justification = "Preserve signature of interface we're implementing.")]
protected virtual void RaisePostDataChangedEvent() {
this.OnTextChanged();
}