diff options
Diffstat (limited to 'src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty')
12 files changed, 58 insertions, 58 deletions
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs index d8b8840..eb501c5 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs @@ -42,8 +42,8 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <param name="associationStore">The association store. May be null for dumb mode relying parties.</param> /// <param name="securitySettings">The security settings.</param> internal AssociationManager(Channel channel, IRelyingPartyAssociationStore associationStore, RelyingPartySecuritySettings securitySettings) { - Contract.Requires<ArgumentNullException>(channel != null); - Contract.Requires<ArgumentNullException>(securitySettings != null); + Requires.NotNull(channel, "channel"); + Requires.NotNull(securitySettings, "securitySettings"); this.channel = channel; this.associationStore = associationStore; @@ -60,7 +60,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { } set { - Contract.Requires<ArgumentNullException>(value != null); + Requires.NotNull(value, "value"); this.channel = value; } } @@ -74,7 +74,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { } set { - Contract.Requires<ArgumentNullException>(value != null); + Requires.NotNull(value, "value"); this.securitySettings = value; } } @@ -104,7 +104,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <param name="provider">The provider to create an association with.</param> /// <returns>The association if one exists and has useful life remaining. Otherwise <c>null</c>.</returns> internal Association GetExistingAssociation(IProviderEndpoint provider) { - Contract.Requires<ArgumentNullException>(provider != null); + Requires.NotNull(provider, "provider"); // If the RP has no application store for associations, there's no point in creating one. if (this.associationStore == null) { @@ -149,7 +149,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// Any new association is automatically added to the <see cref="associationStore"/>. /// </remarks> private Association CreateNewAssociation(IProviderEndpoint provider) { - Contract.Requires<ArgumentNullException>(provider != null); + Requires.NotNull(provider, "provider"); // If there is no association store, there is no point in creating an association. if (this.associationStore == null) { @@ -183,7 +183,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// the given Provider given the current security settings. /// </returns> private Association CreateNewAssociation(IProviderEndpoint provider, AssociateRequest associateRequest, int retriesRemaining) { - Contract.Requires<ArgumentNullException>(provider != null); + Requires.NotNull(provider, "provider"); if (associateRequest == null || retriesRemaining < 0) { // this can happen if security requirements and protocol conflict diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Associations.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Associations.cs index b171bec..e65750f 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Associations.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Associations.cs @@ -60,7 +60,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </summary> /// <param name="association">The association to add to the collection.</param> public void Set(Association association) { - Contract.Requires<ArgumentNullException>(association != null); + Requires.NotNull(association, "association"); Contract.Ensures(this.Get(association.Handle) == association); lock (this.associations) { this.associations.Remove(association.Handle); // just in case one already exists. @@ -77,7 +77,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <returns>The desired association, or null if none with the given handle could be found.</returns> [Pure] public Association Get(string handle) { - Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(handle)); + Requires.NotNullOrEmpty(handle, "handle"); lock (this.associations) { if (this.associations.Contains(handle)) { @@ -94,7 +94,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <param name="handle">The handle to the required association.</param> /// <returns>Whether an <see cref="Association"/> with the given handle was in the collection for removal.</returns> public bool Remove(string handle) { - Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(handle)); + Requires.NotNullOrEmpty(handle, "handle"); lock (this.associations) { return this.associations.Remove(handle); } diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AuthenticationRequest.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AuthenticationRequest.cs index d79038c..f742a3d 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AuthenticationRequest.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AuthenticationRequest.cs @@ -69,10 +69,10 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <param name="returnToUrl">The base return_to URL that the Provider should return the user to to complete authentication. This should not include callback parameters as these should be added using the <see cref="AddCallbackArguments(string, string)"/> method.</param> /// <param name="relyingParty">The relying party that created this instance.</param> private AuthenticationRequest(IdentifierDiscoveryResult discoveryResult, Realm realm, Uri returnToUrl, OpenIdRelyingParty relyingParty) { - Contract.Requires<ArgumentNullException>(discoveryResult != null); - Contract.Requires<ArgumentNullException>(realm != null); - Contract.Requires<ArgumentNullException>(returnToUrl != null); - Contract.Requires<ArgumentNullException>(relyingParty != null); + Requires.NotNull(discoveryResult, "discoveryResult"); + Requires.NotNull(realm, "realm"); + Requires.NotNull(returnToUrl, "returnToUrl"); + Requires.NotNull(relyingParty, "relyingParty"); this.DiscoveryResult = discoveryResult; this.RelyingParty = relyingParty; @@ -319,9 +319,9 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// Never null, but may be empty. /// </returns> internal static IEnumerable<AuthenticationRequest> Create(Identifier userSuppliedIdentifier, OpenIdRelyingParty relyingParty, Realm realm, Uri returnToUrl, bool createNewAssociationsAsNeeded) { - Contract.Requires<ArgumentNullException>(userSuppliedIdentifier != null); - Contract.Requires<ArgumentNullException>(relyingParty != null); - Contract.Requires<ArgumentNullException>(realm != null); + Requires.NotNull(userSuppliedIdentifier, "userSuppliedIdentifier"); + Requires.NotNull(relyingParty, "relyingParty"); + Requires.NotNull(realm, "realm"); Contract.Ensures(Contract.Result<IEnumerable<AuthenticationRequest>>() != null); // Normalize the portion of the return_to path that correlates to the realm for capitalization. @@ -496,8 +496,8 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <param name="relyingParty">The relying party.</param> /// <returns>A filtered and sorted list of endpoints; may be empty if the input was empty or the filter removed all endpoints.</returns> private static List<IdentifierDiscoveryResult> FilterAndSortEndpoints(IEnumerable<IdentifierDiscoveryResult> endpoints, OpenIdRelyingParty relyingParty) { - Contract.Requires<ArgumentNullException>(endpoints != null); - Contract.Requires<ArgumentNullException>(relyingParty != null); + Requires.NotNull(endpoints, "endpoints"); + Requires.NotNull(relyingParty, "relyingParty"); bool anyFilteredOut = false; var filteredEndpoints = new List<IdentifierDiscoveryResult>(); diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/CryptoKeyStoreAsRelyingPartyAssociationStore.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/CryptoKeyStoreAsRelyingPartyAssociationStore.cs index 02ed3b0..1614145 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/CryptoKeyStoreAsRelyingPartyAssociationStore.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/CryptoKeyStoreAsRelyingPartyAssociationStore.cs @@ -24,7 +24,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </summary> /// <param name="keyStore">The key store.</param> internal CryptoKeyStoreAsRelyingPartyAssociationStore(ICryptoKeyStore keyStore) { - Contract.Requires<ArgumentNullException>(keyStore != null); + Requires.NotNull(keyStore, "keyStore"); Contract.Ensures(this.keyStore == keyStore); this.keyStore = keyStore; } diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/FailedAuthenticationResponse.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/FailedAuthenticationResponse.cs index 682e3ff..b9266d3 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/FailedAuthenticationResponse.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/FailedAuthenticationResponse.cs @@ -28,7 +28,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </summary> /// <param name="exception">The exception that resulted in the failed authentication.</param> internal FailedAuthenticationResponse(Exception exception) { - Contract.Requires<ArgumentNullException>(exception != null); + Requires.NotNull(exception, "exception"); this.Exception = exception; diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/IRelyingPartyAssociationStore.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/IRelyingPartyAssociationStore.cs index 21a2c53..52e828c 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/IRelyingPartyAssociationStore.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/IRelyingPartyAssociationStore.cs @@ -88,8 +88,8 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// TODO: what should implementations do on association handle conflict? /// </remarks> void IRelyingPartyAssociationStore.StoreAssociation(Uri providerEndpoint, Association association) { - Contract.Requires<ArgumentNullException>(providerEndpoint != null); - Contract.Requires<ArgumentNullException>(association != null); + Requires.NotNull(providerEndpoint, "providerEndpoint"); + Requires.NotNull(association, "association"); throw new NotImplementedException(); } @@ -111,8 +111,8 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// ignored and a new association created. /// </remarks> Association IRelyingPartyAssociationStore.GetAssociation(Uri providerEndpoint, SecuritySettings securityRequirements) { - Contract.Requires<ArgumentNullException>(providerEndpoint != null); - Contract.Requires<ArgumentNullException>(securityRequirements != null); + Requires.NotNull(providerEndpoint, "providerEndpoint"); + Requires.NotNull(securityRequirements, "securityRequirements"); throw new NotImplementedException(); } @@ -125,7 +125,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// The requested association, or null if no unexpired <see cref="Association"/>s exist for the given key and handle. /// </returns> Association IRelyingPartyAssociationStore.GetAssociation(Uri providerEndpoint, string handle) { - Contract.Requires<ArgumentNullException>(providerEndpoint != null); + Requires.NotNull(providerEndpoint, "providerEndpoint"); Contract.Requires(!String.IsNullOrEmpty(handle)); throw new NotImplementedException(); } @@ -143,7 +143,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// before this call. /// </remarks> bool IRelyingPartyAssociationStore.RemoveAssociation(Uri providerEndpoint, string handle) { - Contract.Requires<ArgumentNullException>(providerEndpoint != null); + Requires.NotNull(providerEndpoint, "providerEndpoint"); Contract.Requires(!String.IsNullOrEmpty(handle)); throw new NotImplementedException(); } diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/ISetupRequiredAuthenticationResponse.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/ISetupRequiredAuthenticationResponse.cs index cfbccef..2942c9d 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/ISetupRequiredAuthenticationResponse.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/ISetupRequiredAuthenticationResponse.cs @@ -41,7 +41,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </summary> Identifier ISetupRequiredAuthenticationResponse.UserSuppliedIdentifier { get { - Contract.Requires<InvalidOperationException>(((IAuthenticationResponse)this).Status == AuthenticationStatus.SetupRequired, OpenIdStrings.OperationOnlyValidForSetupRequiredState); + Requires.ValidState(((IAuthenticationResponse)this).Status == AuthenticationStatus.SetupRequired, OpenIdStrings.OperationOnlyValidForSetupRequiredState); throw new System.NotImplementedException(); } } diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/NegativeAuthenticationResponse.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/NegativeAuthenticationResponse.cs index 9e3824d..e6b84f5 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/NegativeAuthenticationResponse.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/NegativeAuthenticationResponse.cs @@ -29,7 +29,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </summary> /// <param name="response">The negative assertion response received by the Relying Party.</param> internal NegativeAuthenticationResponse(NegativeAssertionResponse response) { - Contract.Requires<ArgumentNullException>(response != null); + Requires.NotNull(response, "response"); this.response = response; Reporting.RecordEventOccurrence(this, string.Empty); diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs index d39d2ca..20382b3 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs @@ -114,7 +114,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { // If we are a smart-mode RP (supporting associations), then we MUST also be // capable of storing nonces to prevent replay attacks. // If we're a dumb-mode RP, then 2.0 OPs are responsible for preventing replays. - Contract.Requires<ArgumentException>(cryptoKeyStore == null || nonceStore != null, OpenIdStrings.AssociationStoreRequiresNonceStore); + Requires.True(cryptoKeyStore == null || nonceStore != null, null, OpenIdStrings.AssociationStoreRequiresNonceStore); this.securitySettings = OpenIdElement.Configuration.RelyingParty.SecuritySettings.CreateSecuritySettings(); @@ -195,7 +195,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { } set { - Contract.Requires<ArgumentNullException>(value != null); + Requires.NotNull(value, "value"); this.channel = value; this.AssociationManager.Channel = value; } @@ -211,7 +211,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { } internal set { - Contract.Requires<ArgumentNullException>(value != null); + Requires.NotNull(value, "value"); this.securitySettings = value; this.AssociationManager.SecuritySettings = value; } @@ -244,7 +244,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { } set { - Contract.Requires<ArgumentNullException>(value != null); + Requires.NotNull(value, "value"); this.endpointOrder = value; } } @@ -335,9 +335,9 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </returns> /// <exception cref="ProtocolException">Thrown if no OpenID endpoint could be found.</exception> public IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier, Realm realm, Uri returnToUrl) { - Contract.Requires<ArgumentNullException>(userSuppliedIdentifier != null); - Contract.Requires<ArgumentNullException>(realm != null); - Contract.Requires<ArgumentNullException>(returnToUrl != null); + Requires.NotNull(userSuppliedIdentifier, "userSuppliedIdentifier"); + Requires.NotNull(realm, "realm"); + Requires.NotNull(returnToUrl, "returnToUrl"); Contract.Ensures(Contract.Result<IAuthenticationRequest>() != null); try { return this.CreateRequests(userSuppliedIdentifier, realm, returnToUrl).First(); @@ -368,8 +368,8 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <exception cref="ProtocolException">Thrown if no OpenID endpoint could be found.</exception> /// <exception cref="InvalidOperationException">Thrown if <see cref="HttpContext.Current">HttpContext.Current</see> == <c>null</c>.</exception> public IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier, Realm realm) { - Contract.Requires<ArgumentNullException>(userSuppliedIdentifier != null); - Contract.Requires<ArgumentNullException>(realm != null); + Requires.NotNull(userSuppliedIdentifier, "userSuppliedIdentifier"); + Requires.NotNull(realm, "realm"); Contract.Ensures(Contract.Result<IAuthenticationRequest>() != null); try { var result = this.CreateRequests(userSuppliedIdentifier, realm).First(); @@ -397,7 +397,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <exception cref="ProtocolException">Thrown if no OpenID endpoint could be found.</exception> /// <exception cref="InvalidOperationException">Thrown if <see cref="HttpContext.Current">HttpContext.Current</see> == <c>null</c>.</exception> public IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier) { - Contract.Requires<ArgumentNullException>(userSuppliedIdentifier != null); + Requires.NotNull(userSuppliedIdentifier, "userSuppliedIdentifier"); Contract.Ensures(Contract.Result<IAuthenticationRequest>() != null); try { return this.CreateRequests(userSuppliedIdentifier).First(); @@ -434,9 +434,9 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// An empty enumerable is returned instead.</para> /// </remarks> public virtual IEnumerable<IAuthenticationRequest> CreateRequests(Identifier userSuppliedIdentifier, Realm realm, Uri returnToUrl) { - Contract.Requires<ArgumentNullException>(userSuppliedIdentifier != null); - Contract.Requires<ArgumentNullException>(realm != null); - Contract.Requires<ArgumentNullException>(returnToUrl != null); + Requires.NotNull(userSuppliedIdentifier, "userSuppliedIdentifier"); + Requires.NotNull(realm, "realm"); + Requires.NotNull(returnToUrl, "returnToUrl"); Contract.Ensures(Contract.Result<IEnumerable<IAuthenticationRequest>>() != null); return AuthenticationRequest.Create(userSuppliedIdentifier, this, realm, returnToUrl, true).Cast<IAuthenticationRequest>().CacheGeneratedResults(); @@ -468,9 +468,9 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </remarks> /// <exception cref="InvalidOperationException">Thrown if <see cref="HttpContext.Current">HttpContext.Current</see> == <c>null</c>.</exception> public IEnumerable<IAuthenticationRequest> CreateRequests(Identifier userSuppliedIdentifier, Realm realm) { - Contract.Requires<InvalidOperationException>(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); - Contract.Requires<ArgumentNullException>(userSuppliedIdentifier != null); - Contract.Requires<ArgumentNullException>(realm != null); + Requires.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); + Requires.NotNull(userSuppliedIdentifier, "userSuppliedIdentifier"); + Requires.NotNull(realm, "realm"); Contract.Ensures(Contract.Result<IEnumerable<IAuthenticationRequest>>() != null); // This next code contract is a BAD idea, because it causes each authentication request to be generated @@ -516,8 +516,8 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </remarks> /// <exception cref="InvalidOperationException">Thrown if <see cref="HttpContext.Current">HttpContext.Current</see> == <c>null</c>.</exception> public IEnumerable<IAuthenticationRequest> CreateRequests(Identifier userSuppliedIdentifier) { - Contract.Requires<ArgumentNullException>(userSuppliedIdentifier != null); - Contract.Requires<InvalidOperationException>(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); + Requires.NotNull(userSuppliedIdentifier, "userSuppliedIdentifier"); + Requires.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); Contract.Ensures(Contract.Result<IEnumerable<IAuthenticationRequest>>() != null); return this.CreateRequests(userSuppliedIdentifier, Realm.AutoDetect); @@ -531,7 +531,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <para>Requires an <see cref="HttpContext.Current">HttpContext.Current</see> context.</para> /// </remarks> public IAuthenticationResponse GetResponse() { - Contract.Requires<InvalidOperationException>(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); + Requires.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); return this.GetResponse(this.Channel.GetRequestFromContext()); } @@ -541,7 +541,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <param name="httpRequestInfo">The HTTP request that may be carrying an authentication response from the Provider.</param> /// <returns>The processed authentication response if there is any; <c>null</c> otherwise.</returns> public IAuthenticationResponse GetResponse(HttpRequestInfo httpRequestInfo) { - Contract.Requires<ArgumentNullException>(httpRequestInfo != null); + Requires.NotNull(httpRequestInfo, "httpRequestInfo"); try { var message = this.Channel.ReadFromRequest(httpRequestInfo); PositiveAssertionResponse positiveAssertion; @@ -584,7 +584,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <para>Requires an <see cref="HttpContext.Current">HttpContext.Current</see> context.</para> /// </remarks> public OutgoingWebResponse ProcessResponseFromPopup() { - Contract.Requires<InvalidOperationException>(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); + Requires.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null); return this.ProcessResponseFromPopup(this.Channel.GetRequestFromContext()); @@ -596,7 +596,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <param name="request">The incoming HTTP request that is expected to carry an OpenID authentication response.</param> /// <returns>The HTTP response to send to this HTTP request.</returns> public OutgoingWebResponse ProcessResponseFromPopup(HttpRequestInfo request) { - Contract.Requires<ArgumentNullException>(request != null); + Requires.NotNull(request, "request"); Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null); return this.ProcessResponseFromPopup(request, null); @@ -614,7 +614,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </remarks> [SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "By design")] public void RegisterClientScriptExtension<T>(string propertyName) where T : IClientScriptExtensionResponse { - Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(propertyName)); + Requires.NotNullOrEmpty(propertyName, "propertyName"); ErrorUtilities.VerifyArgumentNamed(!this.clientScriptExtensions.ContainsValue(propertyName), "propertyName", OpenIdStrings.ClientScriptExtensionPropertyNameCollision, propertyName); foreach (var ext in this.clientScriptExtensions.Keys) { ErrorUtilities.VerifyArgument(ext != typeof(T), OpenIdStrings.ClientScriptExtensionTypeCollision, typeof(T).FullName); @@ -683,7 +683,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </returns> [SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "OpenID", Justification = "real word"), SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "iframe", Justification = "Code contracts")] internal OutgoingWebResponse ProcessResponseFromPopup(HttpRequestInfo request, Action<AuthenticationStatus> callback) { - Contract.Requires<ArgumentNullException>(request != null); + Requires.NotNull(request, "request"); Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null); string extensionsJson = null; @@ -740,7 +740,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <param name="identifier">The identifier to discover services for.</param> /// <returns>A non-null sequence of services discovered for the identifier.</returns> internal IEnumerable<IdentifierDiscoveryResult> Discover(Identifier identifier) { - Contract.Requires<ArgumentNullException>(identifier != null); + Requires.NotNull(identifier, "identifier"); Contract.Ensures(Contract.Result<IEnumerable<IdentifierDiscoveryResult>>() != null); IEnumerable<IdentifierDiscoveryResult> results = Enumerable.Empty<IdentifierDiscoveryResult>(); @@ -828,7 +828,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// parameters. (i.e. "callback('arg1', 2)"). No escaping is done by this method.</param> /// <returns>The entire HTTP response to send to the popup window or iframe to perform the invocation.</returns> private static OutgoingWebResponse InvokeParentPageScript(string methodCall) { - Contract.Requires<ArgumentException>(!string.IsNullOrEmpty(methodCall)); + Requires.NotNullOrEmpty(methodCall, "methodCall"); Logger.OpenId.DebugFormat("Sending Javascript callback: {0}", methodCall); StringBuilder builder = new StringBuilder(); diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAnonymousResponse.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAnonymousResponse.cs index fc334b0..de82bed 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAnonymousResponse.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAnonymousResponse.cs @@ -33,7 +33,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </summary> /// <param name="response">The response message.</param> protected internal PositiveAnonymousResponse(IndirectSignedResponse response) { - Contract.Requires<ArgumentNullException>(response != null); + Requires.NotNull(response, "response"); this.response = response; if (response.ProviderEndpoint != null && response.Version != null) { diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponse.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponse.cs index 3e2298c..1123912 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponse.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponse.cs @@ -26,7 +26,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// <param name="relyingParty">The relying party.</param> internal PositiveAuthenticationResponse(PositiveAssertionResponse response, OpenIdRelyingParty relyingParty) : base(response) { - Contract.Requires<ArgumentNullException>(relyingParty != null); + Requires.NotNull(relyingParty, "relyingParty"); this.Endpoint = IdentifierDiscoveryResult.CreateForClaimedIdentifier( this.Response.ClaimedIdentifier, diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponseSnapshot.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponseSnapshot.cs index 80b424a..141b4f7 100644 --- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponseSnapshot.cs +++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponseSnapshot.cs @@ -33,7 +33,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { /// </summary> /// <param name="copyFrom">The authentication response to copy from.</param> internal PositiveAuthenticationResponseSnapshot(IAuthenticationResponse copyFrom) { - Contract.Requires<ArgumentNullException>(copyFrom != null); + Requires.NotNull(copyFrom, "copyFrom"); this.ClaimedIdentifier = copyFrom.ClaimedIdentifier; this.FriendlyIdentifierForDisplay = copyFrom.FriendlyIdentifierForDisplay; |