summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/DotNetOpenAuth.Core.UI/ComponentModel/ConverterBase.cs3
-rw-r--r--src/DotNetOpenAuth.Core.UI/ComponentModel/SuggestedStringsConverter.cs2
-rw-r--r--src/DotNetOpenAuth.Core.UI/ComponentModel/SuggestedStringsConverterContract.cs30
-rw-r--r--src/DotNetOpenAuth.Core.UI/DotNetOpenAuth.Core.UI.csproj1
-rw-r--r--src/DotNetOpenAuth.Core.UI/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.Core/Configuration/DotNetOpenAuthSection.cs2
-rw-r--r--src/DotNetOpenAuth.Core/Configuration/HostNameElement.cs2
-rw-r--r--src/DotNetOpenAuth.Core/Configuration/HostNameOrRegexCollection.cs2
-rw-r--r--src/DotNetOpenAuth.Core/Configuration/MessagingElement.cs3
-rw-r--r--src/DotNetOpenAuth.Core/Configuration/ReportingElement.cs2
-rw-r--r--src/DotNetOpenAuth.Core/Configuration/TrustedProviderConfigurationCollection.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Configuration/TypeConfigurationCollection.cs3
-rw-r--r--src/DotNetOpenAuth.Core/Configuration/TypeConfigurationElement.cs6
-rw-r--r--src/DotNetOpenAuth.Core/Configuration/UntrustedWebRequestElement.cs1
-rw-r--r--src/DotNetOpenAuth.Core/DotNetOpenAuth.Core.csproj5
-rw-r--r--src/DotNetOpenAuth.Core/Logger.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/BinaryDataBagFormatter.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/Bindings/AsymmetricCryptoKeyStoreWrapper.cs11
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/Bindings/CryptoKey.cs3
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/Bindings/ExpiredMessageException.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/Bindings/ICryptoKeyStore.cs60
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/Bindings/StandardReplayProtectionBindingElement.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/CachedDirectWebResponse.cs7
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/Channel.cs33
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/ChannelContract.cs55
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/ChannelEventArgs.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/DataBag.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/DataBagFormatterBase.cs2
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/EnumerableCacheExtensions.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/ErrorUtilities.cs57
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IChannelBindingElement.cs82
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IDataBagFormatter.cs48
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IDirectWebRequestHandler.cs119
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IHttpDirectRequest.cs2
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IHttpDirectRequestContract.cs75
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IHttpDirectResponse.cs2
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IHttpDirectResponseContract.cs43
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IHttpIndirectResponse.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IMessage.cs53
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IMessageFactory.cs51
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IMessageOriginalPayload.cs16
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IMessageWithBinaryData.cs127
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IProtocolMessageWithExtensions.cs93
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IStreamSerializingDataBag.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IncomingWebResponse.cs3
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/IncomingWebResponseContract.cs55
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/KeyedCollectionDelegate.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/MessageReceivingEndpoint.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/MessageSerializer.cs11
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs13
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/MultipartPostPart.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/NetworkDirectWebResponse.cs2
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponseActionResult.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/ProtocolException.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/Reflection/IMessagePartEncoder.cs43
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescription.cs2
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescriptionCollection.cs6
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDictionary.cs4
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/Reflection/MessagePart.cs13
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/Reflection/ValueMapping.cs2
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/StandardMessageFactory.cs4
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/StandardMessageFactoryChannel.cs2
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/UriStyleMessageFormatter.cs1
-rw-r--r--src/DotNetOpenAuth.Core/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.Core/PureAttribute.cs22
-rw-r--r--src/DotNetOpenAuth.Core/Reporting.cs4
-rw-r--r--src/DotNetOpenAuth.Core/RequiresEx.cs25
-rw-r--r--src/DotNetOpenAuth.Core/UriUtil.cs16
-rw-r--r--src/DotNetOpenAuth.Core/Util.cs5
-rw-r--r--src/DotNetOpenAuth.InfoCard.UI/InfoCard/ClaimType.cs2
-rw-r--r--src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardImage.cs3
-rw-r--r--src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardSelector.cs13
-rw-r--r--src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivedTokenEventArgs.cs1
-rw-r--r--src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivingTokenEventArgs.cs1
-rw-r--r--src/DotNetOpenAuth.InfoCard.UI/InfoCard/TokenProcessingErrorEventArgs.cs1
-rw-r--r--src/DotNetOpenAuth.InfoCard.UI/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.InfoCard/InfoCard/Token/Token.cs9
-rw-r--r--src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenDecryptor.cs2
-rw-r--r--src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenUtility.cs5
-rw-r--r--src/DotNetOpenAuth.InfoCard/InfoCardErrorUtilities.cs4
-rw-r--r--src/DotNetOpenAuth.InfoCard/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OAuth.Common/OAuth/ChannelElements/OAuthIdentity.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth.Common/OAuth/ChannelElements/OAuthPrincipal.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth.Common/Properties/AssemblyInfo.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerMessageFactory.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/ConsumerBase.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/OAuth/WebConsumer.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth.Consumer/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/IServiceProviderTokenManager.cs171
-rw-r--r--src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderChannel.cs3
-rw-r--r--src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderMessageFactory.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/RsaSha1ServiceProviderSigningBindingElement.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/TokenHandlingBindingElement.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ServiceProvider.cs3
-rw-r--r--src/DotNetOpenAuth.OAuth.ServiceProvider/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OAuth/Configuration/OAuthElement.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj1
-rw-r--r--src/DotNetOpenAuth.OAuth/Messaging/ITamperProtectionChannelBindingElement.cs96
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/HmacSha1SigningBindingElement.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/ITokenManager.cs94
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/RsaSha1SigningBindingElement.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBase.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBaseContract.cs48
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementChain.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/UriOrOobEncoding.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/Messages/MessageBase.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/Messages/UnauthorizedTokenResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/Protocol.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuth/ServiceProviderDescription.cs3
-rw-r--r--src/DotNetOpenAuth.OAuth/OAuthReporting.cs8
-rw-r--r--src/DotNetOpenAuth.OAuth/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OAuth2.AuthorizationServer/Configuration/OAuth2AuthorizationServerSection.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthServerUtilities.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs4
-rw-r--r--src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServerAccessToken.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/AuthorizationCode.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/RefreshToken.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/IAuthorizationServerHost.cs132
-rw-r--r--src/DotNetOpenAuth.OAuth2.AuthorizationServer/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OAuth2.Client.UI/OAuth2/ClientAuthorizationView.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.Client.UI/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OAuth2.Client/Configuration/OAuth2ClientSection.cs5
-rw-r--r--src/DotNetOpenAuth.OAuth2.Client/OAuth2/ChannelElements/OAuth2ClientChannel.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.Client/OAuth2/ClientBase.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth2.Client/OAuth2/IClientAuthorizationTracker.cs31
-rw-r--r--src/DotNetOpenAuth.OAuth2.Client/OAuth2/UserAgentClient.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth2.Client/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/IClientDescription.cs68
-rw-r--r--src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/AccessTokenAuthorizationCodeRequest.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationFailedResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationRequest.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessAccessTokenResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessAuthCodeResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessResponseBase.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.ClientAuthorization/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OAuth2.ResourceServer/Configuration/OAuth2ResourceServerSection.cs2
-rw-r--r--src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/IAccessTokenAnalyzer.cs28
-rw-r--r--src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ResourceServer.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2.ResourceServer/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OAuth2/Configuration/OAuth2SectionGroup.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs7
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationDescription.cs54
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/Messages/MessageBase.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs1
-rw-r--r--src/DotNetOpenAuth.OAuth2/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/AnonymousRequestEventArgs.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/ProviderEndpoint.cs5
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider.UI/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj2
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/OpenIdProviderChannel.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/ProviderSigningBindingElement.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateDiffieHellmanProviderResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateRequestProviderTools.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/CheckAuthenticationResponseProvider.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProvider.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProviderContract.cs97
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AnonymousRequest.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AuthenticationRequest.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/GsaIcamProfile.cs6
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/PpidGeneration.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/ExtensionsInteropHelper.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/UI/UIRequestTools.cs6
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HmacShaAssociationProvider.cs8
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs41
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IProviderAssociationStore.cs40
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProvider.cs12
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProviderUtilities.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/PrivatePersonalIdentifierProviderBase.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationHandleEncoder.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationKeyStorage.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Request.cs4
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/RequestContract.cs48
-rw-r--r--src/DotNetOpenAuth.OpenId.Provider/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/Mvc/OpenIdHelper.cs7
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxRelyingParty.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxTextBox.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdEventArgs.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdMobileTextBox.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdSelector.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdTextBox.cs7
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButton.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButtonContract.cs47
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorOpenIdButton.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorProviderButton.cs4
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty.UI/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/ExtensionsBindingElementRelyingParty.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/OpenIdRelyingPartyChannel.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/RelyingPartySigningBindingElement.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/ReturnToNonceBindingElement.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/HostMetaDiscoveryService.cs7
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/AuthenticationResponseShim.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/ClaimsResponseShim.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateDiffieHellmanRelyingPartyResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateRequestRelyingParty.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/IAssociateSuccessfulResponseRelyingParty.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/IAssociateSuccessfulResponseRelyingPartyContract.cs80
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Associations.cs6
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AuthenticationRequest.cs5
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Behaviors/GsaIcamProfile.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/CryptoKeyStoreAsRelyingPartyAssociationStore.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/ExtensionsInteropHelper.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/UIUtilities.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/FailedAuthenticationResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/IRelyingPartyAssociationStore.cs81
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/ISetupRequiredAuthenticationResponse.cs29
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/NegativeAuthenticationResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs19
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAnonymousResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponseSnapshot.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId.RelyingParty/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId.UI/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId.UI/XrdsPublisher.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId/Configuration/AssociationTypeCollection.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId/Configuration/AssociationTypeElement.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId/Configuration/OpenIdElement.cs6
-rw-r--r--src/DotNetOpenAuth.OpenId/Configuration/OpenIdProviderElement.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId/Configuration/OpenIdProviderSecuritySettingsElement.cs5
-rw-r--r--src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartyElement.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartySecuritySettingsElement.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId/DotNetOpenAuth.OpenId.csproj5
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Association.cs10
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/AssociationContract.cs66
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Behaviors/GsaIcamProfileBase.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/ExtensionsBindingElement.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/KeyValueFormEncoding.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/OpenIdChannel.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/ReturnToSignatureBindingElement.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/SigningBindingElement.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/SigningBindingElementContract.cs65
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/DiffieHellmanUtilities.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/AliasManager.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AXUtilities.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AttributeRequest.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AttributeValues.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/FetchRequest.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/FetchResponse.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/ExtensionArgumentsManager.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/OpenIdExtensionFactoryAggregator.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/OpenIdExtensionsInteropHelper.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/ProviderAuthenticationPolicy/PapeUtilities.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsRequest.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/UI/UIRequest.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Extensions/UI/UIUtilities.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/HmacShaAssociation.cs6
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/IIdentifierDiscoveryService.cs33
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/IProviderEndpoint.cs75
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Identifier.cs8
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/IdentifierContract.cs56
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/IdentifierDiscoveryResult.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/IdentifierDiscoveryServices.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateDiffieHellmanResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateRequest.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateSuccessfulResponse.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateSuccessfulResponseContract.cs17
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Messages/CheckAuthenticationRequest.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Messages/CheckAuthenticationResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Messages/DirectResponseBase.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Messages/IOpenIdMessageExtension.cs106
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Messages/IndirectResponseBase.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Messages/IndirectSignedResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Messages/NegativeAssertionResponse.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Messages/RequestBase.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Messages/SignedResponseRequest.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/NoDiscoveryIdentifier.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/OpenIdUtilities.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/OpenIdXrdsHelper.cs4
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Protocol.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Provider/IAuthenticationRequest.cs271
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Provider/IHostProcessedRequest.cs145
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Provider/IProviderBehavior.cs63
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Provider/IRequest.cs80
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/ProviderEndpointDescription.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/Realm.cs4
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationRequest.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationRequestContract.cs112
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationResponse.cs275
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IRelyingPartyBehavior.cs51
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/RelyingPartySecuritySettings.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/RelyingPartyEndpointDescription.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/SecuritySettings.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/UriIdentifier.cs5
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/XriDiscoveryProxyService.cs2
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/XriIdentifier.cs8
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenIdXrdsHelperRelyingParty.cs10
-rw-r--r--src/DotNetOpenAuth.OpenId/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OpenId/Xrds/TypeElement.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/Xrds/XrdsNode.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/Yadis/HtmlParser.cs1
-rw-r--r--src/DotNetOpenAuth.OpenId/Yadis/Yadis.cs3
-rw-r--r--src/DotNetOpenAuth.OpenIdInfoCard.UI/OpenId/RelyingParty/OpenIdInfoCardSelector.cs8
-rw-r--r--src/DotNetOpenAuth.OpenIdInfoCard.UI/OpenId/RelyingParty/SelectorInfoCardButton.cs1
-rw-r--r--src/DotNetOpenAuth.OpenIdInfoCard.UI/Properties/AssemblyInfo.cs3
-rw-r--r--src/DotNetOpenAuth.OpenIdOAuth/OAuth/ServiceProviderOpenIdProvider.cs1
-rw-r--r--src/DotNetOpenAuth.OpenIdOAuth/Properties/AssemblyInfo.cs2
-rw-r--r--src/DotNetOpenAuth.Test/AssemblyTesting.cs26
-rw-r--r--src/DotNetOpenAuth.Test/CoordinatorBase.cs1
-rw-r--r--src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj1
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs1
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs4
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs1
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs8
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthConsumerChannel.cs1
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthServiceProviderChannel.cs1
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs1
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs1
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs1
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/MockRealm.cs1
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/TestMessageFactory.cs1
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs1
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs5
-rw-r--r--src/DotNetOpenAuth.Test/OAuth/OAuthCoordinator.cs1
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs1
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs1
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs1
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/OpenIdCoordinator.cs1
-rw-r--r--src/DotNetOpenAuth.Test/Properties/AssemblyInfo.cs3
-rw-r--r--src/Mono.Math/Properties/AssemblyInfo.cs3
-rw-r--r--src/Org.Mentalis.Security.Cryptography/Properties/AssemblyInfo.cs3
-rw-r--r--src/packages/repositories.config2
342 files changed, 124 insertions, 4313 deletions
diff --git a/src/DotNetOpenAuth.Core.UI/ComponentModel/ConverterBase.cs b/src/DotNetOpenAuth.Core.UI/ComponentModel/ConverterBase.cs
index ca17197..eec2304 100644
--- a/src/DotNetOpenAuth.Core.UI/ComponentModel/ConverterBase.cs
+++ b/src/DotNetOpenAuth.Core.UI/ComponentModel/ConverterBase.cs
@@ -145,7 +145,7 @@ namespace DotNetOpenAuth.ComponentModel {
/// </exception>
[SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "System.Diagnostics.Contracts.__ContractsRuntime.Assume(System.Boolean,System.String,System.String)", Justification = "No localization required.")]
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
- Contract.Assume(destinationType != null, "Missing contract.");
+ Assumes.True(destinationType != null, "Missing contract.");
if (destinationType.IsInstanceOfType(value)) {
return value;
}
@@ -181,7 +181,6 @@ namespace DotNetOpenAuth.ComponentModel {
[Pure]
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Potentially expensive call.")]
protected virtual ICollection GetStandardValuesForCache() {
- Contract.Ensures(Contract.Result<ICollection>() != null);
return new T[0];
}
diff --git a/src/DotNetOpenAuth.Core.UI/ComponentModel/SuggestedStringsConverter.cs b/src/DotNetOpenAuth.Core.UI/ComponentModel/SuggestedStringsConverter.cs
index 126b140..fd960d3 100644
--- a/src/DotNetOpenAuth.Core.UI/ComponentModel/SuggestedStringsConverter.cs
+++ b/src/DotNetOpenAuth.Core.UI/ComponentModel/SuggestedStringsConverter.cs
@@ -17,7 +17,6 @@ namespace DotNetOpenAuth.ComponentModel {
/// A type that generates suggested strings for Intellisense,
/// but doesn't actually convert between strings and other types.
/// </summary>
- [ContractClass(typeof(SuggestedStringsConverterContract))]
public abstract class SuggestedStringsConverter : ConverterBase<string> {
/// <summary>
/// Initializes a new instance of the <see cref="SuggestedStringsConverter"/> class.
@@ -38,7 +37,6 @@ namespace DotNetOpenAuth.ComponentModel {
/// <returns>A collection of values.</returns>
internal static ICollection GetStandardValuesForCacheShared(Type type) {
Requires.NotNull(type, "type");
- Contract.Ensures(Contract.Result<ICollection>() != null);
var fields = from field in type.GetFields(BindingFlags.Static | BindingFlags.Public)
select field.GetValue(null);
diff --git a/src/DotNetOpenAuth.Core.UI/ComponentModel/SuggestedStringsConverterContract.cs b/src/DotNetOpenAuth.Core.UI/ComponentModel/SuggestedStringsConverterContract.cs
deleted file mode 100644
index dbd2278..0000000
--- a/src/DotNetOpenAuth.Core.UI/ComponentModel/SuggestedStringsConverterContract.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="SuggestedStringsConverterContract.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.ComponentModel {
- using System;
- using System.Collections;
- using System.ComponentModel.Design.Serialization;
- using System.Diagnostics.Contracts;
- using System.Linq;
- using System.Reflection;
-
- /// <summary>
- /// Contract class for the <see cref="SuggestedStringsConverter"/> class.
- /// </summary>
- [ContractClassFor(typeof(SuggestedStringsConverter))]
- internal abstract class SuggestedStringsConverterContract : SuggestedStringsConverter {
- /// <summary>
- /// Gets the type to reflect over for the well known values.
- /// </summary>
- protected override Type WellKnownValuesType {
- get {
- Contract.Ensures(Contract.Result<Type>() != null);
- throw new NotImplementedException();
- }
- }
- }
-}
diff --git a/src/DotNetOpenAuth.Core.UI/DotNetOpenAuth.Core.UI.csproj b/src/DotNetOpenAuth.Core.UI/DotNetOpenAuth.Core.UI.csproj
index 250dc2b..1b138c7 100644
--- a/src/DotNetOpenAuth.Core.UI/DotNetOpenAuth.Core.UI.csproj
+++ b/src/DotNetOpenAuth.Core.UI/DotNetOpenAuth.Core.UI.csproj
@@ -23,7 +23,6 @@
<Compile Include="ComponentModel\ClaimTypeSuggestions.cs" />
<Compile Include="ComponentModel\ConverterBase.cs" />
<Compile Include="ComponentModel\SuggestedStringsConverter.cs" />
- <Compile Include="ComponentModel\SuggestedStringsConverterContract.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
diff --git a/src/DotNetOpenAuth.Core.UI/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.Core.UI/Properties/AssemblyInfo.cs
index 4eb88a3..23a9f9b 100644
--- a/src/DotNetOpenAuth.Core.UI/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.Core.UI/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -33,8 +32,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.Core/Configuration/DotNetOpenAuthSection.cs b/src/DotNetOpenAuth.Core/Configuration/DotNetOpenAuthSection.cs
index 7c03c48..cdcd670 100644
--- a/src/DotNetOpenAuth.Core/Configuration/DotNetOpenAuthSection.cs
+++ b/src/DotNetOpenAuth.Core/Configuration/DotNetOpenAuthSection.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Configuration {
using System;
using System.Configuration;
- using System.Diagnostics.Contracts;
using System.Web;
using System.Web.Configuration;
@@ -15,7 +14,6 @@ namespace DotNetOpenAuth.Configuration {
/// Represents the section in the host's .config file that configures
/// this library's settings.
/// </summary>
- [ContractVerification(true)]
public class DotNetOpenAuthSection : ConfigurationSectionGroup {
/// <summary>
/// The name of the section under which this library's settings must be found.
diff --git a/src/DotNetOpenAuth.Core/Configuration/HostNameElement.cs b/src/DotNetOpenAuth.Core/Configuration/HostNameElement.cs
index b46ece9..5386314 100644
--- a/src/DotNetOpenAuth.Core/Configuration/HostNameElement.cs
+++ b/src/DotNetOpenAuth.Core/Configuration/HostNameElement.cs
@@ -6,12 +6,10 @@
namespace DotNetOpenAuth.Configuration {
using System.Configuration;
- using System.Diagnostics.Contracts;
/// <summary>
/// Represents the name of a single host or a regex pattern for host names.
/// </summary>
- [ContractVerification(true)]
internal class HostNameElement : ConfigurationElement {
/// <summary>
/// Gets the name of the @name attribute.
diff --git a/src/DotNetOpenAuth.Core/Configuration/HostNameOrRegexCollection.cs b/src/DotNetOpenAuth.Core/Configuration/HostNameOrRegexCollection.cs
index 27ba80e..8f537c3 100644
--- a/src/DotNetOpenAuth.Core/Configuration/HostNameOrRegexCollection.cs
+++ b/src/DotNetOpenAuth.Core/Configuration/HostNameOrRegexCollection.cs
@@ -7,14 +7,12 @@
namespace DotNetOpenAuth.Configuration {
using System.Collections.Generic;
using System.Configuration;
- using System.Diagnostics.Contracts;
using System.Text.RegularExpressions;
using Validation;
/// <summary>
/// Represents a collection of child elements that describe host names either as literal host names or regex patterns.
/// </summary>
- [ContractVerification(true)]
internal class HostNameOrRegexCollection : ConfigurationElementCollection {
/// <summary>
/// Initializes a new instance of the <see cref="HostNameOrRegexCollection"/> class.
diff --git a/src/DotNetOpenAuth.Core/Configuration/MessagingElement.cs b/src/DotNetOpenAuth.Core/Configuration/MessagingElement.cs
index ff98d36..64dfba3 100644
--- a/src/DotNetOpenAuth.Core/Configuration/MessagingElement.cs
+++ b/src/DotNetOpenAuth.Core/Configuration/MessagingElement.cs
@@ -7,14 +7,12 @@
namespace DotNetOpenAuth.Configuration {
using System;
using System.Configuration;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
/// <summary>
/// Represents the &lt;messaging&gt; element in the host's .config file.
/// </summary>
- [ContractVerification(true)]
public class MessagingElement : ConfigurationSection {
/// <summary>
/// The name of the &lt;webResourceUrlProvider&gt; sub-element.
@@ -75,7 +73,6 @@ namespace DotNetOpenAuth.Configuration {
/// </summary>
public static MessagingElement Configuration {
get {
- Contract.Ensures(Contract.Result<MessagingElement>() != null);
return (MessagingElement)ConfigurationManager.GetSection(MessagingElementName) ?? new MessagingElement();
}
}
diff --git a/src/DotNetOpenAuth.Core/Configuration/ReportingElement.cs b/src/DotNetOpenAuth.Core/Configuration/ReportingElement.cs
index 0af8205..f0184a6 100644
--- a/src/DotNetOpenAuth.Core/Configuration/ReportingElement.cs
+++ b/src/DotNetOpenAuth.Core/Configuration/ReportingElement.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Configuration {
using System;
using System.Collections.Generic;
using System.Configuration;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
@@ -76,7 +75,6 @@ namespace DotNetOpenAuth.Configuration {
/// </summary>
public static ReportingElement Configuration {
get {
- Contract.Ensures(Contract.Result<ReportingElement>() != null);
return (ReportingElement)ConfigurationManager.GetSection(ReportingElementName) ?? new ReportingElement();
}
}
diff --git a/src/DotNetOpenAuth.Core/Configuration/TrustedProviderConfigurationCollection.cs b/src/DotNetOpenAuth.Core/Configuration/TrustedProviderConfigurationCollection.cs
index 3f19d8c..de70f64 100644
--- a/src/DotNetOpenAuth.Core/Configuration/TrustedProviderConfigurationCollection.cs
+++ b/src/DotNetOpenAuth.Core/Configuration/TrustedProviderConfigurationCollection.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.Configuration {
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
diff --git a/src/DotNetOpenAuth.Core/Configuration/TypeConfigurationCollection.cs b/src/DotNetOpenAuth.Core/Configuration/TypeConfigurationCollection.cs
index 274622e..08bd2a1 100644
--- a/src/DotNetOpenAuth.Core/Configuration/TypeConfigurationCollection.cs
+++ b/src/DotNetOpenAuth.Core/Configuration/TypeConfigurationCollection.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Configuration {
using System;
using System.Collections.Generic;
using System.Configuration;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -18,7 +17,6 @@ namespace DotNetOpenAuth.Configuration {
/// A collection of <see cref="TypeConfigurationElement&lt;T&gt;"/>.
/// </summary>
/// <typeparam name="T">The type that all types specified in the elements must derive from.</typeparam>
- [ContractVerification(true)]
internal class TypeConfigurationCollection<T> : ConfigurationElementCollection
where T : class {
/// <summary>
@@ -45,7 +43,6 @@ namespace DotNetOpenAuth.Configuration {
/// <param name="allowInternals">if set to <c>true</c> then internal types may be instantiated.</param>
/// <returns>A sequence of instances generated from types in this collection. May be empty, but never null.</returns>
internal IEnumerable<T> CreateInstances(bool allowInternals) {
- Contract.Ensures(Contract.Result<IEnumerable<T>>() != null);
return from element in this.Cast<TypeConfigurationElement<T>>()
where !element.IsEmpty
select element.CreateInstance(default(T), allowInternals);
diff --git a/src/DotNetOpenAuth.Core/Configuration/TypeConfigurationElement.cs b/src/DotNetOpenAuth.Core/Configuration/TypeConfigurationElement.cs
index edbb614..a3a8140 100644
--- a/src/DotNetOpenAuth.Core/Configuration/TypeConfigurationElement.cs
+++ b/src/DotNetOpenAuth.Core/Configuration/TypeConfigurationElement.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Configuration {
using System;
using System.Configuration;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.IO;
using System.Reflection;
using System.Web;
@@ -82,8 +81,6 @@ namespace DotNetOpenAuth.Configuration {
/// <param name="defaultValue">The value to return if no type is given in the .config file.</param>
/// <returns>The newly instantiated type.</returns>
public T CreateInstance(T defaultValue) {
- Contract.Ensures(Contract.Result<T>() != null || Contract.Result<T>() == defaultValue);
-
return this.CreateInstance(defaultValue, false);
}
@@ -95,8 +92,6 @@ namespace DotNetOpenAuth.Configuration {
/// <returns>The newly instantiated type.</returns>
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "No apparent problem. False positive?")]
public T CreateInstance(T defaultValue, bool allowInternals) {
- Contract.Ensures(Contract.Result<T>() != null || Contract.Result<T>() == defaultValue);
-
if (this.CustomType != null) {
if (!allowInternals) {
// Although .NET will usually prevent our instantiating non-public types,
@@ -132,7 +127,6 @@ namespace DotNetOpenAuth.Configuration {
/// be present.
/// </remarks>
private static T CreateInstanceFromXaml(Stream xaml) {
- Contract.Ensures(Contract.Result<T>() != null);
#if CLR4
return (T)XamlServices.Load(xaml);
#else
diff --git a/src/DotNetOpenAuth.Core/Configuration/UntrustedWebRequestElement.cs b/src/DotNetOpenAuth.Core/Configuration/UntrustedWebRequestElement.cs
index b49452a..a16522a 100644
--- a/src/DotNetOpenAuth.Core/Configuration/UntrustedWebRequestElement.cs
+++ b/src/DotNetOpenAuth.Core/Configuration/UntrustedWebRequestElement.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Configuration {
using System;
using System.Configuration;
- using System.Diagnostics.Contracts;
/// <summary>
/// Represents the section of a .config file where security policies regarding web requests
diff --git a/src/DotNetOpenAuth.Core/DotNetOpenAuth.Core.csproj b/src/DotNetOpenAuth.Core/DotNetOpenAuth.Core.csproj
index 12952f1..71965ed 100644
--- a/src/DotNetOpenAuth.Core/DotNetOpenAuth.Core.csproj
+++ b/src/DotNetOpenAuth.Core/DotNetOpenAuth.Core.csproj
@@ -27,12 +27,10 @@
<Compile Include="Messaging\Bindings\MemoryCryptoKeyStore.cs" />
<Compile Include="Messaging\BinaryDataBagFormatter.cs" />
<Compile Include="Messaging\CachedDirectWebResponse.cs" />
- <Compile Include="Messaging\ChannelContract.cs" />
<Compile Include="Messaging\DataBagFormatterBase.cs" />
<Compile Include="Messaging\HmacAlgorithms.cs" />
<Compile Include="Messaging\HttpRequestHeaders.cs" />
<Compile Include="Messaging\IHttpDirectRequest.cs" />
- <Compile Include="Messaging\IHttpDirectRequestContract.cs" />
<Compile Include="Messaging\IHttpIndirectResponse.cs" />
<Compile Include="Messaging\IMessageOriginalPayload.cs" />
<Compile Include="Messaging\DirectWebRequestOptions.cs" />
@@ -40,7 +38,6 @@
<Compile Include="Messaging\HostErrorException.cs" />
<Compile Include="Messaging\IHttpDirectResponse.cs" />
<Compile Include="Messaging\IExtensionMessage.cs" />
- <Compile Include="Messaging\IHttpDirectResponseContract.cs" />
<Compile Include="Messaging\IMessage.cs" />
<Compile Include="Messaging\IncomingWebResponse.cs" />
<Compile Include="Messaging\IDirectResponseProtocolMessage.cs" />
@@ -49,7 +46,6 @@
<Compile Include="Messaging\EmptyList.cs" />
<Compile Include="Messaging\ErrorUtilities.cs" />
<Compile Include="Messaging\IMessageWithEvents.cs" />
- <Compile Include="Messaging\IncomingWebResponseContract.cs" />
<Compile Include="Messaging\IProtocolMessageWithExtensions.cs" />
<Compile Include="Messaging\InternalErrorException.cs" />
<Compile Include="Messaging\IStreamSerializingDataBag.cs" />
@@ -137,6 +133,7 @@
<Compile Include="Loggers\TraceLogger.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Messaging\ReadOnlyDictionary.cs" />
+ <Compile Include="PureAttribute.cs" />
<Compile Include="Reporting.cs" />
<Compile Include="RequiresEx.cs" />
<Compile Include="Strings.Designer.cs">
diff --git a/src/DotNetOpenAuth.Core/Logger.cs b/src/DotNetOpenAuth.Core/Logger.cs
index 512c237..cf9343b 100644
--- a/src/DotNetOpenAuth.Core/Logger.cs
+++ b/src/DotNetOpenAuth.Core/Logger.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth {
using System;
- using System.Diagnostics.Contracts;
using System.Globalization;
using DotNetOpenAuth.Loggers;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.Core/Messaging/BinaryDataBagFormatter.cs b/src/DotNetOpenAuth.Core/Messaging/BinaryDataBagFormatter.cs
index b50d249..554205a 100644
--- a/src/DotNetOpenAuth.Core/Messaging/BinaryDataBagFormatter.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/BinaryDataBagFormatter.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
diff --git a/src/DotNetOpenAuth.Core/Messaging/Bindings/AsymmetricCryptoKeyStoreWrapper.cs b/src/DotNetOpenAuth.Core/Messaging/Bindings/AsymmetricCryptoKeyStoreWrapper.cs
index edf62c4..0439908 100644
--- a/src/DotNetOpenAuth.Core/Messaging/Bindings/AsymmetricCryptoKeyStoreWrapper.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/Bindings/AsymmetricCryptoKeyStoreWrapper.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Messaging.Bindings {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
@@ -150,16 +149,6 @@ namespace DotNetOpenAuth.Messaging.Bindings {
/// Gets the encrypted key.
/// </summary>
internal byte[] EncryptedKey { get; private set; }
-
- /// <summary>
- /// Invariant conditions.
- /// </summary>
- [ContractInvariantMethod]
- [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Code contracts")]
- [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Required for code contracts.")]
- private void ObjectInvariant() {
- Contract.Invariant(this.EncryptedKey != null);
- }
}
}
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/Bindings/CryptoKey.cs b/src/DotNetOpenAuth.Core/Messaging/Bindings/CryptoKey.cs
index b4a5129..d6fef62 100644
--- a/src/DotNetOpenAuth.Core/Messaging/Bindings/CryptoKey.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/Bindings/CryptoKey.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Messaging.Bindings {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -46,7 +45,6 @@ namespace DotNetOpenAuth.Messaging.Bindings {
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "It's a buffer")]
public byte[] Key {
get {
- Contract.Ensures(Contract.Result<byte[]>() != null);
return this.key;
}
}
@@ -56,7 +54,6 @@ namespace DotNetOpenAuth.Messaging.Bindings {
/// </summary>
public DateTime ExpiresUtc {
get {
- Contract.Ensures(Contract.Result<DateTime>().Kind == DateTimeKind.Utc);
return this.expiresUtc;
}
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/Bindings/ExpiredMessageException.cs b/src/DotNetOpenAuth.Core/Messaging/Bindings/ExpiredMessageException.cs
index 6e6d3bc..8c5db3c 100644
--- a/src/DotNetOpenAuth.Core/Messaging/Bindings/ExpiredMessageException.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/Bindings/ExpiredMessageException.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Messaging.Bindings {
using System;
- using System.Diagnostics.Contracts;
using System.Globalization;
using Validation;
diff --git a/src/DotNetOpenAuth.Core/Messaging/Bindings/ICryptoKeyStore.cs b/src/DotNetOpenAuth.Core/Messaging/Bindings/ICryptoKeyStore.cs
index 7493b19..ce7bf42 100644
--- a/src/DotNetOpenAuth.Core/Messaging/Bindings/ICryptoKeyStore.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/Bindings/ICryptoKeyStore.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Messaging.Bindings {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -24,7 +23,6 @@ namespace DotNetOpenAuth.Messaging.Bindings {
/// of the confidentiality of the keys. One possible mitigation is to asymmetrically encrypt
/// each key using a certificate installed in the server's certificate store.
/// </remarks>
- [ContractClass(typeof(ICryptoKeyStoreContract))]
public interface ICryptoKeyStore {
/// <summary>
/// Gets the key in a given bucket and handle.
@@ -58,62 +56,4 @@ namespace DotNetOpenAuth.Messaging.Bindings {
/// <param name="handle">The key handle. Case sensitive.</param>
void RemoveKey(string bucket, string handle);
}
-
- /// <summary>
- /// Code contract for the <see cref="ICryptoKeyStore"/> interface.
- /// </summary>
- [ContractClassFor(typeof(ICryptoKeyStore))]
- internal abstract class ICryptoKeyStoreContract : ICryptoKeyStore {
- /// <summary>
- /// Gets the key in a given bucket and handle.
- /// </summary>
- /// <param name="bucket">The bucket name. Case sensitive.</param>
- /// <param name="handle">The key handle. Case sensitive.</param>
- /// <returns>
- /// The cryptographic key, or <c>null</c> if no matching key was found.
- /// </returns>
- CryptoKey ICryptoKeyStore.GetKey(string bucket, string handle) {
- Requires.NotNullOrEmpty(bucket, "bucket");
- Requires.NotNullOrEmpty(handle, "handle");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets a sequence of existing keys within a given bucket.
- /// </summary>
- /// <param name="bucket">The bucket name. Case sensitive.</param>
- /// <returns>
- /// A sequence of handles and keys, ordered by descending <see cref="CryptoKey.ExpiresUtc"/>.
- /// </returns>
- IEnumerable<KeyValuePair<string, CryptoKey>> ICryptoKeyStore.GetKeys(string bucket) {
- Requires.NotNullOrEmpty(bucket, "bucket");
- Contract.Ensures(Contract.Result<IEnumerable<KeyValuePair<string, CryptoKey>>>() != null);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Stores a cryptographic key.
- /// </summary>
- /// <param name="bucket">The name of the bucket to store the key in. Case sensitive.</param>
- /// <param name="handle">The handle to the key, unique within the bucket. Case sensitive.</param>
- /// <param name="key">The key to store.</param>
- /// <exception cref="CryptoKeyCollisionException">Thrown in the event of a conflict with an existing key in the same bucket and with the same handle.</exception>
- void ICryptoKeyStore.StoreKey(string bucket, string handle, CryptoKey key) {
- Requires.NotNullOrEmpty(bucket, "bucket");
- Requires.NotNullOrEmpty(handle, "handle");
- Requires.NotNull(key, "key");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Removes the key.
- /// </summary>
- /// <param name="bucket">The bucket name. Case sensitive.</param>
- /// <param name="handle">The key handle. Case sensitive.</param>
- void ICryptoKeyStore.RemoveKey(string bucket, string handle) {
- Requires.NotNullOrEmpty(bucket, "bucket");
- Requires.NotNullOrEmpty(handle, "handle");
- throw new NotImplementedException();
- }
- }
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/Bindings/StandardReplayProtectionBindingElement.cs b/src/DotNetOpenAuth.Core/Messaging/Bindings/StandardReplayProtectionBindingElement.cs
index 8c2afec..45bccdf 100644
--- a/src/DotNetOpenAuth.Core/Messaging/Bindings/StandardReplayProtectionBindingElement.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/Bindings/StandardReplayProtectionBindingElement.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Messaging.Bindings {
using System;
using System.Diagnostics;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
diff --git a/src/DotNetOpenAuth.Core/Messaging/CachedDirectWebResponse.cs b/src/DotNetOpenAuth.Core/Messaging/CachedDirectWebResponse.cs
index 322586a..20b1831 100644
--- a/src/DotNetOpenAuth.Core/Messaging/CachedDirectWebResponse.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/CachedDirectWebResponse.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Messaging {
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.IO;
using System.Net;
using System.Text;
@@ -17,7 +16,6 @@ namespace DotNetOpenAuth.Messaging {
/// <summary>
/// Cached details on the response from a direct web request to a remote party.
/// </summary>
- [ContractVerification(true)]
[DebuggerDisplay("{Status} {ContentType.MediaType}, length: {ResponseStream.Length}")]
internal class CachedDirectWebResponse : IncomingWebResponse {
/// <summary>
@@ -161,14 +159,13 @@ namespace DotNetOpenAuth.Messaging {
[SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "System.Diagnostics.Contracts.__ContractsRuntime.Assume(System.Boolean,System.String,System.String)", Justification = "No localization required.")]
private static MemoryStream CacheNetworkStreamAndClose(HttpWebResponse response, int maximumBytesToRead) {
Requires.NotNull(response, "response");
- Contract.Ensures(Contract.Result<MemoryStream>() != null);
// Now read and cache the network stream
Stream networkStream = response.GetResponseStream();
MemoryStream cachedStream = new MemoryStream(response.ContentLength < 0 ? 4 * 1024 : Math.Min((int)response.ContentLength, maximumBytesToRead));
try {
- Contract.Assume(networkStream.CanRead, "HttpWebResponse.GetResponseStream() always returns a readable stream."); // CC missing
- Contract.Assume(cachedStream.CanWrite, "This is a MemoryStream -- it's always writable."); // CC missing
+ Assumes.True(networkStream.CanRead, "HttpWebResponse.GetResponseStream() always returns a readable stream."); // CC missing
+ Assumes.True(cachedStream.CanWrite, "This is a MemoryStream -- it's always writable."); // CC missing
networkStream.CopyTo(cachedStream);
cachedStream.Seek(0, SeekOrigin.Begin);
diff --git a/src/DotNetOpenAuth.Core/Messaging/Channel.cs b/src/DotNetOpenAuth.Core/Messaging/Channel.cs
index 09a203e..9c2ba8c 100644
--- a/src/DotNetOpenAuth.Core/Messaging/Channel.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/Channel.cs
@@ -30,8 +30,6 @@ namespace DotNetOpenAuth.Messaging {
/// Manages sending direct messages to a remote party and receiving responses.
/// </summary>
[SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "Unavoidable.")]
- [ContractVerification(true)]
- [ContractClass(typeof(ChannelContract))]
public abstract class Channel : IDisposable {
/// <summary>
/// The encoding to use when writing out POST entity strings.
@@ -234,9 +232,8 @@ namespace DotNetOpenAuth.Messaging {
/// </summary>
protected internal ReadOnlyCollection<IChannelBindingElement> BindingElements {
get {
- Contract.Ensures(Contract.Result<ReadOnlyCollection<IChannelBindingElement>>() != null);
var result = this.outgoingBindingElements.AsReadOnly();
- Contract.Assume(result != null); // should be an implicit BCL contract
+ Assumes.True(result != null); // should be an implicit BCL contract
return result;
}
}
@@ -253,8 +250,6 @@ namespace DotNetOpenAuth.Messaging {
/// </summary>
protected internal ReadOnlyCollection<IChannelBindingElement> IncomingBindingElements {
get {
- Contract.Ensures(Contract.Result<ReadOnlyCollection<IChannelBindingElement>>().All(be => be.Channel != null));
- Contract.Ensures(Contract.Result<ReadOnlyCollection<IChannelBindingElement>>().All(be => be != null));
return this.incomingBindingElements.AsReadOnly();
}
}
@@ -341,7 +336,6 @@ namespace DotNetOpenAuth.Messaging {
/// <returns>The pending user agent redirect based message to be sent as an HttpResponse.</returns>
public OutgoingWebResponse PrepareResponse(IProtocolMessage message) {
Requires.NotNull(message, "message");
- Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null);
this.ProcessOutgoingMessage(message);
Logger.Channel.DebugFormat("Sending message: {0}", message.GetType().Name);
@@ -421,7 +415,6 @@ namespace DotNetOpenAuth.Messaging {
public bool TryReadFromRequest<TRequest>(HttpRequestBase httpRequest, out TRequest request)
where TRequest : class, IProtocolMessage {
Requires.NotNull(httpRequest, "httpRequest");
- Contract.Ensures(Contract.Result<bool>() == (Contract.ValueAtReturn<TRequest>(out request) != null));
IProtocolMessage untypedRequest = this.ReadFromRequest(httpRequest);
if (untypedRequest == null) {
@@ -512,7 +505,6 @@ namespace DotNetOpenAuth.Messaging {
public TResponse Request<TResponse>(IDirectedProtocolMessage requestMessage)
where TResponse : class, IProtocolMessage {
Requires.NotNull(requestMessage, "requestMessage");
- Contract.Ensures(Contract.Result<TResponse>() != null);
IProtocolMessage response = this.Request(requestMessage);
ErrorUtilities.VerifyProtocol(response != null, MessagingStrings.ExpectedMessageNotReceived, typeof(TResponse));
@@ -636,10 +628,9 @@ namespace DotNetOpenAuth.Messaging {
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Costly call should not be a property.")]
protected internal virtual HttpRequestBase GetRequestFromContext() {
RequiresEx.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired);
- Contract.Ensures(Contract.Result<HttpRequestBase>() != null);
- Contract.Assume(HttpContext.Current.Request.Url != null);
- Contract.Assume(HttpContext.Current.Request.RawUrl != null);
+ Assumes.True(HttpContext.Current.Request.Url != null);
+ Assumes.True(HttpContext.Current.Request.RawUrl != null);
return new HttpRequestWrapper(HttpContext.Current.Request);
}
@@ -786,7 +777,7 @@ namespace DotNetOpenAuth.Messaging {
Logger.Channel.DebugFormat("Incoming HTTP request: {0} {1}", request.HttpMethod, request.GetPublicFacingUrl().AbsoluteUri);
// Search Form data first, and if nothing is there search the QueryString
- Contract.Assume(request.Form != null && request.GetQueryStringBeforeRewriting() != null);
+ Assumes.True(request.Form != null && request.GetQueryStringBeforeRewriting() != null);
var fields = request.Form.ToDictionary();
if (fields.Count == 0 && request.HttpMethod != "POST") { // OpenID 2.0 section 4.1.2
fields = request.GetQueryStringBeforeRewriting().ToDictionary();
@@ -840,11 +831,10 @@ namespace DotNetOpenAuth.Messaging {
Requires.NotNull(message, "message");
Requires.That(message.Recipient != null, "message", MessagingStrings.DirectedMessageMissingRecipient);
Requires.That((message.HttpMethods & (HttpDeliveryMethods.GetRequest | HttpDeliveryMethods.PostRequest)) != 0, "message", "GET or POST expected.");
- Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null);
- Contract.Assert(message != null && message.Recipient != null);
+ Assumes.True(message != null && message.Recipient != null);
var messageAccessor = this.MessageDescriptions.GetAccessor(message);
- Contract.Assert(message != null && message.Recipient != null);
+ Assumes.True(message != null && message.Recipient != null);
var fields = messageAccessor.Serialize();
OutgoingWebResponse response = null;
@@ -890,7 +880,6 @@ namespace DotNetOpenAuth.Messaging {
Requires.NotNull(message, "message");
Requires.That(message.Recipient != null, "message", MessagingStrings.DirectedMessageMissingRecipient);
Requires.NotNull(fields, "fields");
- Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null);
// As part of this redirect, we include an HTML body in order to get passed some proxy filters
// such as WebSense.
@@ -927,7 +916,6 @@ namespace DotNetOpenAuth.Messaging {
Requires.NotNull(message, "message");
Requires.That(message.Recipient != null, "message", MessagingStrings.DirectedMessageMissingRecipient);
Requires.NotNull(fields, "fields");
- Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null);
WebHeaderCollection headers = new WebHeaderCollection();
headers.Add(HttpResponseHeader.ContentType, "text/html");
@@ -975,7 +963,6 @@ namespace DotNetOpenAuth.Messaging {
protected virtual HttpWebRequest CreateHttpRequest(IDirectedProtocolMessage request) {
Requires.NotNull(request, "request");
Requires.That(request.Recipient != null, "request", MessagingStrings.DirectedMessageMissingRecipient);
- Contract.Ensures(Contract.Result<HttpWebRequest>() != null);
throw new NotImplementedException();
}
@@ -1040,7 +1027,7 @@ namespace DotNetOpenAuth.Messaging {
MessageProtections appliedProtection = MessageProtections.None;
foreach (IChannelBindingElement bindingElement in this.outgoingBindingElements) {
- Contract.Assume(bindingElement.Channel != null);
+ Assumes.True(bindingElement.Channel != null);
MessageProtections? elementProtection = bindingElement.ProcessOutgoingMessage(message);
if (elementProtection.HasValue) {
Logger.Bindings.DebugFormat("Binding element {0} applied to message.", bindingElement.GetType().FullName);
@@ -1130,7 +1117,6 @@ namespace DotNetOpenAuth.Messaging {
/// </remarks>
protected virtual HttpWebRequest InitializeRequestAsPost(IDirectedProtocolMessage requestMessage) {
Requires.NotNull(requestMessage, "requestMessage");
- Contract.Ensures(Contract.Result<HttpWebRequest>() != null);
var messageAccessor = this.MessageDescriptions.GetAccessor(requestMessage);
var fields = messageAccessor.Serialize();
@@ -1165,7 +1151,6 @@ namespace DotNetOpenAuth.Messaging {
/// </remarks>
protected virtual HttpWebRequest InitializeRequestAsPut(IDirectedProtocolMessage requestMessage) {
Requires.NotNull(requestMessage, "requestMessage");
- Contract.Ensures(Contract.Result<HttpWebRequest>() != null);
HttpWebRequest request = this.InitializeRequestAsGet(requestMessage);
request.Method = "PUT";
@@ -1182,7 +1167,6 @@ namespace DotNetOpenAuth.Messaging {
/// </remarks>
protected virtual HttpWebRequest InitializeRequestAsDelete(IDirectedProtocolMessage requestMessage) {
Requires.NotNull(requestMessage, "requestMessage");
- Contract.Ensures(Contract.Result<HttpWebRequest>() != null);
HttpWebRequest request = this.InitializeRequestAsGet(requestMessage);
request.Method = "DELETE";
@@ -1255,7 +1239,7 @@ namespace DotNetOpenAuth.Messaging {
MessageProtections appliedProtection = MessageProtections.None;
foreach (IChannelBindingElement bindingElement in this.IncomingBindingElements) {
- Contract.Assume(bindingElement.Channel != null); // CC bug: this.IncomingBindingElements ensures this... why must we assume it here?
+ Assumes.True(bindingElement.Channel != null); // CC bug: this.IncomingBindingElements ensures this... why must we assume it here?
MessageProtections? elementProtection = bindingElement.ProcessIncomingMessage(message);
if (elementProtection.HasValue) {
Logger.Bindings.DebugFormat("Binding element {0} applied to message.", bindingElement.GetType().FullName);
@@ -1352,7 +1336,6 @@ namespace DotNetOpenAuth.Messaging {
/// <exception cref="ProtocolException">Thrown when the binding elements are incomplete or inconsistent with each other.</exception>
private static IEnumerable<IChannelBindingElement> ValidateAndPrepareBindingElements(IEnumerable<IChannelBindingElement> elements) {
Requires.NullOrNotNullElements(elements, "elements");
- Contract.Ensures(Contract.Result<IEnumerable<IChannelBindingElement>>() != null);
if (elements == null) {
return new IChannelBindingElement[0];
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/ChannelContract.cs b/src/DotNetOpenAuth.Core/Messaging/ChannelContract.cs
deleted file mode 100644
index 82f2955..0000000
--- a/src/DotNetOpenAuth.Core/Messaging/ChannelContract.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="ChannelContract.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.Messaging {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.Contracts;
- using Validation;
-
- /// <summary>
- /// Code contract for the <see cref="Channel"/> class.
- /// </summary>
- [ContractClassFor(typeof(Channel))]
- internal abstract class ChannelContract : Channel {
- /// <summary>
- /// Prevents a default instance of the ChannelContract class from being created.
- /// </summary>
- private ChannelContract()
- : base(null, null) {
- }
-
- /// <summary>
- /// Gets the protocol message that may be in the given HTTP response.
- /// </summary>
- /// <param name="response">The response that is anticipated to contain an protocol message.</param>
- /// <returns>
- /// The deserialized message parts, if found. Null otherwise.
- /// </returns>
- /// <exception cref="ProtocolException">Thrown when the response is not valid.</exception>
- protected override IDictionary<string, string> ReadFromResponseCore(IncomingWebResponse response) {
- Requires.NotNull(response, "response");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Queues a message for sending in the response stream where the fields
- /// are sent in the response stream in querystring style.
- /// </summary>
- /// <param name="response">The message to send as a response.</param>
- /// <returns>
- /// The pending user agent redirect based message to be sent as an HttpResponse.
- /// </returns>
- /// <remarks>
- /// This method implements spec V1.0 section 5.3.
- /// </remarks>
- protected override OutgoingWebResponse PrepareDirectResponse(IProtocolMessage response) {
- Requires.NotNull(response, "response");
- Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null);
- throw new NotImplementedException();
- }
- }
-}
diff --git a/src/DotNetOpenAuth.Core/Messaging/ChannelEventArgs.cs b/src/DotNetOpenAuth.Core/Messaging/ChannelEventArgs.cs
index 5cf74ad..5c69e4d 100644
--- a/src/DotNetOpenAuth.Core/Messaging/ChannelEventArgs.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/ChannelEventArgs.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Messaging {
using System;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
diff --git a/src/DotNetOpenAuth.Core/Messaging/DataBag.cs b/src/DotNetOpenAuth.Core/Messaging/DataBag.cs
index 66b83ac..8469676 100644
--- a/src/DotNetOpenAuth.Core/Messaging/DataBag.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/DataBag.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
diff --git a/src/DotNetOpenAuth.Core/Messaging/DataBagFormatterBase.cs b/src/DotNetOpenAuth.Core/Messaging/DataBagFormatterBase.cs
index f60423b..210a95e 100644
--- a/src/DotNetOpenAuth.Core/Messaging/DataBagFormatterBase.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/DataBagFormatterBase.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
@@ -305,7 +304,6 @@ namespace DotNetOpenAuth.Messaging {
private byte[] CalculateSignature(byte[] bytesToSign, string symmetricSecretHandle) {
Requires.NotNull(bytesToSign, "bytesToSign");
RequiresEx.ValidState(this.asymmetricSigning != null || this.cryptoKeyStore != null);
- Contract.Ensures(Contract.Result<byte[]>() != null);
if (this.asymmetricSigning != null) {
using (var hasher = SHA1.Create()) {
diff --git a/src/DotNetOpenAuth.Core/Messaging/EnumerableCacheExtensions.cs b/src/DotNetOpenAuth.Core/Messaging/EnumerableCacheExtensions.cs
index f5c4b36..0886ef2 100644
--- a/src/DotNetOpenAuth.Core/Messaging/EnumerableCacheExtensions.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/EnumerableCacheExtensions.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
diff --git a/src/DotNetOpenAuth.Core/Messaging/ErrorUtilities.cs b/src/DotNetOpenAuth.Core/Messaging/ErrorUtilities.cs
index 95c87f1..71c904b 100644
--- a/src/DotNetOpenAuth.Core/Messaging/ErrorUtilities.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/ErrorUtilities.cs
@@ -16,7 +16,6 @@ namespace DotNetOpenAuth.Messaging {
/// <summary>
/// A collection of error checking and reporting methods.
/// </summary>
- [ContractVerification(true)]
[Pure]
internal static class ErrorUtilities {
/// <summary>
@@ -29,7 +28,7 @@ namespace DotNetOpenAuth.Messaging {
[Pure]
internal static Exception Wrap(Exception inner, string errorMessage, params object[] args) {
Requires.NotNull(args, "args");
- Contract.Assume(errorMessage != null);
+ Assumes.True(errorMessage != null);
return new ProtocolException(string.Format(CultureInfo.CurrentCulture, errorMessage, args), inner);
}
@@ -59,8 +58,6 @@ namespace DotNetOpenAuth.Messaging {
/// <exception cref="InternalErrorException">Thrown if <paramref name="condition"/> evaluates to <c>false</c>.</exception>
[Pure]
internal static void VerifyInternal(bool condition, string errorMessage) {
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<InternalErrorException>(!condition);
if (!condition) {
ThrowInternal(errorMessage);
}
@@ -76,9 +73,7 @@ namespace DotNetOpenAuth.Messaging {
[Pure]
internal static void VerifyInternal(bool condition, string errorMessage, params object[] args) {
Requires.NotNull(args, "args");
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<InternalErrorException>(!condition);
- Contract.Assume(errorMessage != null);
+ Assumes.True(errorMessage != null);
if (!condition) {
errorMessage = string.Format(CultureInfo.CurrentCulture, errorMessage, args);
throw new InternalErrorException(errorMessage);
@@ -93,8 +88,6 @@ namespace DotNetOpenAuth.Messaging {
/// <exception cref="InvalidOperationException">Thrown if <paramref name="condition"/> evaluates to <c>false</c>.</exception>
[Pure]
internal static void VerifyOperation(bool condition, string errorMessage) {
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<InvalidOperationException>(!condition);
if (!condition) {
throw new InvalidOperationException(errorMessage);
}
@@ -108,8 +101,6 @@ namespace DotNetOpenAuth.Messaging {
/// <exception cref="NotSupportedException">Thrown if <paramref name="condition"/> evaluates to <c>false</c>.</exception>
[Pure]
internal static void VerifySupported(bool condition, string errorMessage) {
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<NotSupportedException>(!condition);
if (!condition) {
throw new NotSupportedException(errorMessage);
}
@@ -125,9 +116,7 @@ namespace DotNetOpenAuth.Messaging {
[Pure]
internal static void VerifySupported(bool condition, string errorMessage, params object[] args) {
Requires.NotNull(args, "args");
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<NotSupportedException>(!condition);
- Contract.Assume(errorMessage != null);
+ Assumes.True(errorMessage != null);
if (!condition) {
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, errorMessage, args));
}
@@ -143,9 +132,7 @@ namespace DotNetOpenAuth.Messaging {
[Pure]
internal static void VerifyOperation(bool condition, string errorMessage, params object[] args) {
Requires.NotNull(args, "args");
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<InvalidOperationException>(!condition);
- Contract.Assume(errorMessage != null);
+ Assumes.True(errorMessage != null);
if (!condition) {
errorMessage = string.Format(CultureInfo.CurrentCulture, errorMessage, args);
throw new InvalidOperationException(errorMessage);
@@ -162,9 +149,7 @@ namespace DotNetOpenAuth.Messaging {
[Pure]
internal static void VerifyHost(bool condition, string errorMessage, params object[] args) {
Requires.NotNull(args, "args");
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<ProtocolException>(!condition);
- Contract.Assume(errorMessage != null);
+ Assumes.True(errorMessage != null);
if (!condition) {
throw new HostErrorException(string.Format(CultureInfo.CurrentCulture, errorMessage, args));
}
@@ -182,9 +167,7 @@ namespace DotNetOpenAuth.Messaging {
internal static void VerifyProtocol(bool condition, IProtocolMessage faultedMessage, string errorMessage, params object[] args) {
Requires.NotNull(args, "args");
Requires.NotNull(faultedMessage, "faultedMessage");
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<ProtocolException>(!condition);
- Contract.Assume(errorMessage != null);
+ Assumes.True(errorMessage != null);
if (!condition) {
throw new ProtocolException(string.Format(CultureInfo.CurrentCulture, errorMessage, args), faultedMessage);
}
@@ -200,9 +183,7 @@ namespace DotNetOpenAuth.Messaging {
[Pure]
internal static void VerifyProtocol(bool condition, string unformattedMessage, params object[] args) {
Requires.NotNull(args, "args");
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<ProtocolException>(!condition);
- Contract.Assume(unformattedMessage != null);
+ Assumes.True(unformattedMessage != null);
if (!condition) {
var exception = new ProtocolException(string.Format(CultureInfo.CurrentCulture, unformattedMessage, args));
if (Logger.Messaging.IsErrorEnabled) {
@@ -232,7 +213,7 @@ namespace DotNetOpenAuth.Messaging {
[Pure]
internal static Exception ThrowProtocol(string unformattedMessage, params object[] args) {
Requires.NotNull(args, "args");
- Contract.Assume(unformattedMessage != null);
+ Assumes.True(unformattedMessage != null);
VerifyProtocol(false, unformattedMessage, args);
// we never reach here, but this allows callers to "throw" this method.
@@ -248,7 +229,7 @@ namespace DotNetOpenAuth.Messaging {
[Pure]
internal static Exception ThrowFormat(string message, params object[] args) {
Requires.NotNull(args, "args");
- Contract.Assume(message != null);
+ Assumes.True(message != null);
throw new FormatException(string.Format(CultureInfo.CurrentCulture, message, args));
}
@@ -262,9 +243,7 @@ namespace DotNetOpenAuth.Messaging {
[Pure]
internal static void VerifyFormat(bool condition, string message, params object[] args) {
Requires.NotNull(args, "args");
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<FormatException>(!condition);
- Contract.Assume(message != null);
+ Assumes.True(message != null);
if (!condition) {
throw ThrowFormat(message, args);
}
@@ -280,9 +259,7 @@ namespace DotNetOpenAuth.Messaging {
[Pure]
internal static void VerifyArgument(bool condition, string message, params object[] args) {
Requires.NotNull(args, "args");
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<ArgumentException>(!condition);
- Contract.Assume(message != null);
+ Assumes.True(message != null);
if (!condition) {
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, message, args));
}
@@ -298,7 +275,7 @@ namespace DotNetOpenAuth.Messaging {
[Pure]
internal static Exception ThrowArgumentNamed(string parameterName, string message, params object[] args) {
Requires.NotNull(args, "args");
- Contract.Assume(message != null);
+ Assumes.True(message != null);
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, message, args), parameterName);
}
@@ -313,9 +290,7 @@ namespace DotNetOpenAuth.Messaging {
[Pure]
internal static void VerifyArgumentNamed(bool condition, string parameterName, string message, params object[] args) {
Requires.NotNull(args, "args");
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<ArgumentException>(!condition);
- Contract.Assume(message != null);
+ Assumes.True(message != null);
if (!condition) {
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, message, args), parameterName);
}
@@ -329,8 +304,6 @@ namespace DotNetOpenAuth.Messaging {
/// <exception cref="ArgumentNullException">Thrown if <paramref name="value"/> is null.</exception>
[Pure]
internal static void VerifyArgumentNotNull(object value, string paramName) {
- Contract.Ensures(value != null);
- Contract.EnsuresOnThrow<ArgumentNullException>(value == null);
if (value == null) {
throw new ArgumentNullException(paramName);
}
@@ -345,8 +318,6 @@ namespace DotNetOpenAuth.Messaging {
/// <exception cref="ArgumentException">Thrown if <paramref name="value"/> has zero length.</exception>
[Pure]
internal static void VerifyNonZeroLength(string value, string paramName) {
- Contract.Ensures((value != null && value.Length > 0) && !string.IsNullOrEmpty(value));
- Contract.EnsuresOnThrow<ArgumentException>(value == null || value.Length == 0);
VerifyArgumentNotNull(value, paramName);
if (value.Length == 0) {
throw new ArgumentException(MessagingStrings.UnexpectedEmptyString, paramName);
@@ -359,8 +330,6 @@ namespace DotNetOpenAuth.Messaging {
/// <exception cref="InvalidOperationException">Thrown if <see cref="HttpContext.Current"/> == <c>null</c></exception>
[Pure]
internal static void VerifyHttpContext() {
- Contract.Ensures(HttpContext.Current != null);
- Contract.Ensures(HttpContext.Current.Request != null);
ErrorUtilities.VerifyOperation(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired);
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs b/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs
index 465ed43..55233c2 100644
--- a/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.Messaging {
using System.Collections.Specialized;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Net;
diff --git a/src/DotNetOpenAuth.Core/Messaging/IChannelBindingElement.cs b/src/DotNetOpenAuth.Core/Messaging/IChannelBindingElement.cs
index d52e1d5..fca46a0 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IChannelBindingElement.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IChannelBindingElement.cs
@@ -6,14 +6,12 @@
namespace DotNetOpenAuth.Messaging {
using System;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
/// An interface that must be implemented by message transforms/validators in order
/// to be included in the channel stack.
/// </summary>
- [ContractClass(typeof(IChannelBindingElementContract))]
public interface IChannelBindingElement {
/// <summary>
/// Gets or sets the channel that this binding element belongs to.
@@ -64,84 +62,4 @@ namespace DotNetOpenAuth.Messaging {
/// </remarks>
MessageProtections? ProcessIncomingMessage(IProtocolMessage message);
}
-
- /// <summary>
- /// Code Contract for the <see cref="IChannelBindingElement"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IChannelBindingElement))]
- internal abstract class IChannelBindingElementContract : IChannelBindingElement {
- /// <summary>
- /// Prevents a default instance of the <see cref="IChannelBindingElementContract"/> class from being created.
- /// </summary>
- private IChannelBindingElementContract() {
- }
-
- #region IChannelBindingElement Members
-
- /// <summary>
- /// Gets or sets the channel that this binding element belongs to.
- /// </summary>
- /// <value></value>
- /// <remarks>
- /// This property is set by the channel when it is first constructed.
- /// </remarks>
- Channel IChannelBindingElement.Channel {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the protection commonly offered (if any) by this binding element.
- /// </summary>
- /// <value></value>
- /// <remarks>
- /// This value is used to assist in sorting binding elements in the channel stack.
- /// </remarks>
- MessageProtections IChannelBindingElement.Protection {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Prepares a message for sending based on the rules of this channel binding element.
- /// </summary>
- /// <param name="message">The message to prepare for sending.</param>
- /// <returns>
- /// The protections (if any) that this binding element applied to the message.
- /// Null if this binding element did not even apply to this binding element.
- /// </returns>
- /// <remarks>
- /// Implementations that provide message protection must honor the
- /// <see cref="MessagePartAttribute.RequiredProtection"/> properties where applicable.
- /// </remarks>
- MessageProtections? IChannelBindingElement.ProcessOutgoingMessage(IProtocolMessage message) {
- Requires.NotNull(message, "message");
- Assumes.True(((IChannelBindingElement)this).Channel != null);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Performs any transformation on an incoming message that may be necessary and/or
- /// validates an incoming message based on the rules of this channel binding element.
- /// </summary>
- /// <param name="message">The incoming message to process.</param>
- /// <returns>
- /// The protections (if any) that this binding element applied to the message.
- /// Null if this binding element did not even apply to this binding element.
- /// </returns>
- /// <exception cref="ProtocolException">
- /// Thrown when the binding element rules indicate that this message is invalid and should
- /// NOT be processed.
- /// </exception>
- /// <remarks>
- /// Implementations that provide message protection must honor the
- /// <see cref="MessagePartAttribute.RequiredProtection"/> properties where applicable.
- /// </remarks>
- MessageProtections? IChannelBindingElement.ProcessIncomingMessage(IProtocolMessage message) {
- Requires.NotNull(message, "message");
- RequiresEx.ValidState(((IChannelBindingElement)this).Channel != null);
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/IDataBagFormatter.cs b/src/DotNetOpenAuth.Core/Messaging/IDataBagFormatter.cs
index 65badc1..955d7c0 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IDataBagFormatter.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IDataBagFormatter.cs
@@ -6,14 +6,12 @@
namespace DotNetOpenAuth.Messaging {
using System;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
/// A serializer for <see cref="DataBag"/>-derived types
/// </summary>
/// <typeparam name="T">The DataBag-derived type that is to be serialized/deserialized.</typeparam>
- [ContractClass(typeof(IDataBagFormatterContract<>))]
internal interface IDataBagFormatter<in T> where T : DataBag {
/// <summary>
/// Serializes the specified message.
@@ -31,50 +29,4 @@ namespace DotNetOpenAuth.Messaging {
/// <param name="messagePartName">The name of the parameter whose value is to be deserialized. Used for error message generation, but may be <c>null</c>.</param>
void Deserialize(T message, string data, IProtocolMessage containingMessage = null, string messagePartName = null);
}
-
- /// <summary>
- /// Contract class for the IDataBagFormatter interface.
- /// </summary>
- /// <typeparam name="T">The type of DataBag to serialize.</typeparam>
- [ContractClassFor(typeof(IDataBagFormatter<>))]
- internal abstract class IDataBagFormatterContract<T> : IDataBagFormatter<T> where T : DataBag, new() {
- /// <summary>
- /// Prevents a default instance of the <see cref="IDataBagFormatterContract&lt;T&gt;"/> class from being created.
- /// </summary>
- private IDataBagFormatterContract() {
- }
-
- #region IDataBagFormatter<T> Members
-
- /// <summary>
- /// Serializes the specified message.
- /// </summary>
- /// <param name="message">The message to serialize. Must not be null.</param>
- /// <returns>A non-null, non-empty value.</returns>
- string IDataBagFormatter<T>.Serialize(T message) {
- Requires.NotNull(message, "message");
- Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>()));
-
- throw new System.NotImplementedException();
- }
-
- /// <summary>
- /// Deserializes a <see cref="DataBag"/>.
- /// </summary>
- /// <param name="message">The instance to deserialize into</param>
- /// <param name="data">The serialized form of the <see cref="DataBag"/> to deserialize. Must not be null or empty.</param>
- /// <param name="containingMessage">The message that contains the <see cref="DataBag"/> serialized value. Must not be nulll.</param>
- /// <param name="messagePartName">Name of the message part whose value is to be deserialized. Used for exception messages.</param>
- void IDataBagFormatter<T>.Deserialize(T message, string data, IProtocolMessage containingMessage, string messagePartName) {
- Requires.NotNull(message, "message");
- Requires.NotNull(containingMessage, "containingMessage");
- Requires.NotNullOrEmpty(data, "data");
- Requires.NotNullOrEmpty(messagePartName, "messagePartName");
- Contract.Ensures(Contract.Result<T>() != null);
-
- throw new System.NotImplementedException();
- }
-
- #endregion
- }
} \ No newline at end of file
diff --git a/src/DotNetOpenAuth.Core/Messaging/IDirectWebRequestHandler.cs b/src/DotNetOpenAuth.Core/Messaging/IDirectWebRequestHandler.cs
index 3a60280..f3975b3 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IDirectWebRequestHandler.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IDirectWebRequestHandler.cs
@@ -19,7 +19,6 @@ namespace DotNetOpenAuth.Messaging {
/// <remarks>
/// Implementations of this interface must be thread safe.
/// </remarks>
- [ContractClass(typeof(IDirectWebRequestHandlerContract))]
public interface IDirectWebRequestHandler {
/// <summary>
/// Determines whether this instance can support the specified options.
@@ -103,122 +102,4 @@ namespace DotNetOpenAuth.Messaging {
/// </remarks>
IncomingWebResponse GetResponse(HttpWebRequest request, DirectWebRequestOptions options);
}
-
- /// <summary>
- /// Code contract for the <see cref="IDirectWebRequestHandler"/> type.
- /// </summary>
- [ContractClassFor(typeof(IDirectWebRequestHandler))]
- internal abstract class IDirectWebRequestHandlerContract : IDirectWebRequestHandler {
- #region IDirectWebRequestHandler Members
-
- /// <summary>
- /// Determines whether this instance can support the specified options.
- /// </summary>
- /// <param name="options">The set of options that might be given in a subsequent web request.</param>
- /// <returns>
- /// <c>true</c> if this instance can support the specified options; otherwise, <c>false</c>.
- /// </returns>
- bool IDirectWebRequestHandler.CanSupport(DirectWebRequestOptions options) {
- throw new System.NotImplementedException();
- }
-
- /// <summary>
- /// Prepares an <see cref="HttpWebRequest"/> that contains an POST entity for sending the entity.
- /// </summary>
- /// <param name="request">The <see cref="HttpWebRequest"/> that should contain the entity.</param>
- /// <returns>
- /// The stream the caller should write out the entity data to.
- /// </returns>
- /// <exception cref="ProtocolException">Thrown for any network error.</exception>
- /// <remarks>
- /// <para>The caller should have set the <see cref="HttpWebRequest.ContentLength"/>
- /// and any other appropriate properties <i>before</i> calling this method.
- /// Callers <i>must</i> close and dispose of the request stream when they are done
- /// writing to it to avoid taking up the connection too long and causing long waits on
- /// subsequent requests.</para>
- /// <para>Implementations should catch <see cref="WebException"/> and wrap it in a
- /// <see cref="ProtocolException"/> to abstract away the transport and provide
- /// a single exception type for hosts to catch.</para>
- /// </remarks>
- Stream IDirectWebRequestHandler.GetRequestStream(HttpWebRequest request) {
- Requires.NotNull(request, "request");
- throw new System.NotImplementedException();
- }
-
- /// <summary>
- /// Prepares an <see cref="HttpWebRequest"/> that contains an POST entity for sending the entity.
- /// </summary>
- /// <param name="request">The <see cref="HttpWebRequest"/> that should contain the entity.</param>
- /// <param name="options">The options to apply to this web request.</param>
- /// <returns>
- /// The stream the caller should write out the entity data to.
- /// </returns>
- /// <exception cref="ProtocolException">Thrown for any network error.</exception>
- /// <remarks>
- /// <para>The caller should have set the <see cref="HttpWebRequest.ContentLength"/>
- /// and any other appropriate properties <i>before</i> calling this method.
- /// Callers <i>must</i> close and dispose of the request stream when they are done
- /// writing to it to avoid taking up the connection too long and causing long waits on
- /// subsequent requests.</para>
- /// <para>Implementations should catch <see cref="WebException"/> and wrap it in a
- /// <see cref="ProtocolException"/> to abstract away the transport and provide
- /// a single exception type for hosts to catch.</para>
- /// </remarks>
- Stream IDirectWebRequestHandler.GetRequestStream(HttpWebRequest request, DirectWebRequestOptions options) {
- Requires.NotNull(request, "request");
- RequiresEx.Support(((IDirectWebRequestHandler)this).CanSupport(options), MessagingStrings.DirectWebRequestOptionsNotSupported);
- ////ErrorUtilities.VerifySupported(((IDirectWebRequestHandler)this).CanSupport(options), string.Format(MessagingStrings.DirectWebRequestOptionsNotSupported, options, this.GetType().Name));
- throw new System.NotImplementedException();
- }
-
- /// <summary>
- /// Processes an <see cref="HttpWebRequest"/> and converts the
- /// <see cref="HttpWebResponse"/> to a <see cref="IncomingWebResponse"/> instance.
- /// </summary>
- /// <param name="request">The <see cref="HttpWebRequest"/> to handle.</param>
- /// <returns>
- /// An instance of <see cref="IncomingWebResponse"/> describing the response.
- /// </returns>
- /// <exception cref="ProtocolException">Thrown for any network error.</exception>
- /// <remarks>
- /// Implementations should catch <see cref="WebException"/> and wrap it in a
- /// <see cref="ProtocolException"/> to abstract away the transport and provide
- /// a single exception type for hosts to catch. The <see cref="WebException.Response"/>
- /// value, if set, should be Closed before throwing.
- /// </remarks>
- IncomingWebResponse IDirectWebRequestHandler.GetResponse(HttpWebRequest request) {
- Requires.NotNull(request, "request");
- Contract.Ensures(Contract.Result<IncomingWebResponse>() != null);
- Contract.Ensures(Contract.Result<IncomingWebResponse>().ResponseStream != null);
- throw new System.NotImplementedException();
- }
-
- /// <summary>
- /// Processes an <see cref="HttpWebRequest"/> and converts the
- /// <see cref="HttpWebResponse"/> to a <see cref="IncomingWebResponse"/> instance.
- /// </summary>
- /// <param name="request">The <see cref="HttpWebRequest"/> to handle.</param>
- /// <param name="options">The options to apply to this web request.</param>
- /// <returns>
- /// An instance of <see cref="IncomingWebResponse"/> describing the response.
- /// </returns>
- /// <exception cref="ProtocolException">Thrown for any network error.</exception>
- /// <remarks>
- /// Implementations should catch <see cref="WebException"/> and wrap it in a
- /// <see cref="ProtocolException"/> to abstract away the transport and provide
- /// a single exception type for hosts to catch. The <see cref="WebException.Response"/>
- /// value, if set, should be Closed before throwing.
- /// </remarks>
- IncomingWebResponse IDirectWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options) {
- Requires.NotNull(request, "request");
- Contract.Ensures(Contract.Result<IncomingWebResponse>() != null);
- Contract.Ensures(Contract.Result<IncomingWebResponse>().ResponseStream != null);
- RequiresEx.Support(((IDirectWebRequestHandler)this).CanSupport(options), MessagingStrings.DirectWebRequestOptionsNotSupported);
-
- ////ErrorUtilities.VerifySupported(((IDirectWebRequestHandler)this).CanSupport(options), string.Format(MessagingStrings.DirectWebRequestOptionsNotSupported, options, this.GetType().Name));
- throw new System.NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/IHttpDirectRequest.cs b/src/DotNetOpenAuth.Core/Messaging/IHttpDirectRequest.cs
index 7153334..7b26869 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IHttpDirectRequest.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IHttpDirectRequest.cs
@@ -5,13 +5,11 @@
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.Messaging {
- using System.Diagnostics.Contracts;
using System.Net;
/// <summary>
/// An interface that allows direct request messages to capture the details of the HTTP request they arrived on.
/// </summary>
- [ContractClass(typeof(IHttpDirectRequestContract))]
public interface IHttpDirectRequest : IMessage {
/// <summary>
/// Gets the HTTP headers of the request.
diff --git a/src/DotNetOpenAuth.Core/Messaging/IHttpDirectRequestContract.cs b/src/DotNetOpenAuth.Core/Messaging/IHttpDirectRequestContract.cs
deleted file mode 100644
index cfde6cf..0000000
--- a/src/DotNetOpenAuth.Core/Messaging/IHttpDirectRequestContract.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="IHttpDirectRequestContract.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.Messaging {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.Contracts;
- using System.Linq;
- using System.Net;
- using System.Text;
-
- /// <summary>
- /// Contract class for the <see cref="IHttpDirectRequest"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IHttpDirectRequest))]
- public abstract class IHttpDirectRequestContract : IHttpDirectRequest {
- #region IHttpDirectRequest Members
-
- /// <summary>
- /// Gets the HTTP headers of the request.
- /// </summary>
- /// <value>May be an empty collection, but must not be <c>null</c>.</value>
- WebHeaderCollection IHttpDirectRequest.Headers {
- get {
- Contract.Ensures(Contract.Result<WebHeaderCollection>() != null);
- throw new NotImplementedException();
- }
- }
-
- #endregion
-
- #region IMessage Members
-
- /// <summary>
- /// Gets the version of the protocol or extension this message is prepared to implement.
- /// </summary>
- /// <remarks>
- /// Implementations of this interface should ensure that this property never returns null.
- /// </remarks>
- Version IMessage.Version {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the extra, non-standard Protocol parameters included in the message.
- /// </summary>
- /// <remarks>
- /// Implementations of this interface should ensure that this property never returns null.
- /// </remarks>
- IDictionary<string, string> IMessage.ExtraData {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Checks the message state for conformity to the protocol specification
- /// and throws an exception if the message is invalid.
- /// </summary>
- /// <remarks>
- /// <para>Some messages have required fields, or combinations of fields that must relate to each other
- /// in specialized ways. After deserializing a message, this method checks the state of the
- /// message to see if it conforms to the protocol.</para>
- /// <para>Note that this property should <i>not</i> check signatures or perform any state checks
- /// outside this scope of this particular message.</para>
- /// </remarks>
- /// <exception cref="ProtocolException">Thrown if the message is invalid.</exception>
- void IMessage.EnsureValidMessage() {
- throw new NotImplementedException();
- }
-
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.Core/Messaging/IHttpDirectResponse.cs b/src/DotNetOpenAuth.Core/Messaging/IHttpDirectResponse.cs
index d942366..f455fcf 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IHttpDirectResponse.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IHttpDirectResponse.cs
@@ -5,14 +5,12 @@
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.Messaging {
- using System.Diagnostics.Contracts;
using System.Net;
/// <summary>
/// An interface that allows direct response messages to specify
/// HTTP transport specific properties.
/// </summary>
- [ContractClass(typeof(IHttpDirectResponseContract))]
public interface IHttpDirectResponse {
/// <summary>
/// Gets the HTTP status code that the direct response should be sent with.
diff --git a/src/DotNetOpenAuth.Core/Messaging/IHttpDirectResponseContract.cs b/src/DotNetOpenAuth.Core/Messaging/IHttpDirectResponseContract.cs
deleted file mode 100644
index a04ba62..0000000
--- a/src/DotNetOpenAuth.Core/Messaging/IHttpDirectResponseContract.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="IHttpDirectResponseContract.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.Messaging {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.Contracts;
- using System.Linq;
- using System.Net;
- using System.Text;
-
- /// <summary>
- /// Contract class for the <see cref="IHttpDirectResponse"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IHttpDirectResponse))]
- public abstract class IHttpDirectResponseContract : IHttpDirectResponse {
- #region IHttpDirectResponse Members
-
- /// <summary>
- /// Gets the HTTP status code that the direct response should be sent with.
- /// </summary>
- /// <value></value>
- HttpStatusCode IHttpDirectResponse.HttpStatusCode {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the HTTP headers to add to the response.
- /// </summary>
- /// <value>May be an empty collection, but must not be <c>null</c>.</value>
- WebHeaderCollection IHttpDirectResponse.Headers {
- get {
- Contract.Ensures(Contract.Result<WebHeaderCollection>() != null);
- throw new NotImplementedException();
- }
- }
-
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.Core/Messaging/IHttpIndirectResponse.cs b/src/DotNetOpenAuth.Core/Messaging/IHttpIndirectResponse.cs
index e0e8665..c9ab73b 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IHttpIndirectResponse.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IHttpIndirectResponse.cs
@@ -5,7 +5,6 @@
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.Messaging {
- using System.Diagnostics.Contracts;
using System.Net;
/// <summary>
diff --git a/src/DotNetOpenAuth.Core/Messaging/IMessage.cs b/src/DotNetOpenAuth.Core/Messaging/IMessage.cs
index 62673ef..c007913 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IMessage.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IMessage.cs
@@ -7,14 +7,12 @@
namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Text;
/// <summary>
/// The interface that classes must implement to be serialized/deserialized
/// as protocol or extension messages.
/// </summary>
- [ContractClass(typeof(IMessageContract))]
public interface IMessage {
/// <summary>
/// Gets the version of the protocol or extension this message is prepared to implement.
@@ -46,55 +44,4 @@ namespace DotNetOpenAuth.Messaging {
/// <exception cref="ProtocolException">Thrown if the message is invalid.</exception>
void EnsureValidMessage();
}
-
- /// <summary>
- /// Code contract for the <see cref="IMessage"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IMessage))]
- internal abstract class IMessageContract : IMessage {
- /// <summary>
- /// Prevents a default instance of the <see cref="IMessageContract"/> class from being created.
- /// </summary>
- private IMessageContract() {
- }
-
- /// <summary>
- /// Gets the version of the protocol or extension this message is prepared to implement.
- /// </summary>
- Version IMessage.Version {
- get {
- Contract.Ensures(Contract.Result<Version>() != null);
- return default(Version); // dummy return
- }
- }
-
- /// <summary>
- /// Gets the extra, non-standard Protocol parameters included in the message.
- /// </summary>
- /// <value></value>
- /// <remarks>
- /// Implementations of this interface should ensure that this property never returns null.
- /// </remarks>
- IDictionary<string, string> IMessage.ExtraData {
- get {
- Contract.Ensures(Contract.Result<IDictionary<string, string>>() != null);
- return default(IDictionary<string, string>);
- }
- }
-
- /// <summary>
- /// Checks the message state for conformity to the protocol specification
- /// and throws an exception if the message is invalid.
- /// </summary>
- /// <remarks>
- /// <para>Some messages have required fields, or combinations of fields that must relate to each other
- /// in specialized ways. After deserializing a message, this method checks the state of the
- /// message to see if it conforms to the protocol.</para>
- /// <para>Note that this property should <i>not</i> check signatures or perform any state checks
- /// outside this scope of this particular message.</para>
- /// </remarks>
- /// <exception cref="ProtocolException">Thrown if the message is invalid.</exception>
- void IMessage.EnsureValidMessage() {
- }
- }
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/IMessageFactory.cs b/src/DotNetOpenAuth.Core/Messaging/IMessageFactory.cs
index 49b9086..1e86328 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IMessageFactory.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IMessageFactory.cs
@@ -7,14 +7,12 @@
namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
/// A tool to analyze an incoming message to figure out what concrete class
/// is designed to deserialize it and instantiates that class.
/// </summary>
- [ContractClass(typeof(IMessageFactoryContract))]
public interface IMessageFactory {
/// <summary>
/// Analyzes an incoming request message payload to discover what kind of
@@ -42,53 +40,4 @@ namespace DotNetOpenAuth.Messaging {
/// </returns>
IDirectResponseProtocolMessage GetNewResponseMessage(IDirectedProtocolMessage request, IDictionary<string, string> fields);
}
-
- /// <summary>
- /// Code contract for the <see cref="IMessageFactory"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IMessageFactory))]
- internal abstract class IMessageFactoryContract : IMessageFactory {
- /// <summary>
- /// Prevents a default instance of the <see cref="IMessageFactoryContract"/> class from being created.
- /// </summary>
- private IMessageFactoryContract() {
- }
-
- #region IMessageFactory Members
-
- /// <summary>
- /// Analyzes an incoming request message payload to discover what kind of
- /// message is embedded in it and returns the type, or null if no match is found.
- /// </summary>
- /// <param name="recipient">The intended or actual recipient of the request message.</param>
- /// <param name="fields">The name/value pairs that make up the message payload.</param>
- /// <returns>
- /// A newly instantiated <see cref="IProtocolMessage"/>-derived object that this message can
- /// deserialize to. Null if the request isn't recognized as a valid protocol message.
- /// </returns>
- IDirectedProtocolMessage IMessageFactory.GetNewRequestMessage(MessageReceivingEndpoint recipient, IDictionary<string, string> fields) {
- Requires.NotNull(recipient, "recipient");
- Requires.NotNull(fields, "fields");
-
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Analyzes an incoming request message payload to discover what kind of
- /// message is embedded in it and returns the type, or null if no match is found.
- /// </summary>
- /// <param name="request">The message that was sent as a request that resulted in the response.</param>
- /// <param name="fields">The name/value pairs that make up the message payload.</param>
- /// <returns>
- /// A newly instantiated <see cref="IProtocolMessage"/>-derived object that this message can
- /// deserialize to. Null if the request isn't recognized as a valid protocol message.
- /// </returns>
- IDirectResponseProtocolMessage IMessageFactory.GetNewResponseMessage(IDirectedProtocolMessage request, IDictionary<string, string> fields) {
- Requires.NotNull(request, "request");
- Requires.NotNull(fields, "fields");
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/IMessageOriginalPayload.cs b/src/DotNetOpenAuth.Core/Messaging/IMessageOriginalPayload.cs
index 099f54b..33fa860 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IMessageOriginalPayload.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IMessageOriginalPayload.cs
@@ -8,14 +8,12 @@ namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Text;
/// <summary>
/// An interface that appears on messages that need to retain a description of
/// what their literal payload was when they were deserialized.
/// </summary>
- [ContractClass(typeof(IMessageOriginalPayloadContract))]
public interface IMessageOriginalPayload {
/// <summary>
/// Gets or sets the original message parts, before any normalization or default values were assigned.
@@ -23,18 +21,4 @@ namespace DotNetOpenAuth.Messaging {
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "By design")]
IDictionary<string, string> OriginalPayload { get; set; }
}
-
- /// <summary>
- /// Code contract for the <see cref="IMessageOriginalPayload"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IMessageOriginalPayload))]
- internal abstract class IMessageOriginalPayloadContract : IMessageOriginalPayload {
- /// <summary>
- /// Gets or sets the original message parts, before any normalization or default values were assigned.
- /// </summary>
- IDictionary<string, string> IMessageOriginalPayload.OriginalPayload {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
- }
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/IMessageWithBinaryData.cs b/src/DotNetOpenAuth.Core/Messaging/IMessageWithBinaryData.cs
index 60e1f50..2992678 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IMessageWithBinaryData.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IMessageWithBinaryData.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
@@ -15,7 +14,6 @@ namespace DotNetOpenAuth.Messaging {
/// The interface that classes must implement to be serialized/deserialized
/// as protocol or extension messages that uses POST multi-part data for binary content.
/// </summary>
- [ContractClass(typeof(IMessageWithBinaryDataContract))]
public interface IMessageWithBinaryData : IDirectedProtocolMessage {
/// <summary>
/// Gets the parts of the message that carry binary data.
@@ -28,129 +26,4 @@ namespace DotNetOpenAuth.Messaging {
/// </summary>
bool SendAsMultipart { get; }
}
-
- /// <summary>
- /// The contract class for the <see cref="IMessageWithBinaryData"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IMessageWithBinaryData))]
- internal abstract class IMessageWithBinaryDataContract : IMessageWithBinaryData {
- /// <summary>
- /// Prevents a default instance of the <see cref="IMessageWithBinaryDataContract"/> class from being created.
- /// </summary>
- private IMessageWithBinaryDataContract() {
- }
-
- #region IMessageWithBinaryData Members
-
- /// <summary>
- /// Gets the parts of the message that carry binary data.
- /// </summary>
- /// <value>A list of parts. Never null.</value>
- IList<MultipartPostPart> IMessageWithBinaryData.BinaryData {
- get {
- Contract.Ensures(Contract.Result<IList<MultipartPostPart>>() != null);
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether this message should be sent as multi-part POST.
- /// </summary>
- bool IMessageWithBinaryData.SendAsMultipart {
- get { throw new NotImplementedException(); }
- }
-
- #endregion
-
- #region IMessage Properties
-
- /// <summary>
- /// Gets the version of the protocol or extension this message is prepared to implement.
- /// </summary>
- /// <value></value>
- /// <remarks>
- /// Implementations of this interface should ensure that this property never returns null.
- /// </remarks>
- Version IMessage.Version {
- get {
- return default(Version); // dummy return
- }
- }
-
- /// <summary>
- /// Gets the extra, non-standard Protocol parameters included in the message.
- /// </summary>
- /// <value></value>
- /// <remarks>
- /// Implementations of this interface should ensure that this property never returns null.
- /// </remarks>
- IDictionary<string, string> IMessage.ExtraData {
- get {
- return default(IDictionary<string, string>);
- }
- }
-
- #endregion
-
- #region IDirectedProtocolMessage Members
-
- /// <summary>
- /// Gets the preferred method of transport for the message.
- /// </summary>
- /// <remarks>
- /// For indirect messages this will likely be GET+POST, which both can be simulated in the user agent:
- /// the GET with a simple 301 Redirect, and the POST with an HTML form in the response with javascript
- /// to automate submission.
- /// </remarks>
- HttpDeliveryMethods IDirectedProtocolMessage.HttpMethods {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the URL of the intended receiver of this message.
- /// </summary>
- Uri IDirectedProtocolMessage.Recipient {
- get { throw new NotImplementedException(); }
- }
-
- #endregion
-
- #region IProtocolMessage Members
-
- /// <summary>
- /// Gets the level of protection this message requires.
- /// </summary>
- MessageProtections IProtocolMessage.RequiredProtection {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets a value indicating whether this is a direct or indirect message.
- /// </summary>
- MessageTransport IProtocolMessage.Transport {
- get { throw new NotImplementedException(); }
- }
-
- #endregion
-
- #region IMessage methods
-
- /// <summary>
- /// Checks the message state for conformity to the protocol specification
- /// and throws an exception if the message is invalid.
- /// </summary>
- /// <remarks>
- /// <para>Some messages have required fields, or combinations of fields that must relate to each other
- /// in specialized ways. After deserializing a message, this method checks the state of the
- /// message to see if it conforms to the protocol.</para>
- /// <para>Note that this property should <i>not</i> check signatures or perform any state checks
- /// outside this scope of this particular message.</para>
- /// </remarks>
- /// <exception cref="ProtocolException">Thrown if the message is invalid.</exception>
- void IMessage.EnsureValidMessage() {
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/IProtocolMessageWithExtensions.cs b/src/DotNetOpenAuth.Core/Messaging/IProtocolMessageWithExtensions.cs
index c492e65..436c7a9 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IProtocolMessageWithExtensions.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IProtocolMessageWithExtensions.cs
@@ -7,12 +7,10 @@
namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
/// <summary>
/// A protocol message that supports adding extensions to the payload for transmission.
/// </summary>
- [ContractClass(typeof(IProtocolMessageWithExtensionsContract))]
public interface IProtocolMessageWithExtensions : IProtocolMessage {
/// <summary>
/// Gets the list of extensions that are included with this message.
@@ -22,95 +20,4 @@ namespace DotNetOpenAuth.Messaging {
/// </remarks>
IList<IExtensionMessage> Extensions { get; }
}
-
- /// <summary>
- /// Code contract for the <see cref="IProtocolMessageWithExtensions"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IProtocolMessageWithExtensions))]
- internal abstract class IProtocolMessageWithExtensionsContract : IProtocolMessageWithExtensions {
- /// <summary>
- /// Prevents a default instance of the <see cref="IProtocolMessageWithExtensionsContract"/> class from being created.
- /// </summary>
- private IProtocolMessageWithExtensionsContract() {
- }
-
- #region IProtocolMessageWithExtensions Members
-
- /// <summary>
- /// Gets the list of extensions that are included with this message.
- /// </summary>
- /// <remarks>
- /// Implementations of this interface should ensure that this property never returns null.
- /// </remarks>
- IList<IExtensionMessage> IProtocolMessageWithExtensions.Extensions {
- get {
- Contract.Ensures(Contract.Result<IList<IExtensionMessage>>() != null);
- throw new NotImplementedException();
- }
- }
-
- #endregion
-
- #region IProtocolMessage Members
-
- /// <summary>
- /// Gets the level of protection this message requires.
- /// </summary>
- MessageProtections IProtocolMessage.RequiredProtection {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets a value indicating whether this is a direct or indirect message.
- /// </summary>
- MessageTransport IProtocolMessage.Transport {
- get { throw new NotImplementedException(); }
- }
-
- #endregion
-
- #region IMessage Members
-
- /// <summary>
- /// Gets the version of the protocol or extension this message is prepared to implement.
- /// </summary>
- /// <remarks>
- /// Implementations of this interface should ensure that this property never returns null.
- /// </remarks>
- Version IMessage.Version {
- get {
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// Gets the extra, non-standard Protocol parameters included in the message.
- /// </summary>
- /// <remarks>
- /// Implementations of this interface should ensure that this property never returns null.
- /// </remarks>
- IDictionary<string, string> IMessage.ExtraData {
- get {
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// Checks the message state for conformity to the protocol specification
- /// and throws an exception if the message is invalid.
- /// </summary>
- /// <remarks>
- /// <para>Some messages have required fields, or combinations of fields that must relate to each other
- /// in specialized ways. After deserializing a message, this method checks the state of the
- /// message to see if it conforms to the protocol.</para>
- /// <para>Note that this property should <i>not</i> check signatures or perform any state checks
- /// outside this scope of this particular message.</para>
- /// </remarks>
- /// <exception cref="ProtocolException">Thrown if the message is invalid.</exception>
- void IMessage.EnsureValidMessage() {
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/IStreamSerializingDataBag.cs b/src/DotNetOpenAuth.Core/Messaging/IStreamSerializingDataBag.cs
index 42608f4..16fed67 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IStreamSerializingDataBag.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IStreamSerializingDataBag.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Messaging {
using System;
- using System.Diagnostics.Contracts;
using System.IO;
/// <summary>
diff --git a/src/DotNetOpenAuth.Core/Messaging/IncomingWebResponse.cs b/src/DotNetOpenAuth.Core/Messaging/IncomingWebResponse.cs
index 285eddd..abb01a1 100644
--- a/src/DotNetOpenAuth.Core/Messaging/IncomingWebResponse.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/IncomingWebResponse.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Messaging {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Net;
@@ -18,8 +17,6 @@ namespace DotNetOpenAuth.Messaging {
/// <summary>
/// Details on the incoming response from a direct web request to a remote party.
/// </summary>
- [ContractVerification(true)]
- [ContractClass(typeof(IncomingWebResponseContract))]
public abstract class IncomingWebResponse : IDisposable {
/// <summary>
/// The encoding to use in reading a response that does not declare its own content encoding.
diff --git a/src/DotNetOpenAuth.Core/Messaging/IncomingWebResponseContract.cs b/src/DotNetOpenAuth.Core/Messaging/IncomingWebResponseContract.cs
deleted file mode 100644
index 6798ed3..0000000
--- a/src/DotNetOpenAuth.Core/Messaging/IncomingWebResponseContract.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="IncomingWebResponseContract.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.Messaging {
- using System;
- using System.Diagnostics.Contracts;
- using System.IO;
- using Validation;
-
- /// <summary>
- /// Code contract for the <see cref="IncomingWebResponse"/> class.
- /// </summary>
- [ContractClassFor(typeof(IncomingWebResponse))]
- internal abstract class IncomingWebResponseContract : IncomingWebResponse {
- /// <summary>
- /// Gets the body of the HTTP response.
- /// </summary>
- /// <value></value>
- public override Stream ResponseStream {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Creates a text reader for the response stream.
- /// </summary>
- /// <returns>
- /// The text reader, initialized for the proper encoding.
- /// </returns>
- public override StreamReader GetResponseReader() {
- Contract.Ensures(Contract.Result<StreamReader>() != null);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets an offline snapshot version of this instance.
- /// </summary>
- /// <param name="maximumBytesToCache">The maximum bytes from the response stream to cache.</param>
- /// <returns>A snapshot version of this instance.</returns>
- /// <remarks>
- /// If this instance is a <see cref="NetworkDirectWebResponse"/> creating a snapshot
- /// will automatically close and dispose of the underlying response stream.
- /// If this instance is a <see cref="CachedDirectWebResponse"/>, the result will
- /// be the self same instance.
- /// </remarks>
- internal override CachedDirectWebResponse GetSnapshot(int maximumBytesToCache) {
- Requires.Range(maximumBytesToCache >= 0, "maximumBytesToCache");
- RequiresEx.ValidState(this.RequestUri != null);
- Contract.Ensures(Contract.Result<CachedDirectWebResponse>() != null);
- throw new NotImplementedException();
- }
- }
-}
diff --git a/src/DotNetOpenAuth.Core/Messaging/KeyedCollectionDelegate.cs b/src/DotNetOpenAuth.Core/Messaging/KeyedCollectionDelegate.cs
index daf780e..251ff30 100644
--- a/src/DotNetOpenAuth.Core/Messaging/KeyedCollectionDelegate.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/KeyedCollectionDelegate.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.ObjectModel;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
diff --git a/src/DotNetOpenAuth.Core/Messaging/MessageReceivingEndpoint.cs b/src/DotNetOpenAuth.Core/Messaging/MessageReceivingEndpoint.cs
index 808d42b..34be92d 100644
--- a/src/DotNetOpenAuth.Core/Messaging/MessageReceivingEndpoint.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/MessageReceivingEndpoint.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Messaging {
using System;
using System.Diagnostics;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
diff --git a/src/DotNetOpenAuth.Core/Messaging/MessageSerializer.cs b/src/DotNetOpenAuth.Core/Messaging/MessageSerializer.cs
index 81ae8df..1b30748 100644
--- a/src/DotNetOpenAuth.Core/Messaging/MessageSerializer.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/MessageSerializer.cs
@@ -19,7 +19,6 @@ namespace DotNetOpenAuth.Messaging {
/// <summary>
/// Serializes/deserializes OAuth messages for/from transit.
/// </summary>
- [ContractVerification(true)]
internal class MessageSerializer {
/// <summary>
/// The specific <see cref="IMessage"/>-derived type
@@ -32,10 +31,8 @@ namespace DotNetOpenAuth.Messaging {
/// </summary>
/// <param name="messageType">The specific <see cref="IMessage"/>-derived type
/// that will be serialized and deserialized using this class.</param>
- [ContractVerification(false)] // bugs/limitations in CC static analysis
private MessageSerializer(Type messageType) {
RequiresEx.NotNullSubtype<IMessage>(messageType, "messageType");
- Contract.Ensures(this.messageType != null);
this.messageType = messageType;
}
@@ -44,8 +41,7 @@ namespace DotNetOpenAuth.Messaging {
/// </summary>
/// <param name="messageType">The type of message that will be serialized/deserialized.</param>
/// <returns>A message serializer for the given message type.</returns>
- [ContractVerification(false)] // bugs/limitations in CC static analysis
- internal static MessageSerializer Get(Type messageType) {
+ internal static MessageSerializer Get(Type messageType) {
RequiresEx.NotNullSubtype<IMessage>(messageType, "messageType");
return new MessageSerializer(messageType);
@@ -95,7 +91,7 @@ namespace DotNetOpenAuth.Messaging {
string type = "string";
MessagePart partDescription;
if (messageDictionary.Description.Mapping.TryGetValue(pair.Key, out partDescription)) {
- Contract.Assume(partDescription != null);
+ Assumes.True(partDescription != null);
if (partDescription.IsRequired || partDescription.IsNondefaultValueSet(messageDictionary.Message)) {
include = true;
Type formattingType = partDescription.PreferredFormattingType;
@@ -151,7 +147,6 @@ namespace DotNetOpenAuth.Messaging {
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Parallel design with Deserialize method.")]
internal IDictionary<string, string> Serialize(MessageDictionary messageDictionary) {
Requires.NotNull(messageDictionary, "messageDictionary");
- Contract.Ensures(Contract.Result<IDictionary<string, string>>() != null);
// Rather than hand back the whole message dictionary (which
// includes keys with blank values), create a new dictionary
@@ -161,7 +156,7 @@ namespace DotNetOpenAuth.Messaging {
foreach (var pair in messageDictionary) {
MessagePart partDescription;
if (messageDictionary.Description.Mapping.TryGetValue(pair.Key, out partDescription)) {
- Contract.Assume(partDescription != null);
+ Assumes.True(partDescription != null);
if (partDescription.IsRequired || partDescription.IsNondefaultValueSet(messageDictionary.Message)) {
result.Add(pair.Key, pair.Value);
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
index 8abe3d7..fffb855 100644
--- a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.Messaging {
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.IO.Compression;
@@ -590,7 +589,6 @@ namespace DotNetOpenAuth.Messaging {
/// <returns>A sequence of key=value pairs discovered in the header. Never null, but may be empty.</returns>
internal static IEnumerable<KeyValuePair<string, string>> ParseAuthorizationHeader(string scheme, string authorizationHeader) {
Requires.NotNullOrEmpty(scheme, "scheme");
- Contract.Ensures(Contract.Result<IEnumerable<KeyValuePair<string, string>>>() != null);
string prefix = scheme + " ";
if (authorizationHeader != null) {
@@ -622,7 +620,6 @@ namespace DotNetOpenAuth.Messaging {
internal static string CombineKeyHandleAndPayload(string handle, string payload) {
Requires.NotNullOrEmpty(handle, "handle");
Requires.NotNullOrEmpty(payload, "payload");
- Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>()));
return handle + "!" + payload;
}
@@ -718,7 +715,6 @@ namespace DotNetOpenAuth.Messaging {
internal static string ComputeHash(this HashAlgorithm algorithm, string value, Encoding encoding = null) {
Requires.NotNull(algorithm, "algorithm");
Requires.NotNull(value, "value");
- Contract.Ensures(Contract.Result<string>() != null);
encoding = encoding ?? Encoding.UTF8;
byte[] bytesToHash = encoding.GetBytes(value);
@@ -737,7 +733,6 @@ namespace DotNetOpenAuth.Messaging {
internal static string ComputeHash(this HashAlgorithm algorithm, IDictionary<string, string> data, Encoding encoding = null) {
Requires.NotNull(algorithm, "algorithm");
Requires.NotNull(data, "data");
- Contract.Ensures(Contract.Result<string>() != null);
// Assemble the dictionary to sign, taking care to remove the signature itself
// in order to accurately reproduce the original signature (which of course didn't include
@@ -758,7 +753,6 @@ namespace DotNetOpenAuth.Messaging {
internal static string ComputeHash(this HashAlgorithm algorithm, IEnumerable<KeyValuePair<string, string>> sortedData, Encoding encoding = null) {
Requires.NotNull(algorithm, "algorithm");
Requires.NotNull(sortedData, "sortedData");
- Contract.Ensures(Contract.Result<string>() != null);
return ComputeHash(algorithm, CreateQueryString(sortedData), encoding);
}
@@ -980,7 +974,6 @@ namespace DotNetOpenAuth.Messaging {
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "No apparent problem. False positive?")]
internal static byte[] Compress(byte[] buffer, CompressionMethod method = CompressionMethod.Deflate) {
Requires.NotNull(buffer, "buffer");
- Contract.Ensures(Contract.Result<byte[]>() != null);
using (var ms = new MemoryStream()) {
Stream compressingStream = null;
@@ -1017,7 +1010,6 @@ namespace DotNetOpenAuth.Messaging {
[SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times", Justification = "This Dispose is safe.")]
internal static byte[] Decompress(byte[] buffer, CompressionMethod method = CompressionMethod.Deflate) {
Requires.NotNull(buffer, "buffer");
- Contract.Ensures(Contract.Result<byte[]>() != null);
using (var compressedDataStream = new MemoryStream(buffer)) {
using (var decompressedDataStream = new MemoryStream()) {
@@ -1071,7 +1063,6 @@ namespace DotNetOpenAuth.Messaging {
/// <returns>A data buffer.</returns>
internal static byte[] FromBase64WebSafeString(string base64WebSafe) {
Requires.NotNullOrEmpty(base64WebSafe, "base64WebSafe");
- Contract.Ensures(Contract.Result<byte[]>() != null);
// Restore the padding characters and original URL-unsafe characters.
int missingPaddingCharacters;
@@ -1435,7 +1426,6 @@ namespace DotNetOpenAuth.Messaging {
/// <returns>The formulated querystring style string.</returns>
internal static string CreateQueryString(IEnumerable<KeyValuePair<string, string>> args) {
Requires.NotNull(args, "args");
- Contract.Ensures(Contract.Result<string>() != null);
if (!args.Any()) {
return string.Empty;
@@ -1639,7 +1629,6 @@ namespace DotNetOpenAuth.Messaging {
/// <c>Dictionary&lt;string, string&gt;</c> does not allow null keys.
/// </remarks>
internal static Dictionary<string, string> ToDictionary(this NameValueCollection nvc) {
- Contract.Ensures((nvc != null && Contract.Result<Dictionary<string, string>>() != null) || (nvc == null && Contract.Result<Dictionary<string, string>>() == null));
return ToDictionary(nvc, false);
}
@@ -1655,7 +1644,6 @@ namespace DotNetOpenAuth.Messaging {
/// <returns>The generated dictionary, or null if <paramref name="nvc"/> is null.</returns>
/// <exception cref="ArgumentException">Thrown if <paramref name="throwOnNullKey"/> is <c>true</c> and a null key is encountered.</exception>
internal static Dictionary<string, string> ToDictionary(this NameValueCollection nvc, bool throwOnNullKey) {
- Contract.Ensures((nvc != null && Contract.Result<Dictionary<string, string>>() != null) || (nvc == null && Contract.Result<Dictionary<string, string>>() == null));
if (nvc == null) {
return null;
}
@@ -1709,7 +1697,6 @@ namespace DotNetOpenAuth.Messaging {
Requires.NotNull(source, "source");
Requires.NotNull(comparer, "comparer");
Requires.NotNull(keySelector, "keySelector");
- Contract.Ensures(Contract.Result<IOrderedEnumerable<TSource>>() != null);
return System.Linq.Enumerable.OrderBy<TSource, TKey>(source, keySelector, new ComparisonHelper<TKey>(comparer));
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/MultipartPostPart.cs b/src/DotNetOpenAuth.Core/Messaging/MultipartPostPart.cs
index 8a175d6..b4a0968 100644
--- a/src/DotNetOpenAuth.Core/Messaging/MultipartPostPart.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/MultipartPostPart.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.IO;
using System.Net;
using System.Text;
diff --git a/src/DotNetOpenAuth.Core/Messaging/NetworkDirectWebResponse.cs b/src/DotNetOpenAuth.Core/Messaging/NetworkDirectWebResponse.cs
index 2ad6cfc..754d71d 100644
--- a/src/DotNetOpenAuth.Core/Messaging/NetworkDirectWebResponse.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/NetworkDirectWebResponse.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Messaging {
using System;
using System.Diagnostics;
- using System.Diagnostics.Contracts;
using System.IO;
using System.Net;
using System.Text;
@@ -17,7 +16,6 @@ namespace DotNetOpenAuth.Messaging {
/// A live network HTTP response
/// </summary>
[DebuggerDisplay("{Status} {ContentType.MediaType}")]
- [ContractVerification(true)]
internal class NetworkDirectWebResponse : IncomingWebResponse, IDisposable {
/// <summary>
/// The network response object, used to initialize this instance, that still needs
diff --git a/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs b/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs
index 2e99e4c..be7774f 100644
--- a/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponse.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Messaging {
using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.IO;
using System.Net;
using System.Net.Mime;
diff --git a/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponseActionResult.cs b/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponseActionResult.cs
index d8bb1a6..bc2f985 100644
--- a/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponseActionResult.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/OutgoingWebResponseActionResult.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Messaging {
using System;
- using System.Diagnostics.Contracts;
using System.Web.Mvc;
using DotNetOpenAuth.Messaging;
using Validation;
diff --git a/src/DotNetOpenAuth.Core/Messaging/ProtocolException.cs b/src/DotNetOpenAuth.Core/Messaging/ProtocolException.cs
index 982e1c0..4bc3590 100644
--- a/src/DotNetOpenAuth.Core/Messaging/ProtocolException.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/ProtocolException.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Security;
using System.Security.Permissions;
diff --git a/src/DotNetOpenAuth.Core/Messaging/Reflection/IMessagePartEncoder.cs b/src/DotNetOpenAuth.Core/Messaging/Reflection/IMessagePartEncoder.cs
index 98c9cce..017c7d7 100644
--- a/src/DotNetOpenAuth.Core/Messaging/Reflection/IMessagePartEncoder.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/Reflection/IMessagePartEncoder.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Messaging.Reflection {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using Validation;
@@ -18,7 +17,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
/// <remarks>
/// Implementations of this interface must include a default constructor and must be thread-safe.
/// </remarks>
- [ContractClass(typeof(IMessagePartEncoderContract))]
public interface IMessagePartEncoder {
/// <summary>
/// Encodes the specified value.
@@ -35,45 +33,4 @@ namespace DotNetOpenAuth.Messaging.Reflection {
/// <exception cref="FormatException">Thrown when the string value given cannot be decoded into the required object type.</exception>
object Decode(string value);
}
-
- /// <summary>
- /// Code contract for the <see cref="IMessagePartEncoder"/> type.
- /// </summary>
- [ContractClassFor(typeof(IMessagePartEncoder))]
- internal abstract class IMessagePartEncoderContract : IMessagePartEncoder {
- /// <summary>
- /// Initializes a new instance of the <see cref="IMessagePartEncoderContract"/> class.
- /// </summary>
- protected IMessagePartEncoderContract() {
- }
-
- #region IMessagePartEncoder Members
-
- /// <summary>
- /// Encodes the specified value.
- /// </summary>
- /// <param name="value">The value. Guaranteed to never be null.</param>
- /// <returns>
- /// The <paramref name="value"/> in string form, ready for message transport.
- /// </returns>
- string IMessagePartEncoder.Encode(object value) {
- Requires.NotNull(value, "value");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Decodes the specified value.
- /// </summary>
- /// <param name="value">The string value carried by the transport. Guaranteed to never be null, although it may be empty.</param>
- /// <returns>
- /// The deserialized form of the given string.
- /// </returns>
- /// <exception cref="FormatException">Thrown when the string value given cannot be decoded into the required object type.</exception>
- object IMessagePartEncoder.Decode(string value) {
- Requires.NotNull(value, "value");
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescription.cs b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescription.cs
index 8a34be6..cd04e1d 100644
--- a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescription.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescription.cs
@@ -81,7 +81,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
[Pure]
internal MessageDictionary GetDictionary(IMessage message) {
Requires.NotNull(message, "message");
- Contract.Ensures(Contract.Result<MessageDictionary>() != null);
return this.GetDictionary(message, false);
}
@@ -94,7 +93,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
[Pure]
internal MessageDictionary GetDictionary(IMessage message, bool getOriginalValues) {
Requires.NotNull(message, "message");
- Contract.Ensures(Contract.Result<MessageDictionary>() != null);
return new MessageDictionary(message, this, getOriginalValues);
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescriptionCollection.cs b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescriptionCollection.cs
index e3d612e..f27a7af 100644
--- a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescriptionCollection.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescriptionCollection.cs
@@ -15,7 +15,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
/// <summary>
/// A cache of <see cref="MessageDescription"/> instances.
/// </summary>
- [ContractVerification(true)]
internal class MessageDescriptionCollection : IEnumerable<MessageDescription> {
/// <summary>
/// A dictionary of reflected message types and the generated reflection information.
@@ -71,7 +70,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
internal MessageDescription Get(Type messageType, Version messageVersion) {
RequiresEx.NotNullSubtype<IMessage>(messageType, "messageType");
Requires.NotNull(messageVersion, "messageVersion");
- Contract.Ensures(Contract.Result<MessageDescription>() != null);
MessageTypeAndVersion key = new MessageTypeAndVersion(messageType, messageVersion);
@@ -107,7 +105,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
[Pure]
internal MessageDescription Get(IMessage message) {
Requires.NotNull(message, "message");
- Contract.Ensures(Contract.Result<MessageDescription>() != null);
return this.Get(message.GetType(), message.Version);
}
@@ -137,8 +134,7 @@ namespace DotNetOpenAuth.Messaging.Reflection {
/// <summary>
/// A struct used as the key to bundle message type and version.
/// </summary>
- [ContractVerification(true)]
- private struct MessageTypeAndVersion {
+ private struct MessageTypeAndVersion {
/// <summary>
/// Backing store for the <see cref="Type"/> property.
/// </summary>
diff --git a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDictionary.cs b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDictionary.cs
index c3e6f65..a2dddb2 100644
--- a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDictionary.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDictionary.cs
@@ -18,7 +18,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
/// provides access to both well-defined message properties and "extra"
/// name/value pairs that have no properties associated with them.
/// </summary>
- [ContractVerification(false)]
internal class MessageDictionary : IDictionary<string, string> {
/// <summary>
/// The <see cref="IMessage"/> instance manipulated by this dictionary.
@@ -56,7 +55,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
/// </summary>
public IMessage Message {
get {
- Contract.Ensures(Contract.Result<IMessage>() != null);
return this.message;
}
}
@@ -66,7 +64,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
/// </summary>
public MessageDescription Description {
get {
- Contract.Ensures(Contract.Result<MessageDescription>() != null);
return this.description;
}
}
@@ -381,7 +378,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
/// <returns>The generated dictionary.</returns>
[Pure]
public IDictionary<string, string> Serialize() {
- Contract.Ensures(Contract.Result<IDictionary<string, string>>() != null);
return this.Serializer.Serialize(this);
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessagePart.cs b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessagePart.cs
index 6c9aef3..add4beb 100644
--- a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessagePart.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessagePart.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Net.Security;
@@ -21,7 +20,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
/// <summary>
/// Describes an individual member of a message and assists in its serialization.
/// </summary>
- [ContractVerification(true)]
[DebuggerDisplay("MessagePart {Name}")]
internal class MessagePart {
/// <summary>
@@ -67,20 +65,20 @@ namespace DotNetOpenAuth.Messaging.Reflection {
[SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline", Justification = "Much more efficient initialization when we can call methods.")]
static MessagePart() {
Func<string, Uri> safeUri = str => {
- Contract.Assume(str != null);
+ Assumes.True(str != null);
return new Uri(str);
};
Func<string, bool> safeBool = str => {
- Contract.Assume(str != null);
+ Assumes.True(str != null);
return bool.Parse(str);
};
Func<byte[], string> safeFromByteArray = bytes => {
- Contract.Assume(bytes != null);
+ Assumes.True(bytes != null);
return Convert.ToBase64String(bytes);
};
Func<string, byte[]> safeToByteArray = str => {
- Contract.Assume(str != null);
+ Assumes.True(str != null);
return Convert.FromBase64String(str);
};
Map<Uri>(uri => uri.AbsoluteUri, uri => uri.OriginalString, safeUri);
@@ -120,7 +118,7 @@ namespace DotNetOpenAuth.Messaging.Reflection {
this.memberDeclaredType = (this.field != null) ? this.field.FieldType : this.property.PropertyType;
this.defaultMemberValue = DeriveDefaultValue(this.memberDeclaredType);
- Contract.Assume(this.memberDeclaredType != null); // CC missing PropertyInfo.PropertyType ensures result != null
+ Assumes.True(this.memberDeclaredType != null); // CC missing PropertyInfo.PropertyType ensures result != null
if (attribute.Encoder == null) {
if (!converters.TryGetValue(this.memberDeclaredType, out this.converter)) {
if (this.memberDeclaredType.IsGenericType &&
@@ -395,7 +393,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
/// <returns>An instance of the desired encoder.</returns>
private static IMessagePartEncoder GetEncoder(Type messagePartEncoder) {
Requires.NotNull(messagePartEncoder, "messagePartEncoder");
- Contract.Ensures(Contract.Result<IMessagePartEncoder>() != null);
IMessagePartEncoder encoder;
lock (encoders) {
diff --git a/src/DotNetOpenAuth.Core/Messaging/Reflection/ValueMapping.cs b/src/DotNetOpenAuth.Core/Messaging/Reflection/ValueMapping.cs
index 7acff7e..c45eb5d 100644
--- a/src/DotNetOpenAuth.Core/Messaging/Reflection/ValueMapping.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/Reflection/ValueMapping.cs
@@ -6,13 +6,11 @@
namespace DotNetOpenAuth.Messaging.Reflection {
using System;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
/// A pair of conversion functions to map some type to a string and back again.
/// </summary>
- [ContractVerification(true)]
internal struct ValueMapping {
/// <summary>
/// The mapping function that converts some custom type to a string.
diff --git a/src/DotNetOpenAuth.Core/Messaging/StandardMessageFactory.cs b/src/DotNetOpenAuth.Core/Messaging/StandardMessageFactory.cs
index 37ab864..fd35e5f 100644
--- a/src/DotNetOpenAuth.Core/Messaging/StandardMessageFactory.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/StandardMessageFactory.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -209,7 +208,6 @@ namespace DotNetOpenAuth.Messaging {
protected virtual IDirectedProtocolMessage InstantiateAsRequest(MessageDescription messageDescription, MessageReceivingEndpoint recipient) {
Requires.NotNull(messageDescription, "messageDescription");
Requires.NotNull(recipient, "recipient");
- Contract.Ensures(Contract.Result<IDirectedProtocolMessage>() != null);
ConstructorInfo ctor = this.requestMessageTypes[messageDescription];
return (IDirectedProtocolMessage)ctor.Invoke(new object[] { recipient.Location, messageDescription.MessageVersion });
@@ -224,7 +222,6 @@ namespace DotNetOpenAuth.Messaging {
protected virtual IDirectResponseProtocolMessage InstantiateAsResponse(MessageDescription messageDescription, IDirectedProtocolMessage request) {
Requires.NotNull(messageDescription, "messageDescription");
Requires.NotNull(request, "request");
- Contract.Ensures(Contract.Result<IDirectResponseProtocolMessage>() != null);
Type requestType = request.GetType();
var ctors = this.FindMatchingResponseConstructors(messageDescription, requestType);
@@ -278,7 +275,6 @@ namespace DotNetOpenAuth.Messaging {
private static int CountInCommon(ICollection<string> collection1, ICollection<string> collection2, StringComparison comparison = StringComparison.Ordinal) {
Requires.NotNull(collection1, "collection1");
Requires.NotNull(collection2, "collection2");
- Contract.Ensures(Contract.Result<int>() >= 0 && Contract.Result<int>() <= Math.Min(collection1.Count, collection2.Count));
return collection1.Count(value1 => collection2.Any(value2 => string.Equals(value1, value2, comparison)));
}
diff --git a/src/DotNetOpenAuth.Core/Messaging/StandardMessageFactoryChannel.cs b/src/DotNetOpenAuth.Core/Messaging/StandardMessageFactoryChannel.cs
index 2c9f0ce..9cb80b0 100644
--- a/src/DotNetOpenAuth.Core/Messaging/StandardMessageFactoryChannel.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/StandardMessageFactoryChannel.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using Reflection;
@@ -99,7 +98,6 @@ namespace DotNetOpenAuth.Messaging {
{
Requires.NotNull(messageTypes, "messageTypes");
Requires.NotNull(descriptionsCache, "descriptionsCache");
- Contract.Ensures(Contract.Result<IEnumerable<MessageDescription>>() != null);
// Get all the MessageDescription objects through the standard cache,
// so that perhaps it will be a quick lookup, or at least it will be
diff --git a/src/DotNetOpenAuth.Core/Messaging/UriStyleMessageFormatter.cs b/src/DotNetOpenAuth.Core/Messaging/UriStyleMessageFormatter.cs
index b5ae6bc..1d7c424 100644
--- a/src/DotNetOpenAuth.Core/Messaging/UriStyleMessageFormatter.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/UriStyleMessageFormatter.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
diff --git a/src/DotNetOpenAuth.Core/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.Core/Properties/AssemblyInfo.cs
index 21cbb94..7f8a591 100644
--- a/src/DotNetOpenAuth.Core/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.Core/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.Core/PureAttribute.cs b/src/DotNetOpenAuth.Core/PureAttribute.cs
new file mode 100644
index 0000000..04f7ead
--- /dev/null
+++ b/src/DotNetOpenAuth.Core/PureAttribute.cs
@@ -0,0 +1,22 @@
+//-----------------------------------------------------------------------
+// <copyright file="PureAttribute.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace System.Diagnostics.Contracts {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
+#if !CLR4
+ /// <summary>
+ /// Designates a type or member as one that does not mutate any objects that were allocated
+ /// before the invocation of the member.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = false)]
+ internal sealed class PureAttribute : Attribute {
+ }
+#endif
+}
diff --git a/src/DotNetOpenAuth.Core/Reporting.cs b/src/DotNetOpenAuth.Core/Reporting.cs
index dc8482f..f902fd6 100644
--- a/src/DotNetOpenAuth.Core/Reporting.cs
+++ b/src/DotNetOpenAuth.Core/Reporting.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth {
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.IO.IsolatedStorage;
@@ -535,8 +534,6 @@ namespace DotNetOpenAuth {
/// </summary>
/// <returns>An isolated storage location appropriate for our host.</returns>
private static IsolatedStorageFile GetIsolatedStorage() {
- Contract.Ensures(Contract.Result<IsolatedStorageFile>() != null);
-
IsolatedStorageFile result = null;
// We'll try for whatever storage location we can get,
@@ -569,7 +566,6 @@ namespace DotNetOpenAuth {
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "No apparent problem. False positive?")]
private static Guid GetOrCreateOriginIdentity() {
RequiresEx.ValidState(file != null, "file not set.");
- Contract.Ensures(Contract.Result<Guid>() != Guid.Empty);
Guid identityGuid = Guid.Empty;
const int GuidLength = 16;
diff --git a/src/DotNetOpenAuth.Core/RequiresEx.cs b/src/DotNetOpenAuth.Core/RequiresEx.cs
index 8779b2f..1a077c4 100644
--- a/src/DotNetOpenAuth.Core/RequiresEx.cs
+++ b/src/DotNetOpenAuth.Core/RequiresEx.cs
@@ -23,16 +23,11 @@ namespace DotNetOpenAuth {
/// Validates some expression describing the acceptable condition for an argument evaluates to true.
/// </summary>
/// <param name="condition">The expression that must evaluate to true to avoid an <see cref="InvalidOperationException"/>.</param>
-#if !CLR4
- [ContractArgumentValidator]
-#endif
[Pure, DebuggerStepThrough]
internal static void ValidState(bool condition) {
if (!condition) {
throw new InvalidOperationException();
}
-
- Contract.EndContractBlock();
}
/// <summary>
@@ -40,16 +35,11 @@ namespace DotNetOpenAuth {
/// </summary>
/// <param name="condition">The expression that must evaluate to true to avoid an <see cref="InvalidOperationException"/>.</param>
/// <param name="message">The message to include with the exception.</param>
-#if !CLR4
- [ContractArgumentValidator]
-#endif
[Pure, DebuggerStepThrough]
internal static void ValidState(bool condition, string message) {
if (!condition) {
throw new InvalidOperationException(message);
}
-
- Contract.EndContractBlock();
}
/// <summary>
@@ -58,16 +48,11 @@ namespace DotNetOpenAuth {
/// <param name="condition">The expression that must evaluate to true to avoid an <see cref="InvalidOperationException"/>.</param>
/// <param name="unformattedMessage">The unformatted message.</param>
/// <param name="args">Formatting arguments.</param>
-#if !CLR4
- [ContractArgumentValidator]
-#endif
[Pure, DebuggerStepThrough]
internal static void ValidState(bool condition, string unformattedMessage, params object[] args) {
if (!condition) {
throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, unformattedMessage, args));
}
-
- Contract.EndContractBlock();
}
/// <summary>
@@ -76,15 +61,10 @@ namespace DotNetOpenAuth {
/// <typeparam name="T">The type that the argument must be or derive from.</typeparam>
/// <param name="type">The type given in the argument.</param>
/// <param name="parameterName">Name of the parameter.</param>
-#if !CLR4
- [ContractArgumentValidator]
-#endif
[Pure, DebuggerStepThrough]
internal static void NotNullSubtype<T>(Type type, string parameterName) {
Requires.NotNull(type, parameterName);
Requires.That(typeof(T).IsAssignableFrom(type), parameterName, MessagingStrings.UnexpectedType, typeof(T).FullName, type.FullName);
-
- Contract.EndContractBlock();
}
/// <summary>
@@ -92,16 +72,11 @@ namespace DotNetOpenAuth {
/// </summary>
/// <param name="condition">The expression that must evaluate to true to avoid an <see cref="FormatException"/>.</param>
/// <param name="message">The message.</param>
-#if !CLR4
- [ContractArgumentValidator]
-#endif
[Pure, DebuggerStepThrough]
internal static void Format(bool condition, string message) {
if (!condition) {
throw new FormatException(message);
}
-
- Contract.EndContractBlock();
}
/// <summary>
diff --git a/src/DotNetOpenAuth.Core/UriUtil.cs b/src/DotNetOpenAuth.Core/UriUtil.cs
index 824ab6b..25b92a2 100644
--- a/src/DotNetOpenAuth.Core/UriUtil.cs
+++ b/src/DotNetOpenAuth.Core/UriUtil.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth {
using System;
using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
@@ -19,7 +18,6 @@ namespace DotNetOpenAuth {
/// <summary>
/// Utility methods for working with URIs.
/// </summary>
- [ContractVerification(true)]
internal static class UriUtil {
/// <summary>
/// Tests a URI for the presence of an OAuth payload.
@@ -29,15 +27,14 @@ namespace DotNetOpenAuth {
/// <returns>
/// True if the URI contains an OAuth message.
/// </returns>
- [ContractVerification(false)] // bugs/limitations in CC static analysis
- internal static bool QueryStringContainPrefixedParameters(this Uri uri, string prefix) {
+ internal static bool QueryStringContainPrefixedParameters(this Uri uri, string prefix) {
Requires.NotNullOrEmpty(prefix, "prefix");
if (uri == null) {
return false;
}
NameValueCollection nvc = HttpUtility.ParseQueryString(uri.Query);
- Contract.Assume(nvc != null); // BCL
+ Assumes.True(nvc != null); // BCL
return nvc.Keys.OfType<string>().Any(key => key.StartsWith(prefix, StringComparison.Ordinal));
}
@@ -61,7 +58,6 @@ namespace DotNetOpenAuth {
/// <returns>The string version of the Uri.</returns>
internal static string ToStringWithImpliedPorts(this UriBuilder builder) {
Requires.NotNull(builder, "builder");
- Contract.Ensures(Contract.Result<string>() != null);
// We only check for implied ports on HTTP and HTTPS schemes since those
// are the only ones supported by OpenID anyway.
@@ -74,7 +70,7 @@ namespace DotNetOpenAuth {
// we're removing only the port (and not something in the query string that
// looks like a port.
string result = Regex.Replace(url, @"^(https?://[^:]+):\d+", m => m.Groups[1].Value, RegexOptions.IgnoreCase);
- Contract.Assume(result != null); // Regex.Replace never returns null
+ Assumes.True(result != null); // Regex.Replace never returns null
return result;
} else {
// The port must be explicitly given anyway.
@@ -96,12 +92,12 @@ namespace DotNetOpenAuth {
}
if (page != null && !designMode) {
- Contract.Assume(page.Request != null);
+ Assumes.True(page.Request != null);
// Validate new value by trying to construct a Realm object based on it.
string relativeUrl = page.ResolveUrl(value);
- Contract.Assume(page.Request.Url != null);
- Contract.Assume(relativeUrl != null);
+ Assumes.True(page.Request.Url != null);
+ Assumes.True(relativeUrl != null);
new Uri(page.Request.Url, relativeUrl); // throws an exception on failure.
} else {
// We can't fully test it, but it should start with either ~/ or a protocol.
diff --git a/src/DotNetOpenAuth.Core/Util.cs b/src/DotNetOpenAuth.Core/Util.cs
index fc293d2..ec28c50 100644
--- a/src/DotNetOpenAuth.Core/Util.cs
+++ b/src/DotNetOpenAuth.Core/Util.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Net;
using System.Reflection;
@@ -22,7 +21,6 @@ namespace DotNetOpenAuth {
/// <summary>
/// A grab-bag utility class.
/// </summary>
- [ContractVerification(true)]
internal static class Util {
/// <summary>
/// The base namespace for this library from which all other namespaces derive.
@@ -139,7 +137,6 @@ namespace DotNetOpenAuth {
/// <param name="list">The list of elements.</param>
/// <param name="multiLineElements">if set to <c>true</c>, special formatting will be applied to the output to make it clear where one element ends and the next begins.</param>
/// <returns>An object whose ToString method will perform the actual work of generating the string.</returns>
- [ContractVerification(false)]
internal static object ToStringDeferred<T>(this IEnumerable<T> list, bool multiLineElements) {
return new DelayedToString<IEnumerable<T>>(
list,
@@ -148,7 +145,7 @@ namespace DotNetOpenAuth {
ErrorUtilities.VerifyArgumentNotNull(l, "l");
string newLine = Environment.NewLine;
- ////Contract.Assume(newLine != null && newLine.Length > 0);
+ ////Assumes.True(newLine != null && newLine.Length > 0);
StringBuilder sb = new StringBuilder();
if (multiLineElements) {
sb.AppendLine("[{");
diff --git a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ClaimType.cs b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ClaimType.cs
index 831e38d..53898ba 100644
--- a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ClaimType.cs
+++ b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ClaimType.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.InfoCard {
using System;
using System.ComponentModel;
- using System.Diagnostics.Contracts;
using System.IdentityModel.Claims;
using System.Web.UI;
@@ -16,7 +15,6 @@ namespace DotNetOpenAuth.InfoCard {
/// </summary>
[PersistChildren(false)]
[Serializable]
- [ContractVerification(true)]
public class ClaimType {
/// <summary>
/// Initializes a new instance of the <see cref="ClaimType"/> class.
diff --git a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardImage.cs b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardImage.cs
index 821ea1b..cdb0562 100644
--- a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardImage.cs
+++ b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardImage.cs
@@ -23,7 +23,6 @@
namespace DotNetOpenAuth.InfoCard {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
/// <summary>
@@ -130,7 +129,7 @@ namespace DotNetOpenAuth.InfoCard {
/// <returns>The manifest resource stream name.</returns>
internal static string GetImageManifestResourceStreamName(InfoCardImageSize size) {
string imageSize = size.ToString();
- Contract.Assume(imageSize.Length >= 6);
+ Assumes.True(imageSize.Length >= 6);
imageSize = imageSize.Substring(4);
return string.Format(CultureInfo.InvariantCulture, UrlFormatString, imageSize);
}
diff --git a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardSelector.cs b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardSelector.cs
index d9e8687..3b6b368 100644
--- a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardSelector.cs
+++ b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/InfoCardSelector.cs
@@ -48,7 +48,6 @@ namespace DotNetOpenAuth.InfoCard {
[PersistChildren(false)]
[DefaultEvent("ReceivedToken")]
[ToolboxData("<{0}:InfoCardSelector runat=\"server\"><ClaimsRequested><{0}:ClaimType Name=\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier\" /></ClaimsRequested><UnsupportedTemplate><p>Your browser does not support Information Cards.</p></UnsupportedTemplate></{0}:InfoCardSelector>")]
- [ContractVerification(true)]
public class InfoCardSelector : CompositeControl, IPostBackEventHandler {
/// <summary>
/// The resource name for getting at the SupportingScript.js embedded manifest stream.
@@ -230,7 +229,6 @@ namespace DotNetOpenAuth.InfoCard {
[PersistenceMode(PersistenceMode.InnerProperty), Category(InfoCardCategory)]
public Collection<ClaimType> ClaimsRequested {
get {
- Contract.Ensures(Contract.Result<Collection<ClaimType>>() != null);
if (this.ViewState[ClaimsRequestedViewStateKey] == null) {
var claims = new Collection<ClaimType>();
this.ViewState[ClaimsRequestedViewStateKey] = claims;
@@ -548,7 +546,6 @@ namespace DotNetOpenAuth.InfoCard {
/// <param name="value">The parameter value.</param>
/// <returns>The control that renders to the Param tag.</returns>
private static string CreateParamJs(string name, string value) {
- Contract.Ensures(Contract.Result<string>() != null);
string scriptFormat = @" objp = document.createElement('param');
objp.name = {0};
objp.value = {1};
@@ -568,8 +565,6 @@ namespace DotNetOpenAuth.InfoCard {
/// <returns>The Panel control</returns>
[Pure]
private Panel CreateInfoCardSupportedPanel() {
- Contract.Ensures(Contract.Result<Panel>() != null);
-
Panel supportedPanel = new Panel();
try {
@@ -627,8 +622,6 @@ namespace DotNetOpenAuth.InfoCard {
/// <returns>The Panel control.</returns>
[Pure]
private Panel CreateInfoCardUnsupportedPanel() {
- Contract.Ensures(Contract.Result<Panel>() != null);
-
Panel unsupportedPanel = new Panel();
try {
if (this.UnsupportedTemplate != null) {
@@ -726,8 +719,6 @@ namespace DotNetOpenAuth.InfoCard {
[Pure]
private void GetRequestedClaims(out string required, out string optional) {
RequiresEx.ValidState(this.ClaimsRequested != null);
- Contract.Ensures(Contract.ValueAtReturn<string>(out required) != null);
- Contract.Ensures(Contract.ValueAtReturn<string>(out optional) != null);
var nonEmptyClaimTypes = this.ClaimsRequested.Where(c => c.Name != null);
@@ -742,8 +733,8 @@ namespace DotNetOpenAuth.InfoCard {
string[] optionalClaimsArray = optionalClaims.ToArray();
required = string.Join(" ", requiredClaimsArray);
optional = string.Join(" ", optionalClaimsArray);
- Contract.Assume(required != null);
- Contract.Assume(optional != null);
+ Assumes.True(required != null);
+ Assumes.True(optional != null);
}
/// <summary>
diff --git a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivedTokenEventArgs.cs b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivedTokenEventArgs.cs
index 94d3d63..2ec124b 100644
--- a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivedTokenEventArgs.cs
+++ b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivedTokenEventArgs.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.InfoCard {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Xml.XPath;
/// <summary>
diff --git a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivingTokenEventArgs.cs b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivingTokenEventArgs.cs
index ed3b6ae..6de2ef0 100644
--- a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivingTokenEventArgs.cs
+++ b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/ReceivingTokenEventArgs.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.InfoCard {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.IdentityModel.Tokens;
using System.Security.Cryptography.X509Certificates;
using Validation;
diff --git a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/TokenProcessingErrorEventArgs.cs b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/TokenProcessingErrorEventArgs.cs
index b744e48..104df15 100644
--- a/src/DotNetOpenAuth.InfoCard.UI/InfoCard/TokenProcessingErrorEventArgs.cs
+++ b/src/DotNetOpenAuth.InfoCard.UI/InfoCard/TokenProcessingErrorEventArgs.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.InfoCard {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
diff --git a/src/DotNetOpenAuth.InfoCard.UI/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.InfoCard.UI/Properties/AssemblyInfo.cs
index 69b7345..bc8a8cc 100644
--- a/src/DotNetOpenAuth.InfoCard.UI/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.InfoCard.UI/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -33,8 +32,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.InfoCard/InfoCard/Token/Token.cs b/src/DotNetOpenAuth.InfoCard/InfoCard/Token/Token.cs
index a87643a..2ac1788 100644
--- a/src/DotNetOpenAuth.InfoCard/InfoCard/Token/Token.cs
+++ b/src/DotNetOpenAuth.InfoCard/InfoCard/Token/Token.cs
@@ -23,7 +23,6 @@ namespace DotNetOpenAuth.InfoCard {
/// <summary>
/// The decrypted token that was submitted as an Information Card.
/// </summary>
- [ContractVerification(true)]
public class Token {
/// <summary>
/// Backing field for the <see cref="Claims"/> property.
@@ -46,7 +45,6 @@ namespace DotNetOpenAuth.InfoCard {
private Token(string tokenXml, Uri audience, TokenDecryptor decryptor) {
Requires.NotNullOrEmpty(tokenXml, "tokenXml");
Requires.That(decryptor != null || !IsEncrypted(tokenXml), "decryptor", "Required when tokenXml is encrypted.");
- Contract.Ensures(this.AuthorizationContext != null);
byte[] decryptedBytes;
string decryptedString;
@@ -54,12 +52,12 @@ namespace DotNetOpenAuth.InfoCard {
using (StringReader xmlReader = new StringReader(tokenXml)) {
var readerSettings = MessagingUtilities.CreateUntrustedXmlReaderSettings();
using (XmlReader tokenReader = XmlReader.Create(xmlReader, readerSettings)) {
- Contract.Assume(tokenReader != null); // BCL contract should say XmlReader.Create result != null
+ Assumes.True(tokenReader != null); // BCL contract should say XmlReader.Create result != null
if (IsEncrypted(tokenReader)) {
Logger.InfoCard.DebugFormat("Incoming SAML token, before decryption: {0}", tokenXml);
decryptedBytes = decryptor.DecryptToken(tokenReader);
decryptedString = Encoding.UTF8.GetString(decryptedBytes);
- Contract.Assume(decryptedString != null); // BCL contracts should be enhanced here
+ Assumes.True(decryptedString != null); // BCL contracts should be enhanced here
} else {
decryptedBytes = Encoding.UTF8.GetBytes(tokenXml);
decryptedString = tokenXml;
@@ -182,7 +180,6 @@ namespace DotNetOpenAuth.InfoCard {
public static Token Read(string tokenXml, Uri audience, IEnumerable<SecurityToken> decryptionTokens) {
Requires.NotNullOrEmpty(tokenXml, "tokenXml");
Requires.NotNull(decryptionTokens, "decryptionTokens");
- Contract.Ensures(Contract.Result<Token>() != null);
TokenDecryptor decryptor = null;
@@ -216,7 +213,7 @@ namespace DotNetOpenAuth.InfoCard {
}
try {
- Contract.Assume(tokenReader != null); // CC missing for XmlReader.Create
+ Assumes.True(tokenReader != null); // CC missing for XmlReader.Create
return IsEncrypted(tokenReader);
} catch {
IDisposable disposableReader = tokenReader;
diff --git a/src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenDecryptor.cs b/src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenDecryptor.cs
index 8f5697d..fab5148 100644
--- a/src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenDecryptor.cs
+++ b/src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenDecryptor.cs
@@ -13,7 +13,6 @@ namespace DotNetOpenAuth.InfoCard {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.IdentityModel.Selectors;
using System.IdentityModel.Tokens;
using System.Linq;
@@ -91,7 +90,6 @@ namespace DotNetOpenAuth.InfoCard {
/// <returns>A byte array of the contents of the encrypted token</returns>
internal byte[] DecryptToken(XmlReader reader) {
Requires.NotNull(reader, "reader");
- Contract.Ensures(Contract.Result<byte[]>() != null);
byte[] securityTokenData;
string encryptionAlgorithm;
diff --git a/src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenUtility.cs b/src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenUtility.cs
index 88c607a..616cb9f 100644
--- a/src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenUtility.cs
+++ b/src/DotNetOpenAuth.InfoCard/InfoCard/Token/TokenUtility.cs
@@ -13,7 +13,6 @@ namespace DotNetOpenAuth.InfoCard {
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.IdentityModel.Claims;
using System.IdentityModel.Policy;
using System.IdentityModel.Selectors;
@@ -50,8 +49,6 @@ namespace DotNetOpenAuth.InfoCard {
/// The authorization context carried by the token.
/// </returns>
internal static AuthorizationContext AuthenticateToken(XmlReader reader, Uri audience) {
- Contract.Ensures(Contract.Result<AuthorizationContext>() != null);
-
// Extensibility Point:
// in order to accept different token types, you would need to add additional
// code to create an authenticationcontext from the security token.
@@ -228,7 +225,6 @@ namespace DotNetOpenAuth.InfoCard {
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "False positive.")]
internal static string CalculateSiteSpecificID(string ppid) {
Requires.NotNull(ppid, "ppid");
- Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>()));
int callSignChars = 10;
char[] charMap = "QL23456789ABCDEFGHJKMNPRSTUVWXYZ".ToCharArray();
@@ -282,7 +278,6 @@ namespace DotNetOpenAuth.InfoCard {
private static string ComputeCombinedId(RSA issuerKey, string claimValue) {
Requires.NotNull(issuerKey, "issuerKey");
Requires.NotNull(claimValue, "claimValue");
- Contract.Ensures(Contract.Result<string>() != null);
int nameLength = Encoding.UTF8.GetByteCount(claimValue);
RSAParameters rsaParams = issuerKey.ExportParameters(false);
diff --git a/src/DotNetOpenAuth.InfoCard/InfoCardErrorUtilities.cs b/src/DotNetOpenAuth.InfoCard/InfoCardErrorUtilities.cs
index 739b6e4..aaff82b 100644
--- a/src/DotNetOpenAuth.InfoCard/InfoCardErrorUtilities.cs
+++ b/src/DotNetOpenAuth.InfoCard/InfoCardErrorUtilities.cs
@@ -28,9 +28,7 @@ namespace DotNetOpenAuth {
[Pure]
internal static void VerifyInfoCard(bool condition, string errorMessage, params object[] args) {
Requires.NotNull(args, "args");
- Contract.Ensures(condition);
- Contract.EnsuresOnThrow<InfoCard.InformationCardException>(!condition);
- Contract.Assume(errorMessage != null);
+ Assumes.True(errorMessage != null);
if (!condition) {
errorMessage = string.Format(CultureInfo.CurrentCulture, errorMessage, args);
throw new InfoCard.InformationCardException(errorMessage);
diff --git a/src/DotNetOpenAuth.InfoCard/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.InfoCard/Properties/AssemblyInfo.cs
index e9f2c20..1288eb4 100644
--- a/src/DotNetOpenAuth.InfoCard/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.InfoCard/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OAuth.Common/OAuth/ChannelElements/OAuthIdentity.cs b/src/DotNetOpenAuth.OAuth.Common/OAuth/ChannelElements/OAuthIdentity.cs
index 9494816..28e0333 100644
--- a/src/DotNetOpenAuth.OAuth.Common/OAuth/ChannelElements/OAuthIdentity.cs
+++ b/src/DotNetOpenAuth.OAuth.Common/OAuth/ChannelElements/OAuthIdentity.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Runtime.InteropServices;
using System.Security.Principal;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OAuth.Common/OAuth/ChannelElements/OAuthPrincipal.cs b/src/DotNetOpenAuth.OAuth.Common/OAuth/ChannelElements/OAuthPrincipal.cs
index c23939a..65d7042 100644
--- a/src/DotNetOpenAuth.OAuth.Common/OAuth/ChannelElements/OAuthPrincipal.cs
+++ b/src/DotNetOpenAuth.OAuth.Common/OAuth/ChannelElements/OAuthPrincipal.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Principal;
diff --git a/src/DotNetOpenAuth.OAuth.Common/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OAuth.Common/Properties/AssemblyInfo.cs
index 759bd3f..a3afcd7 100644
--- a/src/DotNetOpenAuth.OAuth.Common/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OAuth.Common/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -30,7 +29,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("F9AFC069-8291-497F-B2A1-3E4D1646C572")]
-[assembly: ContractVerification(true)]
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs
index aad0834..89ce187 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerChannel.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerMessageFactory.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerMessageFactory.cs
index f9cf1fe..e79749f 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerMessageFactory.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/OAuthConsumerMessageFactory.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth.Messages;
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs
index 2133084..d492e33 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ChannelElements/RsaSha1ConsumerSigningBindingElement.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ConsumerBase.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ConsumerBase.cs
index 9d17113..0d2da87 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ConsumerBase.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/ConsumerBase.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Net;
using DotNetOpenAuth.Configuration;
@@ -279,7 +278,6 @@ namespace DotNetOpenAuth.OAuth {
/// </returns>
protected AuthorizedTokenResponse ProcessUserAuthorization(string requestToken, string verifier) {
Requires.NotNullOrEmpty(requestToken, "requestToken");
- Contract.Ensures(Contract.Result<AuthorizedTokenResponse>() != null);
var requestAccess = new AuthorizedTokenRequest(this.ServiceProvider.AccessTokenEndpoint, this.ServiceProvider.Version) {
RequestToken = requestToken,
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/WebConsumer.cs b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/WebConsumer.cs
index 2cfce5b..4d4e67c 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/OAuth/WebConsumer.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/OAuth/WebConsumer.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Web;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth.ChannelElements;
diff --git a/src/DotNetOpenAuth.OAuth.Consumer/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OAuth.Consumer/Properties/AssemblyInfo.cs
index 6c9e910..95b169d 100644
--- a/src/DotNetOpenAuth.OAuth.Consumer/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OAuth.Consumer/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/IServiceProviderTokenManager.cs b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/IServiceProviderTokenManager.cs
index 7815796..1c413a3 100644
--- a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/IServiceProviderTokenManager.cs
+++ b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/IServiceProviderTokenManager.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using Validation;
@@ -16,7 +15,6 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// A token manager for use by a web site in its role as a
/// service provider.
/// </summary>
- [ContractClass(typeof(IServiceProviderTokenManagerContract))]
public interface IServiceProviderTokenManager : ITokenManager {
/// <summary>
/// Gets the Consumer description for a given a Consumer Key.
@@ -80,173 +78,4 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// </remarks>
void UpdateToken(IServiceProviderRequestToken token);
}
-
- /// <summary>
- /// Code contract class for the <see cref="IServiceProviderTokenManager"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IServiceProviderTokenManager))]
- internal abstract class IServiceProviderTokenManagerContract : IServiceProviderTokenManager {
- /// <summary>
- /// Prevents a default instance of the <see cref="IServiceProviderTokenManagerContract"/> class from being created.
- /// </summary>
- private IServiceProviderTokenManagerContract() {
- }
-
- #region IServiceProviderTokenManager Members
-
- /// <summary>
- /// Gets the Consumer description for a given a Consumer Key.
- /// </summary>
- /// <param name="consumerKey">The Consumer Key.</param>
- /// <returns>
- /// A description of the consumer. Never null.
- /// </returns>
- /// <exception cref="KeyNotFoundException">Thrown if the consumer key cannot be found.</exception>
- IConsumerDescription IServiceProviderTokenManager.GetConsumer(string consumerKey) {
- Requires.NotNullOrEmpty(consumerKey, "consumerKey");
- Contract.Ensures(Contract.Result<IConsumerDescription>() != null);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Checks whether a given request token has already been authorized
- /// by some user for use by the Consumer that requested it.
- /// </summary>
- /// <param name="requestToken">The Consumer's request token.</param>
- /// <returns>
- /// True if the request token has already been fully authorized by the user
- /// who owns the relevant protected resources. False if the token has not yet
- /// been authorized, has expired or does not exist.
- /// </returns>
- bool IServiceProviderTokenManager.IsRequestTokenAuthorized(string requestToken) {
- Requires.NotNullOrEmpty(requestToken, "requestToken");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets details on the named request token.
- /// </summary>
- /// <param name="token">The request token.</param>
- /// <returns>A description of the token. Never null.</returns>
- /// <exception cref="KeyNotFoundException">Thrown if the token cannot be found.</exception>
- /// <remarks>
- /// It is acceptable for implementations to find the token, see that it has expired,
- /// delete it from the database and then throw <see cref="KeyNotFoundException"/>,
- /// or alternatively it can return the expired token anyway and the OAuth channel will
- /// log and throw the appropriate error.
- /// </remarks>
- IServiceProviderRequestToken IServiceProviderTokenManager.GetRequestToken(string token) {
- Requires.NotNullOrEmpty(token, "token");
- Contract.Ensures(Contract.Result<IServiceProviderRequestToken>() != null);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets details on the named access token.
- /// </summary>
- /// <param name="token">The access token.</param>
- /// <returns>A description of the token. Never null.</returns>
- /// <exception cref="KeyNotFoundException">Thrown if the token cannot be found.</exception>
- /// <remarks>
- /// It is acceptable for implementations to find the token, see that it has expired,
- /// delete it from the database and then throw <see cref="KeyNotFoundException"/>,
- /// or alternatively it can return the expired token anyway and the OAuth channel will
- /// log and throw the appropriate error.
- /// </remarks>
- IServiceProviderAccessToken IServiceProviderTokenManager.GetAccessToken(string token) {
- Requires.NotNullOrEmpty(token, "token");
- Contract.Ensures(Contract.Result<IServiceProviderAccessToken>() != null);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Persists any changes made to the token.
- /// </summary>
- /// <param name="token">The token whose properties have been changed.</param>
- /// <remarks>
- /// This library will invoke this method after making a set
- /// of changes to the token as part of a web request to give the host
- /// the opportunity to persist those changes to a database.
- /// Depending on the object persistence framework the host site uses,
- /// this method MAY not need to do anything (if changes made to the token
- /// will automatically be saved without any extra handling).
- /// </remarks>
- void IServiceProviderTokenManager.UpdateToken(IServiceProviderRequestToken token) {
- Requires.NotNull(token, "token");
- throw new NotImplementedException();
- }
-
- #endregion
-
- #region ITokenManager Members
-
- /// <summary>
- /// Gets the Token Secret given a request or access token.
- /// </summary>
- /// <param name="token">The request or access token.</param>
- /// <returns>
- /// The secret associated with the given token.
- /// </returns>
- /// <exception cref="ArgumentException">Thrown if the secret cannot be found for the given token.</exception>
- string ITokenManager.GetTokenSecret(string token) {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Stores a newly generated unauthorized request token, secret, and optional
- /// application-specific parameters for later recall.
- /// </summary>
- /// <param name="request">The request message that resulted in the generation of a new unauthorized request token.</param>
- /// <param name="response">The response message that includes the unauthorized request token.</param>
- /// <exception cref="ArgumentException">Thrown if the consumer key is not registered, or a required parameter was not found in the parameters collection.</exception>
- /// <remarks>
- /// Request tokens stored by this method SHOULD NOT associate any user account with this token.
- /// It usually opens up security holes in your application to do so. Instead, you associate a user
- /// account with access tokens (not request tokens) in the <see cref="ITokenManager.ExpireRequestTokenAndStoreNewAccessToken"/>
- /// method.
- /// </remarks>
- void ITokenManager.StoreNewRequestToken(DotNetOpenAuth.OAuth.Messages.UnauthorizedTokenRequest request, DotNetOpenAuth.OAuth.Messages.ITokenSecretContainingMessage response) {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Deletes a request token and its associated secret and stores a new access token and secret.
- /// </summary>
- /// <param name="consumerKey">The Consumer that is exchanging its request token for an access token.</param>
- /// <param name="requestToken">The Consumer's request token that should be deleted/expired.</param>
- /// <param name="accessToken">The new access token that is being issued to the Consumer.</param>
- /// <param name="accessTokenSecret">The secret associated with the newly issued access token.</param>
- /// <remarks>
- /// <para>
- /// Any scope of granted privileges associated with the request token from the
- /// original call to <see cref="ITokenManager.StoreNewRequestToken"/> should be carried over
- /// to the new Access Token.
- /// </para>
- /// <para>
- /// To associate a user account with the new access token,
- /// <see cref="System.Web.HttpContext.User">HttpContext.Current.User</see> may be
- /// useful in an ASP.NET web application within the implementation of this method.
- /// Alternatively you may store the access token here without associating with a user account,
- /// and wait until WebConsumer.ProcessUserAuthorization or
- /// DesktopConsumer.ProcessUserAuthorization return the access
- /// token to associate the access token with a user account at that point.
- /// </para>
- /// </remarks>
- void ITokenManager.ExpireRequestTokenAndStoreNewAccessToken(string consumerKey, string requestToken, string accessToken, string accessTokenSecret) {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Classifies a token as a request token or an access token.
- /// </summary>
- /// <param name="token">The token to classify.</param>
- /// <returns>
- /// Request or Access token, or invalid if the token is not recognized.
- /// </returns>
- TokenType ITokenManager.GetTokenType(string token) {
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderChannel.cs b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderChannel.cs
index f52f3f5..62019d8 100644
--- a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderChannel.cs
+++ b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderChannel.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -60,7 +59,7 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// An array of binding elements used to initialize the channel.
/// </returns>
private static IChannelBindingElement[] InitializeBindingElements(ITamperProtectionChannelBindingElement signingBindingElement, INonceStore store, ITokenManager tokenManager, SecuritySettings securitySettings) {
- Contract.Requires(securitySettings != null);
+ Requires.NotNull(securitySettings, "securitySettings");
var bindingElements = OAuthChannel.InitializeBindingElements(signingBindingElement, store);
diff --git a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderMessageFactory.cs b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderMessageFactory.cs
index 57360b0..38a1f56 100644
--- a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderMessageFactory.cs
+++ b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/OAuthServiceProviderMessageFactory.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth.Messages;
using Validation;
diff --git a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/RsaSha1ServiceProviderSigningBindingElement.cs b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/RsaSha1ServiceProviderSigningBindingElement.cs
index 978d6b6..fd0d3ad 100644
--- a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/RsaSha1ServiceProviderSigningBindingElement.cs
+++ b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/RsaSha1ServiceProviderSigningBindingElement.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
diff --git a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/TokenHandlingBindingElement.cs b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/TokenHandlingBindingElement.cs
index 2f60535..22c254f 100644
--- a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/TokenHandlingBindingElement.cs
+++ b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ChannelElements/TokenHandlingBindingElement.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Configuration;
diff --git a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ServiceProvider.cs b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ServiceProvider.cs
index b7c31a7..d2152ea 100644
--- a/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ServiceProvider.cs
+++ b/src/DotNetOpenAuth.OAuth.ServiceProvider/OAuth/ServiceProvider.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.OAuth {
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Security.Principal;
using System.ServiceModel.Channels;
@@ -110,8 +109,6 @@ namespace DotNetOpenAuth.OAuth {
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static INonceStore HttpApplicationStore {
get {
- Contract.Ensures(Contract.Result<INonceStore>() != null);
-
HttpContext context = HttpContext.Current;
ErrorUtilities.VerifyOperation(context != null, Strings.StoreRequiredWhenNoHttpContextAvailable, typeof(INonceStore).Name);
var store = (INonceStore)context.Application[ApplicationStoreKey];
diff --git a/src/DotNetOpenAuth.OAuth.ServiceProvider/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OAuth.ServiceProvider/Properties/AssemblyInfo.cs
index aa99a01..63af312 100644
--- a/src/DotNetOpenAuth.OAuth.ServiceProvider/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OAuth.ServiceProvider/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OAuth/Configuration/OAuthElement.cs b/src/DotNetOpenAuth.OAuth/Configuration/OAuthElement.cs
index 3972e6f..8b34e49 100644
--- a/src/DotNetOpenAuth.OAuth/Configuration/OAuthElement.cs
+++ b/src/DotNetOpenAuth.OAuth/Configuration/OAuthElement.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Configuration {
using System.Configuration;
- using System.Diagnostics.Contracts;
/// <summary>
/// Represents the &lt;oauth&gt; element in the host's .config file.
@@ -38,7 +37,6 @@ namespace DotNetOpenAuth.Configuration {
/// </summary>
public static OAuthElement Configuration {
get {
- Contract.Ensures(Contract.Result<OAuthElement>() != null);
return (OAuthElement)ConfigurationManager.GetSection(SectionName) ?? new OAuthElement();
}
}
diff --git a/src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj b/src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj
index 153fd88..d9d61ff 100644
--- a/src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj
+++ b/src/DotNetOpenAuth.OAuth/DotNetOpenAuth.OAuth.csproj
@@ -29,7 +29,6 @@
<Compile Include="OAuth\ChannelElements\OAuthHttpMethodBindingElement.cs" />
<Compile Include="OAuth\ChannelElements\PlaintextSigningBindingElement.cs" />
<Compile Include="OAuth\ChannelElements\HmacSha1SigningBindingElement.cs" />
- <Compile Include="OAuth\ChannelElements\SigningBindingElementBaseContract.cs" />
<Compile Include="OAuth\ChannelElements\SigningBindingElementChain.cs" />
<Compile Include="OAuth\ChannelElements\TokenType.cs" />
<Compile Include="OAuth\ChannelElements\UriOrOobEncoding.cs" />
diff --git a/src/DotNetOpenAuth.OAuth/Messaging/ITamperProtectionChannelBindingElement.cs b/src/DotNetOpenAuth.OAuth/Messaging/ITamperProtectionChannelBindingElement.cs
index 66b82d4..1251472 100644
--- a/src/DotNetOpenAuth.OAuth/Messaging/ITamperProtectionChannelBindingElement.cs
+++ b/src/DotNetOpenAuth.OAuth/Messaging/ITamperProtectionChannelBindingElement.cs
@@ -6,14 +6,12 @@
namespace DotNetOpenAuth.Messaging {
using System;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.OAuth.ChannelElements;
/// <summary>
/// An interface that must be implemented by message transforms/validators in order
/// to be included in the channel stack.
/// </summary>
- [ContractClass(typeof(ITamperProtectionChannelBindingElementContract))]
public interface ITamperProtectionChannelBindingElement : IChannelBindingElement {
/// <summary>
/// Gets or sets the delegate that will initialize the non-serialized properties necessary on a
@@ -27,98 +25,4 @@ namespace DotNetOpenAuth.Messaging {
/// <returns>The cloned instance.</returns>
ITamperProtectionChannelBindingElement Clone();
}
-
- /// <summary>
- /// Contract class for the <see cref="ITamperProtectionChannelBindingElement"/> interface.
- /// </summary>
- [ContractClassFor(typeof(ITamperProtectionChannelBindingElement))]
- internal abstract class ITamperProtectionChannelBindingElementContract : ITamperProtectionChannelBindingElement {
- #region ITamperProtectionChannelBindingElement Properties
-
- /// <summary>
- /// Gets or sets the delegate that will initialize the non-serialized properties necessary on a
- /// signable message so that its signature can be correctly calculated or verified.
- /// </summary>
- Action<ITamperResistantOAuthMessage> ITamperProtectionChannelBindingElement.SignatureCallback {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- #endregion
-
- #region IChannelBindingElement Members
-
- /// <summary>
- /// Gets or sets the channel that this binding element belongs to.
- /// </summary>
- /// <remarks>
- /// This property is set by the channel when it is first constructed.
- /// </remarks>
- Channel IChannelBindingElement.Channel {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the protection commonly offered (if any) by this binding element.
- /// </summary>
- /// <remarks>
- /// This value is used to assist in sorting binding elements in the channel stack.
- /// </remarks>
- MessageProtections IChannelBindingElement.Protection {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Prepares a message for sending based on the rules of this channel binding element.
- /// </summary>
- /// <param name="message">The message to prepare for sending.</param>
- /// <returns>
- /// The protections (if any) that this binding element applied to the message.
- /// Null if this binding element did not even apply to this binding element.
- /// </returns>
- /// <remarks>
- /// Implementations that provide message protection must honor the
- /// <see cref="MessagePartAttribute.RequiredProtection"/> properties where applicable.
- /// </remarks>
- MessageProtections? IChannelBindingElement.ProcessOutgoingMessage(IProtocolMessage message) {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Performs any transformation on an incoming message that may be necessary and/or
- /// validates an incoming message based on the rules of this channel binding element.
- /// </summary>
- /// <param name="message">The incoming message to process.</param>
- /// <returns>
- /// The protections (if any) that this binding element applied to the message.
- /// Null if this binding element did not even apply to this binding element.
- /// </returns>
- /// <exception cref="ProtocolException">
- /// Thrown when the binding element rules indicate that this message is invalid and should
- /// NOT be processed.
- /// </exception>
- /// <remarks>
- /// Implementations that provide message protection must honor the
- /// <see cref="MessagePartAttribute.RequiredProtection"/> properties where applicable.
- /// </remarks>
- MessageProtections? IChannelBindingElement.ProcessIncomingMessage(IProtocolMessage message) {
- throw new NotImplementedException();
- }
-
- #endregion
-
- #region ITamperProtectionChannelBindingElement Methods
-
- /// <summary>
- /// Clones this instance.
- /// </summary>
- /// <returns>The cloned instance.</returns>
- ITamperProtectionChannelBindingElement ITamperProtectionChannelBindingElement.Clone() {
- Contract.Ensures(Contract.Result<ITamperProtectionChannelBindingElement>() != null);
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/HmacSha1SigningBindingElement.cs b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/HmacSha1SigningBindingElement.cs
index ee05614..60fbdb9 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/HmacSha1SigningBindingElement.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/HmacSha1SigningBindingElement.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/ITokenManager.cs b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/ITokenManager.cs
index 18fa3c6..3749920 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/ITokenManager.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/ITokenManager.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.OAuth.Messages;
@@ -18,7 +17,6 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// and recall of tokens and secrets for an individual OAuth consumer
/// or service provider.
/// </summary>
- [ContractClass(typeof(ITokenManagerContract))]
public interface ITokenManager {
/// <summary>
/// Gets the Token Secret given a request or access token.
@@ -75,96 +73,4 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// <returns>Request or Access token, or invalid if the token is not recognized.</returns>
TokenType GetTokenType(string token);
}
-
- /// <summary>
- /// The code contract class for the <see cref="ITokenManager"/> interface.
- /// </summary>
- [ContractClassFor(typeof(ITokenManager))]
- internal abstract class ITokenManagerContract : ITokenManager {
- /// <summary>
- /// Prevents a default instance of the <see cref="ITokenManagerContract"/> class from being created.
- /// </summary>
- private ITokenManagerContract() {
- }
-
- #region ITokenManager Members
-
- /// <summary>
- /// Gets the Token Secret given a request or access token.
- /// </summary>
- /// <param name="token">The request or access token.</param>
- /// <returns>
- /// The secret associated with the given token.
- /// </returns>
- /// <exception cref="ArgumentException">Thrown if the secret cannot be found for the given token.</exception>
- string ITokenManager.GetTokenSecret(string token) {
- Requires.NotNullOrEmpty(token, "token");
- Contract.Ensures(Contract.Result<string>() != null);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Stores a newly generated unauthorized request token, secret, and optional
- /// application-specific parameters for later recall.
- /// </summary>
- /// <param name="request">The request message that resulted in the generation of a new unauthorized request token.</param>
- /// <param name="response">The response message that includes the unauthorized request token.</param>
- /// <exception cref="ArgumentException">Thrown if the consumer key is not registered, or a required parameter was not found in the parameters collection.</exception>
- /// <remarks>
- /// Request tokens stored by this method SHOULD NOT associate any user account with this token.
- /// It usually opens up security holes in your application to do so. Instead, you associate a user
- /// account with access tokens (not request tokens) in the <see cref="ITokenManager.ExpireRequestTokenAndStoreNewAccessToken"/>
- /// method.
- /// </remarks>
- void ITokenManager.StoreNewRequestToken(UnauthorizedTokenRequest request, ITokenSecretContainingMessage response) {
- Requires.NotNull(request, "request");
- Requires.NotNull(response, "response");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Deletes a request token and its associated secret and stores a new access token and secret.
- /// </summary>
- /// <param name="consumerKey">The Consumer that is exchanging its request token for an access token.</param>
- /// <param name="requestToken">The Consumer's request token that should be deleted/expired.</param>
- /// <param name="accessToken">The new access token that is being issued to the Consumer.</param>
- /// <param name="accessTokenSecret">The secret associated with the newly issued access token.</param>
- /// <remarks>
- /// <para>
- /// Any scope of granted privileges associated with the request token from the
- /// original call to <see cref="ITokenManager.StoreNewRequestToken"/> should be carried over
- /// to the new Access Token.
- /// </para>
- /// <para>
- /// To associate a user account with the new access token,
- /// <see cref="System.Web.HttpContext.User">HttpContext.Current.User</see> may be
- /// useful in an ASP.NET web application within the implementation of this method.
- /// Alternatively you may store the access token here without associating with a user account,
- /// and wait until WebConsumer.ProcessUserAuthorization or
- /// DesktopConsumer.ProcessUserAuthorization return the access
- /// token to associate the access token with a user account at that point.
- /// </para>
- /// </remarks>
- void ITokenManager.ExpireRequestTokenAndStoreNewAccessToken(string consumerKey, string requestToken, string accessToken, string accessTokenSecret) {
- Requires.NotNullOrEmpty(consumerKey, "consumerKey");
- Requires.NotNullOrEmpty(requestToken, "requestToken");
- Requires.NotNullOrEmpty(accessToken, "accessToken");
- Requires.NotNull(accessTokenSecret, "accessTokenSecret");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Classifies a token as a request token or an access token.
- /// </summary>
- /// <param name="token">The token to classify.</param>
- /// <returns>
- /// Request or Access token, or invalid if the token is not recognized.
- /// </returns>
- TokenType ITokenManager.GetTokenType(string token) {
- Requires.NotNullOrEmpty(token, "token");
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs
index 3d61f66..1362ca9 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/OAuthChannel.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Linq;
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/RsaSha1SigningBindingElement.cs b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/RsaSha1SigningBindingElement.cs
index 01a5c53..55ce981 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/RsaSha1SigningBindingElement.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/RsaSha1SigningBindingElement.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
- using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBase.cs b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBase.cs
index cc9bc68..780afdc 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBase.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBase.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Text;
@@ -22,7 +21,6 @@ namespace DotNetOpenAuth.OAuth.ChannelElements {
/// <summary>
/// A binding element that signs outgoing messages and verifies the signature on incoming messages.
/// </summary>
- [ContractClass(typeof(SigningBindingElementBaseContract))]
public abstract class SigningBindingElementBase : ITamperProtectionChannelBindingElement {
/// <summary>
/// The signature method this binding element uses.
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBaseContract.cs b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBaseContract.cs
deleted file mode 100644
index 3648750..0000000
--- a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementBaseContract.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="SigningBindingElementBaseContract.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.OAuth.ChannelElements {
- using System;
- using System.Diagnostics.Contracts;
- using DotNetOpenAuth.Messaging;
- using Validation;
-
- /// <summary>
- /// Code Contract for the <see cref="SigningBindingElementBase"/> class.
- /// </summary>
- [ContractClassFor(typeof(SigningBindingElementBase))]
- internal abstract class SigningBindingElementBaseContract : SigningBindingElementBase {
- /// <summary>
- /// Prevents a default instance of the SigningBindingElementBaseContract class from being created.
- /// </summary>
- private SigningBindingElementBaseContract()
- : base(string.Empty) {
- }
-
- /// <summary>
- /// Clones this instance.
- /// </summary>
- /// <returns>A new instance of the binding element.</returns>
- /// <remarks>
- /// Implementations of this method need not clone the SignatureVerificationCallback member, as the
- /// <see cref="SigningBindingElementBase"/> class does this.
- /// </remarks>
- protected override ITamperProtectionChannelBindingElement Clone() {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Calculates a signature for a given message.
- /// </summary>
- /// <param name="message">The message to sign.</param>
- /// <returns>The signature for the message.</returns>
- protected override string GetSignature(ITamperResistantOAuthMessage message) {
- Requires.NotNull(message, "message");
- RequiresEx.ValidState(this.Channel != null);
- throw new NotImplementedException();
- }
- }
-}
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementChain.cs b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementChain.cs
index 242c1ac..2b25566 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementChain.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/SigningBindingElementChain.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/UriOrOobEncoding.cs b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/UriOrOobEncoding.cs
index 639310d..60ec6c8 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/UriOrOobEncoding.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/ChannelElements/UriOrOobEncoding.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/Messages/MessageBase.cs b/src/DotNetOpenAuth.OAuth/OAuth/Messages/MessageBase.cs
index 43297cc..f2f087d 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/Messages/MessageBase.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/Messages/MessageBase.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/Messages/UnauthorizedTokenResponse.cs b/src/DotNetOpenAuth.OAuth/OAuth/Messages/UnauthorizedTokenResponse.cs
index 0ff12e5..9e879cd 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/Messages/UnauthorizedTokenResponse.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/Messages/UnauthorizedTokenResponse.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth.Messages {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using Validation;
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/Protocol.cs b/src/DotNetOpenAuth.OAuth/OAuth/Protocol.cs
index 9236681..72f0ff4 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/Protocol.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/Protocol.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.OAuth {
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OAuth/OAuth/ServiceProviderDescription.cs b/src/DotNetOpenAuth.OAuth/OAuth/ServiceProviderDescription.cs
index 3f553a9..6dbe6ea 100644
--- a/src/DotNetOpenAuth.OAuth/OAuth/ServiceProviderDescription.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuth/ServiceProviderDescription.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth {
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth.ChannelElements;
@@ -95,7 +94,7 @@ namespace DotNetOpenAuth.OAuth {
/// </summary>
/// <returns>The created signing element.</returns>
internal ITamperProtectionChannelBindingElement CreateTamperProtectionElement() {
- Contract.Requires(this.TamperProtectionElements != null);
+ RequiresEx.ValidState(this.TamperProtectionElements != null);
return new SigningBindingElementChain(this.TamperProtectionElements.Select(el => (ITamperProtectionChannelBindingElement)el.Clone()).ToArray());
}
}
diff --git a/src/DotNetOpenAuth.OAuth/OAuthReporting.cs b/src/DotNetOpenAuth.OAuth/OAuthReporting.cs
index 29a9adc..e2c0aab 100644
--- a/src/DotNetOpenAuth.OAuth/OAuthReporting.cs
+++ b/src/DotNetOpenAuth.OAuth/OAuthReporting.cs
@@ -7,12 +7,12 @@
namespace DotNetOpenAuth {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.OAuth;
using DotNetOpenAuth.OAuth.ChannelElements;
+ using Validation;
/// <summary>
/// Utility methods specific to OAuth feature reporting.
@@ -26,9 +26,9 @@ namespace DotNetOpenAuth {
/// <param name="tokenManager">The token manager.</param>
/// <param name="nonceStore">The nonce store.</param>
internal static void RecordFeatureAndDependencyUse(object value, ServiceProviderDescription service, ITokenManager tokenManager, INonceStore nonceStore) {
- Contract.Requires(value != null);
- Contract.Requires(service != null);
- Contract.Requires(tokenManager != null);
+ Requires.NotNull(value, "value");
+ Requires.NotNull(service, "service");
+ Requires.NotNull(tokenManager, "tokenManager");
// In release builds, just quietly return.
if (value == null || service == null || tokenManager == null) {
diff --git a/src/DotNetOpenAuth.OAuth/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OAuth/Properties/AssemblyInfo.cs
index 465f646..85b5275 100644
--- a/src/DotNetOpenAuth.OAuth/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OAuth/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -33,8 +32,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Configuration/OAuth2AuthorizationServerSection.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Configuration/OAuth2AuthorizationServerSection.cs
index 6511a11..a06555d 100644
--- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Configuration/OAuth2AuthorizationServerSection.cs
+++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Configuration/OAuth2AuthorizationServerSection.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Configuration {
using System;
using System.Configuration;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.OAuth2.ChannelElements;
@@ -42,7 +41,6 @@ namespace DotNetOpenAuth.Configuration {
/// </summary>
internal static OAuth2AuthorizationServerSection Configuration {
get {
- Contract.Ensures(Contract.Result<OAuth2AuthorizationServerSection>() != null);
return (OAuth2AuthorizationServerSection)ConfigurationManager.GetSection(SectionName) ?? new OAuth2AuthorizationServerSection();
}
}
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthServerUtilities.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthServerUtilities.cs
index 5fe16e9..b6aa75d 100644
--- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthServerUtilities.cs
+++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthServerUtilities.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Text;
@@ -28,7 +27,6 @@ namespace DotNetOpenAuth.OAuth2 {
/// <returns>The client information. Never null.</returns>
internal static IClientDescription GetClientOrThrow(this IAuthorizationServerHost authorizationServer, string clientIdentifier) {
Requires.NotNullOrEmpty(clientIdentifier, "clientIdentifier");
- Contract.Ensures(Contract.Result<IClientDescription>() != null);
try {
var result = authorizationServer.GetClient(clientIdentifier);
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs
index d20c450..5b47d0a 100644
--- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs
+++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServer.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
#if CLR4
using System.Net.Http;
@@ -195,7 +194,6 @@ namespace DotNetOpenAuth.OAuth2 {
/// <returns>The authorization response message to send to the Client.</returns>
public EndUserAuthorizationFailedResponse PrepareRejectAuthorizationRequest(EndUserAuthorizationRequest authorizationRequest, Uri callback = null) {
Requires.NotNull(authorizationRequest, "authorizationRequest");
- Contract.Ensures(Contract.Result<EndUserAuthorizationFailedResponse>() != null);
if (callback == null) {
callback = this.GetCallback(authorizationRequest);
@@ -216,7 +214,6 @@ namespace DotNetOpenAuth.OAuth2 {
public EndUserAuthorizationSuccessResponseBase PrepareApproveAuthorizationRequest(EndUserAuthorizationRequest authorizationRequest, string userName, IEnumerable<string> scopes = null, Uri callback = null) {
Requires.NotNull(authorizationRequest, "authorizationRequest");
Requires.NotNullOrEmpty(userName, "userName");
- Contract.Ensures(Contract.Result<EndUserAuthorizationSuccessResponseBase>() != null);
if (callback == null) {
callback = this.GetCallback(authorizationRequest);
@@ -292,7 +289,6 @@ namespace DotNetOpenAuth.OAuth2 {
/// <exception cref="ProtocolException">Thrown if no callback URL could be determined.</exception>
protected Uri GetCallback(EndUserAuthorizationRequest authorizationRequest) {
Requires.NotNull(authorizationRequest, "authorizationRequest");
- Contract.Ensures(Contract.Result<Uri>() != null);
var client = this.AuthorizationServerServices.GetClientOrThrow(authorizationRequest.ClientIdentifier);
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServerAccessToken.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServerAccessToken.cs
index a127166..7c9f808 100644
--- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServerAccessToken.cs
+++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/AuthorizationServerAccessToken.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/AuthorizationCode.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/AuthorizationCode.cs
index bdba287..75744d4 100644
--- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/AuthorizationCode.cs
+++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/AuthorizationCode.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -68,7 +67,6 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
/// <returns>A DataBag formatter.</returns>
internal static IDataBagFormatter<AuthorizationCode> CreateFormatter(IAuthorizationServerHost authorizationServer) {
Requires.NotNull(authorizationServer, "authorizationServer");
- Contract.Ensures(Contract.Result<IDataBagFormatter<AuthorizationCode>>() != null);
var cryptoStore = authorizationServer.CryptoKeyStore;
ErrorUtilities.VerifyHost(cryptoStore != null, OAuthStrings.ResultShouldNotBeNull, authorizationServer.GetType(), "CryptoKeyStore");
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs
index 28a00c5..6d4220b 100644
--- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs
+++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/MessageValidationBindingElement.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Text;
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs
index f611380..249f5e7 100644
--- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs
+++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/OAuth2AuthorizationServerChannel.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Net.Mime;
using System.Web;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/RefreshToken.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/RefreshToken.cs
index 7881832..eb40617 100644
--- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/RefreshToken.cs
+++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/ChannelElements/RefreshToken.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OAuth2.ChannelElements {
using System;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
using Validation;
@@ -49,7 +48,6 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
/// </returns>
internal static IDataBagFormatter<RefreshToken> CreateFormatter(ICryptoKeyStore cryptoKeyStore) {
Requires.NotNull(cryptoKeyStore, "cryptoKeyStore");
- Contract.Ensures(Contract.Result<IDataBagFormatter<RefreshToken>>() != null);
return new UriStyleMessageFormatter<RefreshToken>(cryptoKeyStore, RefreshTokenKeyBucket, signed: true, encrypted: true);
}
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/IAuthorizationServerHost.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/IAuthorizationServerHost.cs
index 549dd9f..6465307 100644
--- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/IAuthorizationServerHost.cs
+++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/OAuth2/IAuthorizationServerHost.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
@@ -20,7 +19,6 @@ namespace DotNetOpenAuth.OAuth2 {
/// <summary>
/// Provides host-specific authorization server services needed by this library.
/// </summary>
- [ContractClass(typeof(IAuthorizationServerHostContract))]
public interface IAuthorizationServerHost {
/// <summary>
/// Gets the store for storing crypto keys used to symmetrically encrypt and sign authorization codes and refresh tokens.
@@ -113,134 +111,4 @@ namespace DotNetOpenAuth.OAuth2 {
/// </exception>
AutomatedAuthorizationCheckResponse CheckAuthorizeClientCredentialsGrant(IAccessTokenRequest accessRequest);
}
-
- /// <summary>
- /// Code Contract for the <see cref="IAuthorizationServerHost" /> interface.
- /// </summary>
- [ContractClassFor(typeof(IAuthorizationServerHost))]
- internal abstract class IAuthorizationServerHostContract : IAuthorizationServerHost {
- /// <summary>
- /// Prevents a default instance of the <see cref="IAuthorizationServerHostContract"/> class from being created.
- /// </summary>
- private IAuthorizationServerHostContract() {
- }
-
- /// <summary>
- /// Gets the store for storeing crypto keys used to symmetrically encrypt and sign authorization codes and refresh tokens.
- /// </summary>
- ICryptoKeyStore IAuthorizationServerHost.CryptoKeyStore {
- get {
- Contract.Ensures(Contract.Result<ICryptoKeyStore>() != null);
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// Gets the authorization code nonce store to use to ensure that authorization codes can only be used once.
- /// </summary>
- /// <value>The authorization code nonce store.</value>
- INonceStore IAuthorizationServerHost.NonceStore {
- get {
- Contract.Ensures(Contract.Result<INonceStore>() != null);
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// Gets the client with a given identifier.
- /// </summary>
- /// <param name="clientIdentifier">The client identifier.</param>
- /// <returns>The client registration. Never null.</returns>
- /// <exception cref="ArgumentException">Thrown when no client with the given identifier is registered with this authorization server.</exception>
- IClientDescription IAuthorizationServerHost.GetClient(string clientIdentifier) {
- Requires.NotNullOrEmpty(clientIdentifier, "clientIdentifier");
- Contract.Ensures(Contract.Result<IClientDescription>() != null);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Determines whether a described authorization is (still) valid.
- /// </summary>
- /// <param name="authorization">The authorization.</param>
- /// <returns>
- /// <c>true</c> if the original authorization is still valid; otherwise, <c>false</c>.
- /// </returns>
- /// <remarks>
- /// <para>When establishing that an authorization is still valid,
- /// it's very important to only match on recorded authorizations that
- /// meet these criteria:</para>
- /// 1) The client identifier matches.
- /// 2) The user account matches.
- /// 3) The scope on the recorded authorization must include all scopes in the given authorization.
- /// 4) The date the recorded authorization was issued must be <em>no later</em> that the date the given authorization was issued.
- /// <para>One possible scenario is where the user authorized a client, later revoked authorization,
- /// and even later reinstated authorization. This subsequent recorded authorization
- /// would not satisfy requirement #4 in the above list. This is important because the revocation
- /// the user went through should invalidate all previously issued tokens as a matter of
- /// security in the event the user was revoking access in order to sever authorization on a stolen
- /// account or piece of hardware in which the tokens were stored. </para>
- /// </remarks>
- bool IAuthorizationServerHost.IsAuthorizationValid(IAuthorizationDescription authorization) {
- Requires.NotNull(authorization, "authorization");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Determines whether a given set of resource owner credentials is valid based on the authorization server's user database
- /// and if so records an authorization entry such that subsequent calls to <see cref="IAuthorizationServerHost.IsAuthorizationValid"/> would
- /// return <c>true</c>.
- /// </summary>
- /// <param name="userName">Username on the account.</param>
- /// <param name="password">The user's password.</param>
- /// <param name="accessRequest">
- /// The access request the credentials came with.
- /// This may be useful if the authorization server wishes to apply some policy based on the client that is making the request.
- /// </param>
- /// <returns>
- /// A value that describes the result of the authorization check.
- /// </returns>
- /// <exception cref="NotSupportedException">
- /// May be thrown if the authorization server does not support the resource owner password credential grant type.
- /// </exception>
- AutomatedUserAuthorizationCheckResponse IAuthorizationServerHost.CheckAuthorizeResourceOwnerCredentialGrant(string userName, string password, IAccessTokenRequest accessRequest) {
- Contract.Requires(!string.IsNullOrEmpty(userName));
- Contract.Requires(password != null);
- Contract.Requires(accessRequest != null);
- Contract.Ensures(Contract.Result<AutomatedUserAuthorizationCheckResponse>() != null);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Determines whether an access token request given a client credential grant should be authorized
- /// and if so records an authorization entry such that subsequent calls to <see cref="IAuthorizationServerHost.IsAuthorizationValid" /> would
- /// return <c>true</c>.
- /// </summary>
- /// <param name="accessRequest">The access request the credentials came with.
- /// This may be useful if the authorization server wishes to apply some policy based on the client that is making the request.</param>
- /// <returns>
- /// A value that describes the result of the authorization check.
- /// </returns>
- /// <exception cref="NotSupportedException">May be thrown if the authorization server does not support the client credential grant type.</exception>
- AutomatedAuthorizationCheckResponse IAuthorizationServerHost.CheckAuthorizeClientCredentialsGrant(IAccessTokenRequest accessRequest) {
- Contract.Requires(accessRequest != null);
- Contract.Ensures(Contract.Result<AutomatedAuthorizationCheckResponse>() != null);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Obtains parameters to go into the formulation of an access token.
- /// </summary>
- /// <param name="accessTokenRequestMessage">Details regarding the resources that the access token will grant access to, and the identity of the client
- /// that will receive that access.
- /// Based on this information the receiving resource server can be determined and the lifetime of the access
- /// token can be set based on the sensitivity of the resources.</param>
- /// <returns>
- /// A non-null parameters instance that DotNetOpenAuth will dispose after it has been used.
- /// </returns>
- AccessTokenResult IAuthorizationServerHost.CreateAccessToken(IAccessTokenRequest accessTokenRequestMessage) {
- Contract.Requires(accessTokenRequestMessage != null);
- Contract.Ensures(Contract.Result<AccessTokenResult>() != null);
- throw new NotImplementedException();
- }
- }
}
diff --git a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Properties/AssemblyInfo.cs
index 397b35d..29900ab 100644
--- a/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OAuth2.AuthorizationServer/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OAuth2.Client.UI/OAuth2/ClientAuthorizationView.cs b/src/DotNetOpenAuth.OAuth2.Client.UI/OAuth2/ClientAuthorizationView.cs
index a0204fa..2c90c99 100644
--- a/src/DotNetOpenAuth.OAuth2.Client.UI/OAuth2/ClientAuthorizationView.cs
+++ b/src/DotNetOpenAuth.OAuth2.Client.UI/OAuth2/ClientAuthorizationView.cs
@@ -10,7 +10,6 @@ namespace DotNetOpenAuth.OAuth2 {
using System.ComponentModel;
using System.Data;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Drawing;
using System.Linq;
using System.Text;
diff --git a/src/DotNetOpenAuth.OAuth2.Client.UI/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OAuth2.Client.UI/Properties/AssemblyInfo.cs
index 397b35d..29900ab 100644
--- a/src/DotNetOpenAuth.OAuth2.Client.UI/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OAuth2.Client.UI/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OAuth2.Client/Configuration/OAuth2ClientSection.cs b/src/DotNetOpenAuth.OAuth2.Client/Configuration/OAuth2ClientSection.cs
index 5c040e3..d0c27c9 100644
--- a/src/DotNetOpenAuth.OAuth2.Client/Configuration/OAuth2ClientSection.cs
+++ b/src/DotNetOpenAuth.OAuth2.Client/Configuration/OAuth2ClientSection.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Configuration {
using System;
using System.Configuration;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
@@ -35,7 +34,6 @@ namespace DotNetOpenAuth.Configuration {
/// </summary>
internal static OAuth2ClientSection Configuration {
get {
- Contract.Ensures(Contract.Result<OAuth2ClientSection>() != null);
return (OAuth2ClientSection)ConfigurationManager.GetSection(SectionName) ?? new OAuth2ClientSection();
}
}
@@ -47,9 +45,8 @@ namespace DotNetOpenAuth.Configuration {
[PositiveTimeSpanValidator]
internal TimeSpan MaxAuthorizationTime {
get {
- Contract.Ensures(Contract.Result<TimeSpan>() > TimeSpan.Zero);
TimeSpan result = (TimeSpan)this[MaxAuthorizationTimePropertyName];
- Contract.Assume(result > TimeSpan.Zero); // our PositiveTimeSpanValidator should take care of this
+ Assumes.True(result > TimeSpan.Zero); // our PositiveTimeSpanValidator should take care of this
return result;
}
diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ChannelElements/OAuth2ClientChannel.cs b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ChannelElements/OAuth2ClientChannel.cs
index b0cdb4b..cf57618 100644
--- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ChannelElements/OAuth2ClientChannel.cs
+++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ChannelElements/OAuth2ClientChannel.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
- using System.Diagnostics.Contracts;
using System.Net;
using System.Web;
using System.Xml;
diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ClientBase.cs b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ClientBase.cs
index a21c597..b2178e9 100644
--- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ClientBase.cs
+++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/ClientBase.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Net;
@@ -224,7 +223,6 @@ namespace DotNetOpenAuth.OAuth2 {
public IAuthorizationState GetScopedAccessToken(string refreshToken, HashSet<string> scope) {
Requires.NotNullOrEmpty(refreshToken, "refreshToken");
Requires.NotNull(scope, "scope");
- Contract.Ensures(Contract.Result<IAuthorizationState>() != null);
var request = new AccessTokenRefreshRequestC(this.AuthorizationServer) {
ClientIdentifier = this.ClientIdentifier,
diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/IClientAuthorizationTracker.cs b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/IClientAuthorizationTracker.cs
index bf16aff..d42248a 100644
--- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/IClientAuthorizationTracker.cs
+++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/IClientAuthorizationTracker.cs
@@ -6,13 +6,11 @@
namespace DotNetOpenAuth.OAuth2 {
using System;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
/// A token manager implemented by some clients to assist in tracking authorization state.
/// </summary>
- [ContractClass(typeof(IClientAuthorizationTrackerContract))]
public interface IClientAuthorizationTracker {
/// <summary>
/// Gets the state of the authorization for a given callback URL and client state.
@@ -22,33 +20,4 @@ namespace DotNetOpenAuth.OAuth2 {
/// <returns>The authorization state; may be <c>null</c> if no authorization state matches.</returns>
IAuthorizationState GetAuthorizationState(Uri callbackUrl, string clientState);
}
-
- /// <summary>
- /// Contract class for the <see cref="IClientAuthorizationTracker"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IClientAuthorizationTracker))]
- internal abstract class IClientAuthorizationTrackerContract : IClientAuthorizationTracker {
- /// <summary>
- /// Prevents a default instance of the <see cref="IClientAuthorizationTrackerContract"/> class from being created.
- /// </summary>
- private IClientAuthorizationTrackerContract() {
- }
-
- #region IClientTokenManager Members
-
- /// <summary>
- /// Gets the state of the authorization for a given callback URL and client state.
- /// </summary>
- /// <param name="callbackUrl">The callback URL.</param>
- /// <param name="clientState">State of the client stored at the beginning of an authorization request.</param>
- /// <returns>
- /// The authorization state; may be <c>null</c> if no authorization state matches.
- /// </returns>
- IAuthorizationState IClientAuthorizationTracker.GetAuthorizationState(Uri callbackUrl, string clientState) {
- Requires.NotNull(callbackUrl, "callbackUrl");
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/UserAgentClient.cs b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/UserAgentClient.cs
index 3a9529c..dcb3826 100644
--- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/UserAgentClient.cs
+++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/UserAgentClient.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Web;
diff --git a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs
index 491048a..63d96e1 100644
--- a/src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs
+++ b/src/DotNetOpenAuth.OAuth2.Client/OAuth2/WebServerClient.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Net;
@@ -92,7 +91,6 @@ namespace DotNetOpenAuth.OAuth2 {
Requires.NotNull(authorization, "authorization");
RequiresEx.ValidState(authorization.Callback != null || (HttpContext.Current != null && HttpContext.Current.Request != null), MessagingStrings.HttpContextRequired);
RequiresEx.ValidState(!string.IsNullOrEmpty(this.ClientIdentifier), Strings.RequiredPropertyNotYetPreset, "ClientIdentifier");
- Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null);
if (authorization.Callback == null) {
authorization.Callback = this.Channel.GetRequestFromContext().GetPublicFacingUrl()
diff --git a/src/DotNetOpenAuth.OAuth2.Client/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OAuth2.Client/Properties/AssemblyInfo.cs
index 397b35d..29900ab 100644
--- a/src/DotNetOpenAuth.OAuth2.Client/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OAuth2.Client/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/IClientDescription.cs b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/IClientDescription.cs
index 4ea8f21..fe05f25 100644
--- a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/IClientDescription.cs
+++ b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/IClientDescription.cs
@@ -7,14 +7,12 @@
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using Validation;
/// <summary>
/// A description of a client from an Authorization Server's point of view.
/// </summary>
- [ContractClass(typeof(IClientDescriptionContract))]
public interface IClientDescription {
/// <summary>
/// Gets the callback to use when an individual authorization request
@@ -70,70 +68,4 @@ namespace DotNetOpenAuth.OAuth2 {
/// </remarks>
bool IsValidClientSecret(string secret);
}
-
- /// <summary>
- /// Contract class for the <see cref="IClientDescription"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IClientDescription))]
- internal abstract class IClientDescriptionContract : IClientDescription {
- #region IClientDescription Members
-
- /// <summary>
- /// Gets the type of the client.
- /// </summary>
- ClientType IClientDescription.ClientType {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the callback to use when an individual authorization request
- /// does not include an explicit callback URI.
- /// </summary>
- /// <value>
- /// An absolute URL; or <c>null</c> if none is registered.
- /// </value>
- Uri IClientDescription.DefaultCallback {
- get {
- Contract.Ensures(Contract.Result<Uri>() == null || Contract.Result<Uri>().IsAbsoluteUri);
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether a non-empty secret is registered for this client.
- /// </summary>
- bool IClientDescription.HasNonEmptySecret {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Determines whether a callback URI included in a client's authorization request
- /// is among those allowed callbacks for the registered client.
- /// </summary>
- /// <param name="callback">The requested callback URI.</param>
- /// <returns>
- /// <c>true</c> if the callback is allowed; otherwise, <c>false</c>.
- /// </returns>
- bool IClientDescription.IsCallbackAllowed(Uri callback) {
- Requires.NotNull(callback, "callback");
- Requires.That(callback.IsAbsoluteUri, "callback", "Absolute URI required.");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Checks whether the specified client secret is correct.
- /// </summary>
- /// <param name="secret">The secret obtained from the client.</param>
- /// <returns><c>true</c> if the secret matches the one in the authorization server's record for the client; <c>false</c> otherwise.</returns>
- /// <remarks>
- /// All string equality checks, whether checking secrets or their hashes,
- /// should be done using <see cref="MessagingUtilities.EqualsConstantTime"/> to mitigate timing attacks.
- /// </remarks>
- bool IClientDescription.IsValidClientSecret(string secret) {
- Requires.NotNullOrEmpty(secret, "secret");
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/AccessTokenAuthorizationCodeRequest.cs b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/AccessTokenAuthorizationCodeRequest.cs
index b8c9ede..bf06627 100644
--- a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/AccessTokenAuthorizationCodeRequest.cs
+++ b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/AccessTokenAuthorizationCodeRequest.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
diff --git a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationFailedResponse.cs b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationFailedResponse.cs
index 79a06d3..cb1c5d4 100644
--- a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationFailedResponse.cs
+++ b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationFailedResponse.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
diff --git a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationRequest.cs b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationRequest.cs
index 0048ad9..9da2c03 100644
--- a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationRequest.cs
+++ b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationRequest.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth2.Messages {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Configuration;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth2.ChannelElements;
diff --git a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessAccessTokenResponse.cs b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessAccessTokenResponse.cs
index 11d2443..a776459 100644
--- a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessAccessTokenResponse.cs
+++ b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessAccessTokenResponse.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
diff --git a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessAuthCodeResponse.cs b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessAuthCodeResponse.cs
index f49cb9f..9f7c4b1 100644
--- a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessAuthCodeResponse.cs
+++ b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessAuthCodeResponse.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OAuth2.Messages {
using System;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth2.ChannelElements;
diff --git a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessResponseBase.cs b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessResponseBase.cs
index f7f4b7a..bf385f9 100644
--- a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessResponseBase.cs
+++ b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/Messages/EndUserAuthorizationSuccessResponseBase.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth2.Messages {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/Properties/AssemblyInfo.cs
index 3d9e231..f4a2303 100644
--- a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OAuth2.ResourceServer/Configuration/OAuth2ResourceServerSection.cs b/src/DotNetOpenAuth.OAuth2.ResourceServer/Configuration/OAuth2ResourceServerSection.cs
index 3e37018..5f6cc3c 100644
--- a/src/DotNetOpenAuth.OAuth2.ResourceServer/Configuration/OAuth2ResourceServerSection.cs
+++ b/src/DotNetOpenAuth.OAuth2.ResourceServer/Configuration/OAuth2ResourceServerSection.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Configuration {
using System.Configuration;
- using System.Diagnostics.Contracts;
/// <summary>
/// Represents the &lt;oauth2/resourceServer&gt; section in the host's .config file.
@@ -28,7 +27,6 @@ namespace DotNetOpenAuth.Configuration {
/// </summary>
internal static OAuth2ResourceServerSection Configuration {
get {
- Contract.Ensures(Contract.Result<OAuth2ResourceServerSection>() != null);
return (OAuth2ResourceServerSection)ConfigurationManager.GetSection(SectionName) ?? new OAuth2ResourceServerSection();
}
}
diff --git a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs
index 8e5296c..8cf7eeb 100644
--- a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs
+++ b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ChannelElements/OAuth2ResourceServerChannel.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Net;
using System.Net.Mime;
diff --git a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/IAccessTokenAnalyzer.cs b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/IAccessTokenAnalyzer.cs
index 9ab37fc..a86b26d 100644
--- a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/IAccessTokenAnalyzer.cs
+++ b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/IAccessTokenAnalyzer.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -18,7 +17,6 @@ namespace DotNetOpenAuth.OAuth2 {
/// An interface that resource server hosts should implement if they accept access tokens
/// issued by non-DotNetOpenAuth authorization servers.
/// </summary>
- [ContractClass((typeof(IAccessTokenAnalyzerContract)))]
public interface IAccessTokenAnalyzer {
/// <summary>
/// Reads an access token to find out what data it authorizes access to.
@@ -29,30 +27,4 @@ namespace DotNetOpenAuth.OAuth2 {
/// <exception cref="ProtocolException">Thrown if the access token is expired, invalid, or from an untrusted authorization server.</exception>
AccessToken DeserializeAccessToken(IDirectedProtocolMessage message, string accessToken);
}
-
- /// <summary>
- /// Code contract for the <see cref="IAccessTokenAnalyzer"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IAccessTokenAnalyzer))]
- internal abstract class IAccessTokenAnalyzerContract : IAccessTokenAnalyzer {
- /// <summary>
- /// Prevents a default instance of the <see cref="IAccessTokenAnalyzerContract"/> class from being created.
- /// </summary>
- private IAccessTokenAnalyzerContract() {
- }
-
- /// <summary>
- /// Reads an access token to find out what data it authorizes access to.
- /// </summary>
- /// <param name="message">The message carrying the access token.</param>
- /// <param name="accessToken">The access token's serialized representation.</param>
- /// <returns>The deserialized, validated token.</returns>
- /// <exception cref="ProtocolException">Thrown if the access token is expired, invalid, or from an untrusted authorization server.</exception>
- AccessToken IAccessTokenAnalyzer.DeserializeAccessToken(IDirectedProtocolMessage message, string accessToken) {
- Requires.NotNull(message, "message");
- Requires.NotNullOrEmpty(accessToken, "accessToken");
- Contract.Ensures(Contract.Result<AccessToken>() != null);
- throw new NotImplementedException();
- }
- }
}
diff --git a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ResourceServer.cs b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ResourceServer.cs
index 2811615..540773f 100644
--- a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ResourceServer.cs
+++ b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/ResourceServer.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Net;
#if CLR4
diff --git a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs
index 0f02f8c..32f10ba 100644
--- a/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs
+++ b/src/DotNetOpenAuth.OAuth2.ResourceServer/OAuth2/StandardAccessTokenAnalyzer.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.IO;
using System.Security.Cryptography;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OAuth2.ResourceServer/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OAuth2.ResourceServer/Properties/AssemblyInfo.cs
index 397b35d..29900ab 100644
--- a/src/DotNetOpenAuth.OAuth2.ResourceServer/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OAuth2.ResourceServer/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2SectionGroup.cs b/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2SectionGroup.cs
index 112e756..09eef2c 100644
--- a/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2SectionGroup.cs
+++ b/src/DotNetOpenAuth.OAuth2/Configuration/OAuth2SectionGroup.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Configuration {
using System.Configuration;
- using System.Diagnostics.Contracts;
/// <summary>
/// Represents the &lt;oauth&gt; element in the host's .config file.
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs
index d5799e5..449b3ca 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/AccessToken.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
@@ -52,9 +51,8 @@ namespace DotNetOpenAuth.OAuth2 {
/// <param name="encryptingKey">The crypto service provider with the resource server's public key used to encrypt the access token.</param>
/// <returns>An access token serializer.</returns>
internal static IDataBagFormatter<AccessToken> CreateFormatter(RSACryptoServiceProvider signingKey, RSACryptoServiceProvider encryptingKey) {
- Contract.Requires(signingKey != null || !signingKey.PublicOnly);
- Contract.Requires(encryptingKey != null);
- Contract.Ensures(Contract.Result<IDataBagFormatter<AccessToken>>() != null);
+ Requires.That(signingKey == null || !signingKey.PublicOnly, "signingKey", "requires private key");
+ Requires.NotNull(encryptingKey, "encryptingKey");
return new UriStyleMessageFormatter<AccessToken>(signingKey, encryptingKey);
}
@@ -95,7 +93,6 @@ namespace DotNetOpenAuth.OAuth2 {
/// </summary>
/// <returns>A non-empty string.</returns>
protected internal virtual string Serialize() {
- Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>()));
throw new NotSupportedException();
}
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationDescription.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationDescription.cs
index 1ad0422..949fc94 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationDescription.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/ChannelElements/IAuthorizationDescription.cs
@@ -7,14 +7,12 @@
namespace DotNetOpenAuth.OAuth2.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
/// <summary>
/// Describes a delegated authorization between a resource server, a client, and a user.
/// </summary>
- [ContractClass(typeof(IAuthorizationDescriptionContract))]
public interface IAuthorizationDescription {
/// <summary>
/// Gets the identifier of the client authorized to access protected data.
@@ -37,56 +35,4 @@ namespace DotNetOpenAuth.OAuth2.ChannelElements {
/// </summary>
HashSet<string> Scope { get; }
}
-
- /// <summary>
- /// Code contract for the <see cref="IAuthorizationDescription"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IAuthorizationDescription))]
- internal abstract class IAuthorizationDescriptionContract : IAuthorizationDescription {
- /// <summary>
- /// Prevents a default instance of the <see cref="IAuthorizationDescriptionContract"/> class from being created.
- /// </summary>
- private IAuthorizationDescriptionContract() {
- }
-
- /// <summary>
- /// Gets the identifier of the client authorized to access protected data.
- /// </summary>
- string IAuthorizationDescription.ClientIdentifier {
- get {
- Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>()));
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// Gets the date this authorization was established or the token was issued.
- /// </summary>
- /// <value>A date/time expressed in UTC.</value>
- DateTime IAuthorizationDescription.UtcIssued {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the name on the account whose data on the resource server is accessible using this authorization, if applicable.
- /// </summary>
- /// <value>A username, or <c>null</c> if the authorization is to access the client's own data (not a distinct resource owner's data).</value>
- string IAuthorizationDescription.User {
- get {
- // Null and non-empty are allowed, but not empty.
- Contract.Ensures(Contract.Result<string>() != string.Empty);
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// Gets the scope of operations the client is allowed to invoke.
- /// </summary>
- HashSet<string> IAuthorizationDescription.Scope {
- get {
- Contract.Ensures(Contract.Result<HashSet<string>>() != null);
- throw new NotImplementedException();
- }
- }
- }
}
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/MessageBase.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/MessageBase.cs
index fd5503e..272b690 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/MessageBase.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/MessageBase.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OAuth2.Messages {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using Validation;
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs
index f027f54..d90d1b5 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/Messages/UnauthorizedResponse.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Net;
using System.Text;
diff --git a/src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs b/src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs
index c4f56f0..f2acf79 100644
--- a/src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs
+++ b/src/DotNetOpenAuth.OAuth2/OAuth2/OAuthUtilities.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Net;
diff --git a/src/DotNetOpenAuth.OAuth2/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OAuth2/Properties/AssemblyInfo.cs
index d89d8c1..df59ca5 100644
--- a/src/DotNetOpenAuth.OAuth2/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OAuth2/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/AnonymousRequestEventArgs.cs b/src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/AnonymousRequestEventArgs.cs
index 9a17e84..dbee07a 100644
--- a/src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/AnonymousRequestEventArgs.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/AnonymousRequestEventArgs.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using Validation;
diff --git a/src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/ProviderEndpoint.cs b/src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/ProviderEndpoint.cs
index 4e6a48a..a29f6e3 100644
--- a/src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/ProviderEndpoint.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider.UI/OpenId/Provider/ProviderEndpoint.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Collections.Generic;
using System.ComponentModel;
- using System.Diagnostics.Contracts;
using System.Text;
using System.Web;
using System.Web.UI;
@@ -70,7 +69,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// <value>The default value is an <see cref="OpenIdProvider"/> instance initialized according to the web.config file.</value>
public static OpenIdProvider Provider {
get {
- Contract.Ensures(Contract.Result<OpenIdProvider>() != null);
if (provider == null) {
lock (providerInitializerLock) {
if (provider == null) {
@@ -101,7 +99,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
get {
RequiresEx.ValidState(HttpContext.Current != null, MessagingStrings.HttpContextRequired);
RequiresEx.ValidState(HttpContext.Current.Session != null, MessagingStrings.SessionRequired);
- Contract.Ensures(Contract.Result<IAuthenticationRequest>() == null || PendingRequest != null);
return HttpContext.Current.Session[PendingRequestKey] as IAuthenticationRequest;
}
@@ -125,7 +122,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
get {
RequiresEx.ValidState(HttpContext.Current != null, MessagingStrings.HttpContextRequired);
RequiresEx.ValidState(HttpContext.Current.Session != null, MessagingStrings.SessionRequired);
- Contract.Ensures(Contract.Result<IAnonymousRequest>() == null || PendingRequest != null);
return HttpContext.Current.Session[PendingRequestKey] as IAnonymousRequest;
}
@@ -261,7 +257,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// </summary>
/// <returns>The new instance of OpenIdProvider.</returns>
private static OpenIdProvider CreateProvider() {
- Contract.Ensures(Contract.Result<OpenIdProvider>() != null);
return new OpenIdProvider(OpenIdElement.Configuration.Provider.ApplicationStore.CreateInstance(OpenIdProvider.HttpApplicationStore));
}
}
diff --git a/src/DotNetOpenAuth.OpenId.Provider.UI/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OpenId.Provider.UI/Properties/AssemblyInfo.cs
index f05fec0..c7df904 100644
--- a/src/DotNetOpenAuth.OpenId.Provider.UI/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider.UI/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -33,8 +32,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj b/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj
index ff1a6ab..d9fd749 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj
+++ b/src/DotNetOpenAuth.OpenId.Provider/DotNetOpenAuth.OpenId.Provider.csproj
@@ -35,7 +35,6 @@
<Compile Include="OpenId\Messages\IAssociateRequestProvider.cs" />
<Compile Include="OpenId\Messages\AssociateRequestProviderTools.cs" />
<Compile Include="OpenId\Messages\IAssociateSuccessfulResponseProvider.cs" />
- <Compile Include="OpenId\Messages\IAssociateSuccessfulResponseProviderContract.cs" />
<Compile Include="OpenId\Messages\AssociateUnencryptedResponseProvider.cs" />
<Compile Include="OpenId\Messages\CheckAuthenticationResponseProvider.cs" />
<Compile Include="OpenId\Provider\OpenIdProviderUtilities.cs" />
@@ -53,7 +52,6 @@
<Compile Include="OpenId\Provider\IDirectedIdentityIdentifierProvider.cs" />
<Compile Include="OpenId\Provider\IErrorReporting.cs" />
<Compile Include="OpenId\Provider\Request.cs" />
- <Compile Include="OpenId\Provider\RequestContract.cs" />
<Compile Include="OpenId\Provider\StandardProviderApplicationStore.cs" />
<Compile Include="OpenId\Provider\OpenIdProvider.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/OpenIdProviderChannel.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/OpenIdProviderChannel.cs
index fd765fd..45a69a5 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/OpenIdProviderChannel.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/OpenIdProviderChannel.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/ProviderSigningBindingElement.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/ProviderSigningBindingElement.cs
index 3710c45..fbbf37a 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/ProviderSigningBindingElement.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/ProviderSigningBindingElement.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Web;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateDiffieHellmanProviderResponse.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateDiffieHellmanProviderResponse.cs
index c7e0ad9..ebcb534 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateDiffieHellmanProviderResponse.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateDiffieHellmanProviderResponse.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId.Messages {
using System;
- using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Reflection;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateRequestProviderTools.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateRequestProviderTools.cs
index 3b3b6ce..a03c93f 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateRequestProviderTools.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/AssociateRequestProviderTools.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/CheckAuthenticationResponseProvider.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/CheckAuthenticationResponseProvider.cs
index b016a16..f69de5e 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/CheckAuthenticationResponseProvider.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/CheckAuthenticationResponseProvider.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.OpenId.ChannelElements;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProvider.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProvider.cs
index 070f235..df02a2c 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProvider.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProvider.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -16,7 +15,6 @@ namespace DotNetOpenAuth.OpenId.Messages {
/// <summary>
/// An outgoing successful association response from the OpenID Provider.
/// </summary>
- [ContractClass(typeof(IAssociateSuccessfulResponseProviderContract))]
internal interface IAssociateSuccessfulResponseProvider : IProtocolMessage {
/// <summary>
/// Gets or sets the expires in.
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProviderContract.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProviderContract.cs
deleted file mode 100644
index 713493f..0000000
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Messages/IAssociateSuccessfulResponseProviderContract.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="IAssociateSuccessfulResponseProviderContract.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.OpenId.Messages {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.Contracts;
- using System.Linq;
- using System.Text;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OpenId.Provider;
- using Validation;
-
- /// <summary>
- /// Code contract for the <see cref="IAssociateSuccessfulResponseProvider"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IAssociateSuccessfulResponseProvider))]
- internal abstract class IAssociateSuccessfulResponseProviderContract : IAssociateSuccessfulResponseProvider {
- /// <summary>
- /// Gets or sets the expires in.
- /// </summary>
- /// <value>
- /// The expires in.
- /// </value>
- long IAssociateSuccessfulResponseProvider.ExpiresIn {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets or sets the association handle.
- /// </summary>
- /// <value>
- /// The association handle.
- /// </value>
- string IAssociateSuccessfulResponseProvider.AssociationHandle {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the level of protection this message requires.
- /// </summary>
- Messaging.MessageProtections Messaging.IProtocolMessage.RequiredProtection {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets a value indicating whether this is a direct or indirect message.
- /// </summary>
- Messaging.MessageTransport Messaging.IProtocolMessage.Transport {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the version of the protocol or extension this message is prepared to implement.
- /// </summary>
- Version Messaging.IMessage.Version {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the extra, non-standard Protocol parameters included in the message.
- /// </summary>
- IDictionary<string, string> Messaging.IMessage.ExtraData {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Called to create the Association based on a request previously given by the Relying Party.
- /// </summary>
- /// <param name="request">The prior request for an association.</param>
- /// <param name="associationStore">The Provider's association store.</param>
- /// <param name="securitySettings">The security settings of the Provider.</param>
- /// <returns>
- /// The created association.
- /// </returns>
- Association IAssociateSuccessfulResponseProvider.CreateAssociationAtProvider(AssociateRequest request, IProviderAssociationStore associationStore, ProviderSecuritySettings securitySettings) {
- Requires.NotNull(request, "request");
- Requires.NotNull(associationStore, "associationStore");
- Requires.NotNull(securitySettings, "securitySettings");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Checks the message state for conformity to the protocol specification
- /// and throws an exception if the message is invalid.
- /// </summary>
- /// <exception cref="ProtocolException">Thrown if the message is invalid.</exception>
- void Messaging.IMessage.EnsureValidMessage() {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AnonymousRequest.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AnonymousRequest.cs
index fd0cd6e..9d73d9a 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AnonymousRequest.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AnonymousRequest.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Messages;
using Validation;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs
index 10e4dc0..350ed5f 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AssociationDataBag.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Text;
@@ -95,7 +94,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
internal static IDataBagFormatter<AssociationDataBag> CreateFormatter(ICryptoKeyStore cryptoKeyStore, string bucket, TimeSpan? minimumAge = null) {
Requires.NotNull(cryptoKeyStore, "cryptoKeyStore");
Requires.NotNullOrEmpty(bucket, "bucket");
- Contract.Ensures(Contract.Result<IDataBagFormatter<AssociationDataBag>>() != null);
return new BinaryDataBagFormatter<AssociationDataBag>(cryptoKeyStore, bucket, signed: true, encrypted: true, minimumAge: minimumAge);
}
}
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AuthenticationRequest.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AuthenticationRequest.cs
index b323989..0167580 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AuthenticationRequest.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AuthenticationRequest.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Messages;
using Validation;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs
index 2261eb6..91bb6f3 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/AutoResponsiveRequest.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/GsaIcamProfile.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/GsaIcamProfile.cs
index feb56eb..e12ca39 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/GsaIcamProfile.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/GsaIcamProfile.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Provider.Behaviors {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Configuration;
using DotNetOpenAuth.Messaging;
@@ -17,6 +16,7 @@ namespace DotNetOpenAuth.OpenId.Provider.Behaviors {
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
using DotNetOpenAuth.OpenId.Provider;
using DotNetOpenAuth.OpenId.RelyingParty;
+ using Validation;
/// <summary>
/// Implements the Identity, Credential, &amp; Access Management (ICAM) OpenID 2.0 Profile
@@ -182,8 +182,8 @@ namespace DotNetOpenAuth.OpenId.Provider.Behaviors {
/// <param name="maximumLifetime">The maximum lifetime.</param>
/// <param name="securitySettings">The security settings to adjust.</param>
private static void SetMaximumAssociationLifetimeToNotExceed(string associationType, TimeSpan maximumLifetime, ProviderSecuritySettings securitySettings) {
- Contract.Requires(!string.IsNullOrEmpty(associationType));
- Contract.Requires(maximumLifetime.TotalSeconds > 0);
+ Requires.NotNullOrEmpty(associationType, "associationType");
+ Requires.That(maximumLifetime.TotalSeconds > 0, "maximumLifetime", "requires positive timespan");
if (!securitySettings.AssociationLifetimes.ContainsKey(associationType) ||
securitySettings.AssociationLifetimes[associationType] > maximumLifetime) {
securitySettings.AssociationLifetimes[associationType] = maximumLifetime;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/PpidGeneration.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/PpidGeneration.cs
index 9b914d0..c8bdd93 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/PpidGeneration.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Behaviors/PpidGeneration.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Provider.Behaviors {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Behaviors;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/ExtensionsInteropHelper.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/ExtensionsInteropHelper.cs
index e0b16fa..d4332d2 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/ExtensionsInteropHelper.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/ExtensionsInteropHelper.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Provider.Extensions {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Extensions;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/UI/UIRequestTools.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/UI/UIRequestTools.cs
index c5ede8c..278ad6c 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/UI/UIRequestTools.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Extensions/UI/UIRequestTools.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Provider.Extensions.UI {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using DotNetOpenAuth.Messaging;
@@ -16,6 +15,7 @@ namespace DotNetOpenAuth.OpenId.Provider.Extensions.UI {
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.Provider;
using DotNetOpenAuth.Xrds;
+ using Validation;
/// <summary>
/// OpenID User Interface extension 1.0 request message.
@@ -52,8 +52,8 @@ namespace DotNetOpenAuth.OpenId.Provider.Extensions.UI {
/// </example>
/// </remarks>
public static IEnumerable<Uri> GetRelyingPartyIconUrls(Realm realm, IDirectWebRequestHandler webRequestHandler) {
- Contract.Requires(realm != null);
- Contract.Requires(webRequestHandler != null);
+ Requires.NotNull(realm, "realm");
+ Requires.NotNull(webRequestHandler, "webRequestHandler");
ErrorUtilities.VerifyArgumentNotNull(realm, "realm");
ErrorUtilities.VerifyArgumentNotNull(webRequestHandler, "webRequestHandler");
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HmacShaAssociationProvider.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HmacShaAssociationProvider.cs
index a6812fa..8c4011b 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HmacShaAssociationProvider.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HmacShaAssociationProvider.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -44,7 +43,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
Requires.NotNullOrEmpty(associationType, "associationType");
Requires.NotNull(associationStore, "associationStore");
Requires.NotNull(securitySettings, "securitySettings");
- Contract.Ensures(Contract.Result<HmacShaAssociation>() != null);
int secretLength = HmacShaAssociation.GetSecretLength(protocol, associationType);
@@ -62,9 +60,9 @@ namespace DotNetOpenAuth.OpenId.Provider {
string handle = associationStore.Serialize(secret, DateTime.UtcNow + lifetime, associationUse == AssociationRelyingPartyType.Dumb);
- Contract.Assert(protocol != null); // All the way up to the method call, the condition holds, yet we get a Requires failure next
- Contract.Assert(secret != null);
- Contract.Assert(!string.IsNullOrEmpty(associationType));
+ Assumes.True(protocol != null); // All the way up to the method call, the condition holds, yet we get a Requires failure next
+ Assumes.True(secret != null);
+ Assumes.True(!string.IsNullOrEmpty(associationType));
var result = HmacShaAssociation.Create(protocol, associationType, handle, secret, lifetime);
return result;
}
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs
index 1be0c47..9c5004c 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/HostProcessedRequest.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Net;
using System.Text;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs
index c72b901..550033b 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IDirectedIdentityIdentifierProvider.cs
@@ -17,7 +17,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// allowing the users to log into RPs without leaving any clue as to their true identity,
/// and preventing multiple RPs from colluding to track user activity across realms.
/// </remarks>
- [ContractClass(typeof(IDirectedIdentityIdentifierProviderContract))]
public interface IDirectedIdentityIdentifierProvider {
/// <summary>
/// Gets the Identifier to use for the Claimed Identifier and Local Identifier of
@@ -41,44 +40,4 @@ namespace DotNetOpenAuth.OpenId.Provider {
[Pure]
bool IsUserLocalIdentifier(Identifier identifier);
}
-
- /// <summary>
- /// Contract class for the <see cref="IDirectedIdentityIdentifierProvider"/> type.
- /// </summary>
- [ContractClassFor(typeof(IDirectedIdentityIdentifierProvider))]
- internal abstract class IDirectedIdentityIdentifierProviderContract : IDirectedIdentityIdentifierProvider {
- #region IDirectedIdentityIdentifierProvider Members
-
- /// <summary>
- /// Gets the Identifier to use for the Claimed Identifier and Local Identifier of
- /// an outgoing positive assertion.
- /// </summary>
- /// <param name="localIdentifier">The OP local identifier for the authenticating user.</param>
- /// <param name="relyingPartyRealm">The realm of the relying party receiving the assertion.</param>
- /// <returns>
- /// A valid, discoverable OpenID Identifier that should be used as the value for the
- /// openid.claimed_id and openid.local_id parameters. Must not be null.
- /// </returns>
- Uri IDirectedIdentityIdentifierProvider.GetIdentifier(Identifier localIdentifier, Realm relyingPartyRealm) {
- Requires.NotNull(localIdentifier, "localIdentifier");
- Requires.NotNull(relyingPartyRealm, "relyingPartyRealm");
- Requires.That(((IDirectedIdentityIdentifierProvider)this).IsUserLocalIdentifier(localIdentifier), "localIdentifier", OpenIdStrings.ArgumentIsPpidIdentifier);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Determines whether a given identifier is the primary (non-PPID) local identifier for some user.
- /// </summary>
- /// <param name="identifier">The identifier in question.</param>
- /// <returns>
- /// <c>true</c> if the given identifier is the valid, unique identifier for some uesr (and NOT a PPID); otherwise, <c>false</c>.
- /// </returns>
- bool IDirectedIdentityIdentifierProvider.IsUserLocalIdentifier(Identifier identifier) {
- Requires.NotNull(identifier, "identifier");
-
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IProviderAssociationStore.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IProviderAssociationStore.cs
index da7b116..e0f84b9 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IProviderAssociationStore.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/IProviderAssociationStore.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -25,7 +24,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// to avoid disclosing the secret to anyone who sees the association handle, which itself isn't considered to
/// be confidential.
/// </remarks>
- [ContractClass(typeof(IProviderAssociationStoreContract))]
internal interface IProviderAssociationStore {
/// <summary>
/// Stores an association and returns a handle for it.
@@ -50,42 +48,4 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// <exception cref="ProtocolException">Thrown if the association is not of the expected type.</exception>
Association Deserialize(IProtocolMessage containingMessage, bool privateAssociation, string handle);
}
-
- /// <summary>
- /// Code contract for the <see cref="IProviderAssociationStore"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IProviderAssociationStore))]
- internal abstract class IProviderAssociationStoreContract : IProviderAssociationStore {
- /// <summary>
- /// Stores an association and returns a handle for it.
- /// </summary>
- /// <param name="secret">The association secret.</param>
- /// <param name="expiresUtc">The expires UTC.</param>
- /// <param name="privateAssociation">A value indicating whether this is a private association.</param>
- /// <returns>
- /// The association handle that represents this association.
- /// </returns>
- string IProviderAssociationStore.Serialize(byte[] secret, DateTime expiresUtc, bool privateAssociation) {
- Requires.NotNull(secret, "secret");
- Requires.That(expiresUtc.Kind == DateTimeKind.Utc, "expiresUtc", "UTC required");
- Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>()));
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Retrieves an association given an association handle.
- /// </summary>
- /// <param name="containingMessage">The OpenID message that referenced this association handle.</param>
- /// <param name="privateAssociation">A value indicating whether a private association is expected.</param>
- /// <param name="handle">The association handle.</param>
- /// <returns>
- /// An association instance, or <c>null</c> if the association has expired or the signature is incorrect (which may be because the OP's symmetric key has changed).
- /// </returns>
- /// <exception cref="ProtocolException">Thrown if the association is not of the expected type.</exception>
- Association IProviderAssociationStore.Deserialize(IProtocolMessage containingMessage, bool privateAssociation, string handle) {
- Requires.NotNull(containingMessage, "containingMessage");
- Requires.NotNullOrEmpty(handle, "handle");
- throw new NotImplementedException();
- }
- }
}
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProvider.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProvider.cs
index 8c881c6..d96e5c9 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProvider.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProvider.cs
@@ -11,7 +11,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Threading;
using System.Web;
@@ -27,7 +26,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// Offers services for a web page that is acting as an OpenID identity server.
/// </summary>
[SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "By design")]
- [ContractVerification(true)]
public sealed class OpenIdProvider : IDisposable, IOpenIdHost {
/// <summary>
/// The name of the key to use in the HttpApplication cache to store the
@@ -56,8 +54,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// </summary>
public OpenIdProvider()
: this(OpenIdElement.Configuration.Provider.ApplicationStore.CreateInstance(HttpApplicationStore)) {
- Contract.Ensures(this.SecuritySettings != null);
- Contract.Ensures(this.Channel != null);
}
/// <summary>
@@ -67,8 +63,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
public OpenIdProvider(IOpenIdApplicationStore applicationStore)
: this((INonceStore)applicationStore, (ICryptoKeyStore)applicationStore) {
Requires.NotNull(applicationStore, "applicationStore");
- Contract.Ensures(this.SecuritySettings != null);
- Contract.Ensures(this.Channel != null);
}
/// <summary>
@@ -79,8 +73,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
private OpenIdProvider(INonceStore nonceStore, ICryptoKeyStore cryptoKeyStore) {
Requires.NotNull(nonceStore, "nonceStore");
Requires.NotNull(cryptoKeyStore, "cryptoKeyStore");
- Contract.Ensures(this.SecuritySettings != null);
- Contract.Ensures(this.Channel != null);
this.SecuritySettings = OpenIdElement.Configuration.Provider.SecuritySettings.CreateSecuritySettings();
this.behaviors.CollectionChanged += this.OnBehaviorsChanged;
@@ -104,7 +96,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
public static IOpenIdApplicationStore HttpApplicationStore {
get {
RequiresEx.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired);
- Contract.Ensures(Contract.Result<IOpenIdApplicationStore>() != null);
HttpContext context = HttpContext.Current;
var store = (IOpenIdApplicationStore)context.Application[ApplicationStoreKey];
if (store == null) {
@@ -132,8 +123,7 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// </summary>
public ProviderSecuritySettings SecuritySettings {
get {
- Contract.Ensures(Contract.Result<ProviderSecuritySettings>() != null);
- Contract.Assume(this.securitySettings != null);
+ Assumes.True(this.securitySettings != null);
return this.securitySettings;
}
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProviderUtilities.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProviderUtilities.cs
index 69d0440..9e46168 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProviderUtilities.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/OpenIdProviderUtilities.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/PrivatePersonalIdentifierProviderBase.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/PrivatePersonalIdentifierProviderBase.cs
index 8b1706a..2650e44 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/PrivatePersonalIdentifierProviderBase.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/PrivatePersonalIdentifierProviderBase.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Security.Cryptography;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationHandleEncoder.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationHandleEncoder.cs
index 526d825..240e450 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationHandleEncoder.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationHandleEncoder.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
- using System.Diagnostics.Contracts;
using System.Threading;
using DotNetOpenAuth.Configuration;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationKeyStorage.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationKeyStorage.cs
index ff2e10b..8eaae09 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationKeyStorage.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/ProviderAssociationKeyStorage.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
using Validation;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Request.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Request.cs
index ff7b45b..ceabab3 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Request.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/Request.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -19,8 +18,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// request messages to an OpenID Provider.
/// </summary>
[Serializable]
- [ContractClass(typeof(RequestContract))]
- [ContractVerification(true)]
internal abstract class Request : IRequest {
/// <summary>
/// The incoming request message.
@@ -101,7 +98,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
internal IProtocolMessage Response {
get {
RequiresEx.ValidState(this.IsResponseReady, OpenIdStrings.ResponseNotReady);
- Contract.Ensures(Contract.Result<IProtocolMessage>() != null);
if (this.responseExtensions.Count > 0) {
var extensibleResponse = this.ResponseMessage as IProtocolMessageWithExtensions;
diff --git a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/RequestContract.cs b/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/RequestContract.cs
deleted file mode 100644
index c4b96e8..0000000
--- a/src/DotNetOpenAuth.OpenId.Provider/OpenId/Provider/RequestContract.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="RequestContract.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.OpenId.Provider {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.Contracts;
- using System.Linq;
- using System.Text;
- using DotNetOpenAuth.Messaging;
-
- /// <summary>
- /// Code contract for the <see cref="Request"/> class.
- /// </summary>
- [ContractClassFor(typeof(Request))]
- internal abstract class RequestContract : Request {
- /// <summary>
- /// Prevents a default instance of the <see cref="RequestContract"/> class from being created.
- /// </summary>
- private RequestContract() : base((Version)null, null) {
- }
-
- /// <summary>
- /// Gets a value indicating whether the response is ready to be sent to the user agent.
- /// </summary>
- /// <remarks>
- /// This property returns false if there are properties that must be set on this
- /// request instance before the response can be sent.
- /// </remarks>
- public override bool IsResponseReady {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the response message, once <see cref="IsResponseReady"/> is <c>true</c>.
- /// </summary>
- protected override IProtocolMessage ResponseMessage {
- get {
- RequiresEx.ValidState(this.IsResponseReady);
- Contract.Ensures(Contract.Result<IProtocolMessage>() != null);
- throw new NotImplementedException();
- }
- }
- }
-}
diff --git a/src/DotNetOpenAuth.OpenId.Provider/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OpenId.Provider/Properties/AssemblyInfo.cs
index 397b35d..29900ab 100644
--- a/src/DotNetOpenAuth.OpenId.Provider/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OpenId.Provider/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj
index 00ad2fe..3d2661f 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/DotNetOpenAuth.OpenId.RelyingParty.UI.csproj
@@ -35,7 +35,6 @@
<Compile Include="OpenId\RelyingParty\OpenIdTextBox.cs" />
<Compile Include="OpenId\RelyingParty\PopupBehavior.cs" />
<Compile Include="OpenId\RelyingParty\SelectorButton.cs" />
- <Compile Include="OpenId\RelyingParty\SelectorButtonContract.cs" />
<Compile Include="OpenId\RelyingParty\SelectorOpenIdButton.cs" />
<Compile Include="OpenId\RelyingParty\SelectorProviderButton.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/Mvc/OpenIdHelper.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/Mvc/OpenIdHelper.cs
index f0e54a9..c78c6a7 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/Mvc/OpenIdHelper.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/Mvc/OpenIdHelper.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Mvc {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -36,7 +35,6 @@ namespace DotNetOpenAuth.Mvc {
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "False positive.")]
public static string OpenIdSelectorStyles(this HtmlHelper html) {
Requires.NotNull(html, "html");
- Contract.Ensures(Contract.Result<string>() != null);
using (var result = new StringWriter(CultureInfo.CurrentCulture)) {
result.WriteStylesheetLink(OpenId.RelyingParty.OpenIdSelector.EmbeddedStylesheetResourceName);
@@ -66,7 +64,6 @@ namespace DotNetOpenAuth.Mvc {
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "False positive")]
public static string OpenIdSelectorScripts(this HtmlHelper html, OpenIdSelector selectorOptions, OpenIdAjaxOptions additionalOptions) {
Requires.NotNull(html, "html");
- Contract.Ensures(Contract.Result<string>() != null);
bool selectorOptionsOwned = false;
if (selectorOptions == null) {
@@ -212,7 +209,6 @@ window.openid_trace = {1}; // causes lots of messages";
Requires.NotNull(html, "html");
Requires.NotNull(providerIdentifier, "providerIdentifier");
Requires.NotNullOrEmpty(imageUrl, "imageUrl");
- Contract.Ensures(Contract.Result<string>() != null);
return OpenIdSelectorButton(html, providerIdentifier, "OPButton", imageUrl);
}
@@ -229,7 +225,6 @@ window.openid_trace = {1}; // causes lots of messages";
public static string OpenIdSelectorOpenIdButton(this HtmlHelper html, string imageUrl) {
Requires.NotNull(html, "html");
Requires.NotNullOrEmpty(imageUrl, "imageUrl");
- Contract.Ensures(Contract.Result<string>() != null);
return OpenIdSelectorButton(html, "OpenIDButton", "OpenIDButton", imageUrl);
}
@@ -247,7 +242,6 @@ window.openid_trace = {1}; // causes lots of messages";
public static string OpenIdSelector(this HtmlHelper html, params SelectorButton[] buttons) {
Requires.NotNull(html, "html");
Requires.NotNull(buttons, "buttons");
- Contract.Ensures(Contract.Result<string>() != null);
using (var writer = new StringWriter(CultureInfo.CurrentCulture)) {
using (var h = new HtmlTextWriter(writer)) {
@@ -314,7 +308,6 @@ window.openid_trace = {1}; // causes lots of messages";
Requires.NotNull(html, "html");
Requires.NotNull(id, "id");
Requires.NotNullOrEmpty(imageUrl, "imageUrl");
- Contract.Ensures(Contract.Result<string>() != null);
using (var writer = new StringWriter(CultureInfo.CurrentCulture)) {
using (var h = new HtmlTextWriter(writer)) {
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxRelyingParty.cs
index 2d3b519..918efdf 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxRelyingParty.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxRelyingParty.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Net;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxTextBox.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxTextBox.cs
index fa41efa..b5b6162 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxTextBox.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxTextBox.cs
@@ -19,7 +19,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Drawing.Design;
using System.Globalization;
using System.Text;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdEventArgs.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdEventArgs.cs
index 489d2b5..66d6df6 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdEventArgs.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdEventArgs.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs
index ffb619a..16f9462 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdLogin.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Web.UI;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdMobileTextBox.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdMobileTextBox.cs
index c7c83a9..0c159a1 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdMobileTextBox.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdMobileTextBox.cs
@@ -11,7 +11,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Web.Security;
@@ -20,6 +19,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using DotNetOpenAuth.Configuration;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
+ using Validation;
/// <summary>
/// An ASP.NET control for mobile devices that provides a minimal text box that is OpenID-aware.
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs
index 3d42c85..9b4d271 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyAjaxControlBase.cs
@@ -11,7 +11,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Text;
@@ -396,7 +395,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// </summary>
/// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"/> object that receives the server control content.</param>
protected override void Render(HtmlTextWriter writer) {
- Contract.Assume(writer != null, "Missing contract.");
+ Assumes.True(writer != null, "Missing contract.");
base.Render(writer);
// Emit a hidden field to let the javascript on the user agent know if an
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs
index cff00d5..7d616d2 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdRelyingPartyControlBase.cs
@@ -12,7 +12,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Drawing.Design;
using System.Globalization;
using System.Linq;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdSelector.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdSelector.cs
index 91ff8c8..7881a8b 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdSelector.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdSelector.cs
@@ -12,7 +12,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IdentityModel.Claims;
using System.Linq;
@@ -327,7 +326,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// </summary>
/// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"/> object that receives the server control content.</param>
protected override void Render(HtmlTextWriter writer) {
- Contract.Assume(writer != null, "Missing contract");
+ Assumes.True(writer != null, "Missing contract");
writer.AddAttribute(HtmlTextWriterAttribute.Class, "OpenIdProviders");
writer.RenderBeginTag(HtmlTextWriterTag.Ul);
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdTextBox.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdTextBox.cs
index e40d20e..7474854 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdTextBox.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdTextBox.cs
@@ -15,7 +15,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Drawing.Design;
using System.Globalization;
using System.Net;
@@ -585,7 +584,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// </summary>
/// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"/> object that receives the server control content.</param>
protected override void Render(HtmlTextWriter writer) {
- Contract.Assume(writer != null, "Missing contract.");
+ Assumes.True(writer != null, "Missing contract.");
if (this.ShowLogo) {
string logoUrl = Page.ClientScript.GetWebResourceUrl(
@@ -628,7 +627,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// true if the server control's state changes as a result of the postback; otherwise, false.
/// </returns>
protected virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection) {
- Contract.Assume(postCollection != null, "Missing contract");
+ Assumes.True(postCollection != null, "Missing contract");
// If the control was temporarily hidden, it won't be in the Form data,
// and we'll just implicitly keep the last Text setting.
@@ -667,7 +666,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// used to determine the user's control of the <see cref="IAuthenticationRequest.ClaimedIdentifier"/>.
/// </returns>
private IEnumerable<IAuthenticationRequest> CreateRequestsCore(IEnumerable<IAuthenticationRequest> requests) {
- Contract.Requires(requests != null);
+ Requires.NotNull(requests, "requests");
foreach (var request in requests) {
if (this.EnableRequestProfile) {
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButton.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButton.cs
index 670189c..82fd96b 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButton.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButton.cs
@@ -6,13 +6,11 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
- using System.Diagnostics.Contracts;
using System.Web.UI;
/// <summary>
/// A button that would appear in the <see cref="OpenIdSelector"/> control via its <see cref="OpenIdSelector.Buttons"/> collection.
/// </summary>
- [ContractClass(typeof(SelectorButtonContract))]
[Serializable]
public abstract class SelectorButton {
/// <summary>
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButtonContract.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButtonContract.cs
deleted file mode 100644
index 2f83b1d..0000000
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorButtonContract.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="SelectorButtonContract.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.OpenId.RelyingParty {
- using System;
- using System.Diagnostics.Contracts;
- using System.Web.UI;
- using Validation;
-
- /// <summary>
- /// The contract class for the <see cref="SelectorButton"/> class.
- /// </summary>
- [ContractClassFor(typeof(SelectorButton))]
- internal abstract class SelectorButtonContract : SelectorButton {
- /// <summary>
- /// Ensures that this button has been initialized to a valid state.
- /// </summary>
- /// <remarks>
- /// This is "internal" -- NOT "protected internal" deliberately. It makes it impossible
- /// to derive from this class outside the assembly, which suits our purposes since the
- /// <see cref="OpenIdSelector"/> control is not designed for an extensible set of button types.
- /// </remarks>
- internal override void EnsureValid() {
- }
-
- /// <summary>
- /// Renders the leading attributes for the LI tag.
- /// </summary>
- /// <param name="writer">The writer.</param>
- protected internal override void RenderLeadingAttributes(HtmlTextWriter writer) {
- Requires.NotNull(writer, "writer");
- }
-
- /// <summary>
- /// Renders the content of the button.
- /// </summary>
- /// <param name="writer">The writer.</param>
- /// <param name="selector">The containing selector control.</param>
- protected internal override void RenderButtonContent(HtmlTextWriter writer, OpenIdSelector selector) {
- Requires.NotNull(writer, "writer");
- Requires.NotNull(selector, "selector");
- }
- }
-}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorOpenIdButton.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorOpenIdButton.cs
index 432d54f..2ede5d6 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorOpenIdButton.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorOpenIdButton.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.ComponentModel;
- using System.Diagnostics.Contracts;
using System.Drawing.Design;
using System.Web.UI;
using DotNetOpenAuth.Messaging;
@@ -48,8 +47,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// Ensures that this button has been initialized to a valid state.
/// </summary>
internal override void EnsureValid() {
- Contract.Ensures(!string.IsNullOrEmpty(this.Image));
-
// Every button must have an image.
ErrorUtilities.VerifyOperation(!string.IsNullOrEmpty(this.Image), OpenIdStrings.PropertyNotSet, "SelectorButton.Image");
}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorProviderButton.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorProviderButton.cs
index bc2b4c7..e60d95d 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorProviderButton.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/SelectorProviderButton.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.ComponentModel;
- using System.Diagnostics.Contracts;
using System.Drawing.Design;
using System.Web.UI;
using DotNetOpenAuth.ComponentModel;
@@ -70,9 +69,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// Ensures that this button has been initialized to a valid state.
/// </summary>
internal override void EnsureValid() {
- Contract.Ensures(!string.IsNullOrEmpty(this.Image));
- Contract.Ensures(this.OPIdentifier != null);
-
// Every button must have an image.
ErrorUtilities.VerifyOperation(!string.IsNullOrEmpty(this.Image), OpenIdStrings.PropertyNotSet, "SelectorButton.Image");
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/Properties/AssemblyInfo.cs
index 5ea4ad7..0b03770 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty.UI/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty.UI/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -33,8 +32,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj b/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj
index 6728601..309ecb3 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/DotNetOpenAuth.OpenId.RelyingParty.csproj
@@ -36,7 +36,6 @@
<Compile Include="OpenId\Interop\OpenIdRelyingPartyShim.cs" />
<Compile Include="OpenId\Messages\AssociateDiffieHellmanRelyingPartyResponse.cs" />
<Compile Include="OpenId\Messages\AssociateRequestRelyingParty.cs" />
- <Compile Include="OpenId\Messages\IAssociateSuccessfulResponseRelyingPartyContract.cs" />
<Compile Include="OpenId\Messages\IAssociateSuccessfulResponseRelyingParty.cs" />
<Compile Include="OpenId\Messages\AssociateUnencryptedResponseRelyingParty.cs" />
<Compile Include="OpenId\RelyingParty\CryptoKeyStoreAsRelyingPartyAssociationStore.cs" />
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/ExtensionsBindingElementRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/ExtensionsBindingElementRelyingParty.cs
index 205a63d..be98d29 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/ExtensionsBindingElementRelyingParty.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/ExtensionsBindingElementRelyingParty.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.OpenId.RelyingParty;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/OpenIdRelyingPartyChannel.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/OpenIdRelyingPartyChannel.cs
index 36ffee1..e65409a 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/OpenIdRelyingPartyChannel.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/OpenIdRelyingPartyChannel.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -59,8 +58,6 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
/// messages, and will validate them later.</para>
/// </remarks>
internal static OpenIdChannel CreateNonVerifyingChannel() {
- Contract.Ensures(Contract.Result<OpenIdChannel>() != null);
-
return new OpenIdRelyingPartyChannel(null, null, new OpenIdRelyingPartyMessageFactory(), new RelyingPartySecuritySettings(), true);
}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/RelyingPartySigningBindingElement.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/RelyingPartySigningBindingElement.cs
index 81ce4e4..3ec2eee 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/RelyingPartySigningBindingElement.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/RelyingPartySigningBindingElement.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/ReturnToNonceBindingElement.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/ReturnToNonceBindingElement.cs
index bfcdf1d..c459487 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/ReturnToNonceBindingElement.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/ChannelElements/ReturnToNonceBindingElement.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -262,7 +261,7 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
Requires.NotNullOrEmpty(value, "value");
byte[] nonce = MessagingUtilities.FromBase64WebSafeString(value);
- Contract.Assume(nonce != null);
+ Assumes.True(nonce != null);
DateTime creationDateUtc = new DateTime(BitConverter.ToInt64(nonce, 0), DateTimeKind.Utc);
byte[] randomPart = new byte[NonceByteLength];
Array.Copy(nonce, sizeof(long), randomPart, 0, NonceByteLength);
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/HostMetaDiscoveryService.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/HostMetaDiscoveryService.cs
index b6d91e9..1871f19 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/HostMetaDiscoveryService.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/HostMetaDiscoveryService.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.OpenId {
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -168,7 +167,6 @@ namespace DotNetOpenAuth.OpenId {
/// <returns>A sequence of services.</returns>
private static IEnumerable<ServiceElement> GetDescribedByServices(IEnumerable<XrdElement> xrds) {
Requires.NotNull(xrds, "xrds");
- Contract.Ensures(Contract.Result<IEnumerable<ServiceElement>>() != null);
var describedBy = from xrd in xrds
from service in xrd.SearchForServiceTypeUris(p => "http://www.iana.org/assignments/relation/describedby")
@@ -187,7 +185,6 @@ namespace DotNetOpenAuth.OpenId {
Requires.NotNull(xrds, "xrds");
Requires.NotNull(identifier, "identifier");
Requires.NotNull(requestHandler, "requestHandler");
- Contract.Ensures(Contract.Result<IEnumerable<IdentifierDiscoveryResult>>() != null);
var results = new List<IdentifierDiscoveryResult>();
foreach (var serviceElement in GetDescribedByServices(xrds)) {
@@ -299,7 +296,6 @@ namespace DotNetOpenAuth.OpenId {
Requires.NotNull(identifier, "identifier");
Requires.NotNull(requestHandler, "requestHandler");
Requires.NotNull(xrdsLocation, "xrdsLocation");
- Contract.Ensures(Contract.Result<IncomingWebResponse>() != null);
var request = (HttpWebRequest)WebRequest.Create(xrdsLocation);
request.CachePolicy = Yadis.IdentifierDiscoveryCachePolicy;
@@ -318,8 +314,7 @@ namespace DotNetOpenAuth.OpenId {
/// </summary>
/// <param name="certificates">The chain of certificates to verify.</param>
private static void VerifyCertificateChain(IList<X509Certificate2> certificates) {
- Contract.Requires(certificates.Count > 0);
- Contract.Requires(certificates.All(c => c != null));
+ Requires.NotNullEmptyOrNullElements(certificates, "certificates");
// Before calling into the OS to validate the certificate, since that can for some bizzare reason hang for 5 seconds
// on some systems, check a cache of previously verified certificates first.
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/AuthenticationResponseShim.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/AuthenticationResponseShim.cs
index f4134b9..d871645 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/AuthenticationResponseShim.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/AuthenticationResponseShim.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Interop {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Runtime.InteropServices;
using System.Web;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/ClaimsResponseShim.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/ClaimsResponseShim.cs
index e53ff46..cad4504 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/ClaimsResponseShim.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Interop/ClaimsResponseShim.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Interop {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Runtime.InteropServices;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
@@ -19,7 +18,6 @@ namespace DotNetOpenAuth.OpenId.Interop {
/// </summary>
[SuppressMessage("Microsoft.Interoperability", "CA1409:ComVisibleTypesShouldBeCreatable", Justification = "It's only creatable on the inside. It must be ComVisible for ASP to see it.")]
[ComVisible(true), Obsolete("This class acts as a COM Server and should not be called directly from .NET code.")]
- [ContractVerification(true)]
public sealed class ClaimsResponseShim {
/// <summary>
/// The Simple Registration claims response message that this shim wraps.
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateDiffieHellmanRelyingPartyResponse.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateDiffieHellmanRelyingPartyResponse.cs
index 9464582..64e1b30 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateDiffieHellmanRelyingPartyResponse.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateDiffieHellmanRelyingPartyResponse.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId.Messages {
using System;
- using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Reflection;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateRequestRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateRequestRelyingParty.cs
index e82aeea..3555dfb 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateRequestRelyingParty.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/AssociateRequestRelyingParty.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.OpenId.RelyingParty;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/IAssociateSuccessfulResponseRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/IAssociateSuccessfulResponseRelyingParty.cs
index 0c81550..a76d59c 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/IAssociateSuccessfulResponseRelyingParty.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/IAssociateSuccessfulResponseRelyingParty.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -15,7 +14,6 @@ namespace DotNetOpenAuth.OpenId.Messages {
/// <summary>
/// A successful association response as it is received by the relying party.
/// </summary>
- [ContractClass(typeof(IAssociateSuccessfulResponseRelyingPartyContract))]
internal interface IAssociateSuccessfulResponseRelyingParty : IProtocolMessage {
/// <summary>
/// Called to create the Association based on a request previously given by the Relying Party.
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/IAssociateSuccessfulResponseRelyingPartyContract.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/IAssociateSuccessfulResponseRelyingPartyContract.cs
deleted file mode 100644
index ad53778..0000000
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/Messages/IAssociateSuccessfulResponseRelyingPartyContract.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="IAssociateSuccessfulResponseRelyingPartyContract.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.Contracts;
- using System.Linq;
- using System.Text;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OpenId;
- using DotNetOpenAuth.OpenId.Messages;
- using Validation;
-
- /// <summary>
- /// Code contract for the <see cref="IAssociateSuccessfulResponseRelyingParty"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IAssociateSuccessfulResponseRelyingParty))]
- internal abstract class IAssociateSuccessfulResponseRelyingPartyContract : IAssociateSuccessfulResponseRelyingParty {
- #region IProtocolMessage Members
-
- /// <summary>
- /// Gets the level of protection this message requires.
- /// </summary>
- Messaging.MessageProtections Messaging.IProtocolMessage.RequiredProtection {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets a value indicating whether this is a direct or indirect message.
- /// </summary>
- Messaging.MessageTransport Messaging.IProtocolMessage.Transport {
- get { throw new NotImplementedException(); }
- }
-
- #endregion
-
- #region IMessage members
-
- /// <summary>
- /// Gets the version of the protocol or extension this message is prepared to implement.
- /// </summary>
- Version Messaging.IMessage.Version {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the extra, non-standard Protocol parameters included in the message.
- /// </summary>
- IDictionary<string, string> Messaging.IMessage.ExtraData {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Checks the message state for conformity to the protocol specification
- /// and throws an exception if the message is invalid.
- /// </summary>
- /// <exception cref="ProtocolException">Thrown if the message is invalid.</exception>
- void Messaging.IMessage.EnsureValidMessage() {
- throw new NotImplementedException();
- }
-
- #endregion
-
- /// <summary>
- /// Called to create the Association based on a request previously given by the Relying Party.
- /// </summary>
- /// <param name="request">The prior request for an association.</param>
- /// <returns>
- /// The created association.
- /// </returns>
- Association IAssociateSuccessfulResponseRelyingParty.CreateAssociationAtRelyingParty(AssociateRequest request) {
- Requires.NotNull(request, "request");
- throw new NotImplementedException();
- }
- }
-}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs
index 88bb86a..dfb307b 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AssociationManager.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Net;
using System.Security;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Associations.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Associations.cs
index cd0341e..44d7d07 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Associations.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Associations.cs
@@ -24,7 +24,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// can break if the collection is changed by another thread during enumeration.
/// </remarks>
[DebuggerDisplay("Count = {assocs.Count}")]
- [ContractVerification(true)]
internal class Associations {
/// <summary>
/// The lookup table where keys are the association handles and values are the associations themselves.
@@ -48,8 +47,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// </remarks>
public IEnumerable<Association> Best {
get {
- Contract.Ensures(Contract.Result<IEnumerable<Association>>() != null);
-
lock (this.associations) {
return this.associations.OrderByDescending(assoc => assoc.Issued);
}
@@ -62,13 +59,12 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// <param name="association">The association to add to the collection.</param>
public void Set(Association association) {
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.
this.associations.Add(association);
}
- Contract.Assume(this.Get(association.Handle) == association);
+ Assumes.True(this.Get(association.Handle) == association);
}
/// <summary>
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AuthenticationRequest.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AuthenticationRequest.cs
index d14a402..92af297 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AuthenticationRequest.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/AuthenticationRequest.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Threading;
@@ -323,7 +322,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
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.
// (so that if a web app base path is /MyApp/, but the URL of this request happens to be
@@ -431,8 +429,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
ErrorUtilities.VerifyArgumentNotNull(relyingParty, "relyingParty");
ErrorUtilities.VerifyArgumentNotNull(realm, "realm");
ErrorUtilities.VerifyArgumentNotNull(serviceEndpoints, "serviceEndpoints");
- ////Contract.Ensures(Contract.Result<IEnumerable<AuthenticationRequest>>() != null);
-
+ ////
// If shared associations are required, then we had better have an association store.
ErrorUtilities.VerifyOperation(!relyingParty.SecuritySettings.RequireAssociation || relyingParty.AssociationManager.HasAssociationStore, OpenIdStrings.AssociationStoreRequired);
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Behaviors/GsaIcamProfile.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Behaviors/GsaIcamProfile.cs
index f05d354..8deed09 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Behaviors/GsaIcamProfile.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Behaviors/GsaIcamProfile.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.RelyingParty.Behaviors {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Configuration;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/CryptoKeyStoreAsRelyingPartyAssociationStore.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/CryptoKeyStoreAsRelyingPartyAssociationStore.cs
index 2e104a7..ba69838 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/CryptoKeyStoreAsRelyingPartyAssociationStore.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/CryptoKeyStoreAsRelyingPartyAssociationStore.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Messaging.Bindings;
using Validation;
@@ -26,7 +25,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// <param name="keyStore">The key store.</param>
internal CryptoKeyStoreAsRelyingPartyAssociationStore(ICryptoKeyStore keyStore) {
Requires.NotNull(keyStore, "keyStore");
- Contract.Ensures(this.keyStore == keyStore);
this.keyStore = keyStore;
}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/ExtensionsInteropHelper.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/ExtensionsInteropHelper.cs
index 460d6a3..fde1462 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/ExtensionsInteropHelper.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/ExtensionsInteropHelper.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty.Extensions {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Extensions;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/UIUtilities.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/UIUtilities.cs
index 5c35995..a5de08b 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/UIUtilities.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/Extensions/UIUtilities.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId.RelyingParty.Extensions.UI {
using System;
- using System.Diagnostics.Contracts;
using System.Globalization;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.RelyingParty;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/FailedAuthenticationResponse.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/FailedAuthenticationResponse.cs
index 6203185..ef50d10 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/FailedAuthenticationResponse.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/FailedAuthenticationResponse.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Collections.Generic;
using System.Diagnostics;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Text;
using System.Web;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/IRelyingPartyAssociationStore.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/IRelyingPartyAssociationStore.cs
index 5d54a80..96f613c 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/IRelyingPartyAssociationStore.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/IRelyingPartyAssociationStore.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
@@ -19,7 +18,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// to not be a performance drain. Because this balance can vary by host, it is the
/// responsibility of the host to initiate this cleaning.
/// </remarks>
- [ContractClass(typeof(IRelyingPartyAssociationStoreContract))]
public interface IRelyingPartyAssociationStore {
/// <summary>
/// Saves an <see cref="Association"/> for later recall.
@@ -72,83 +70,4 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// </remarks>
bool RemoveAssociation(Uri providerEndpoint, string handle);
}
-
- /// <summary>
- /// Code Contract for the <see cref="IRelyingPartyAssociationStore"/> class.
- /// </summary>
- [ContractClassFor(typeof(IRelyingPartyAssociationStore))]
- internal abstract class IRelyingPartyAssociationStoreContract : IRelyingPartyAssociationStore {
- #region IAssociationStore Members
-
- /// <summary>
- /// Saves an <see cref="Association"/> for later recall.
- /// </summary>
- /// <param name="providerEndpoint">The Uri (for relying parties) or Smart/Dumb (for providers).</param>
- /// <param name="association">The association to store.</param>
- /// <remarks>
- /// TODO: what should implementations do on association handle conflict?
- /// </remarks>
- void IRelyingPartyAssociationStore.StoreAssociation(Uri providerEndpoint, Association association) {
- Requires.NotNull(providerEndpoint, "providerEndpoint");
- Requires.NotNull(association, "association");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets the best association (the one with the longest remaining life) for a given key.
- /// </summary>
- /// <param name="providerEndpoint">The Uri (for relying parties) or Smart/Dumb (for Providers).</param>
- /// <param name="securityRequirements">The security requirements that the returned association must meet.</param>
- /// <returns>
- /// The requested association, or null if no unexpired <see cref="Association"/>s exist for the given key.
- /// </returns>
- /// <remarks>
- /// In the event that multiple associations exist for the given
- /// <paramref name="providerEndpoint"/>, it is important for the
- /// implementation for this method to use the <paramref name="securityRequirements"/>
- /// to pick the best (highest grade or longest living as the host's policy may dictate)
- /// association that fits the security requirements.
- /// Associations that are returned that do not meet the security requirements will be
- /// ignored and a new association created.
- /// </remarks>
- Association IRelyingPartyAssociationStore.GetAssociation(Uri providerEndpoint, SecuritySettings securityRequirements) {
- Requires.NotNull(providerEndpoint, "providerEndpoint");
- Requires.NotNull(securityRequirements, "securityRequirements");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets the association for a given key and handle.
- /// </summary>
- /// <param name="providerEndpoint">The Uri (for relying parties) or Smart/Dumb (for Providers).</param>
- /// <param name="handle">The handle of the specific association that must be recalled.</param>
- /// <returns>
- /// 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) {
- Requires.NotNull(providerEndpoint, "providerEndpoint");
- Contract.Requires(!string.IsNullOrEmpty(handle));
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Removes a specified handle that may exist in the store.
- /// </summary>
- /// <param name="providerEndpoint">The Uri (for relying parties) or Smart/Dumb (for Providers).</param>
- /// <param name="handle">The handle of the specific association that must be deleted.</param>
- /// <returns>
- /// True if the association existed in this store previous to this call.
- /// </returns>
- /// <remarks>
- /// No exception should be thrown if the association does not exist in the store
- /// before this call.
- /// </remarks>
- bool IRelyingPartyAssociationStore.RemoveAssociation(Uri providerEndpoint, string handle) {
- Requires.NotNull(providerEndpoint, "providerEndpoint");
- Contract.Requires(!string.IsNullOrEmpty(handle));
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/ISetupRequiredAuthenticationResponse.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/ISetupRequiredAuthenticationResponse.cs
index 691a8ee..4fc459f 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/ISetupRequiredAuthenticationResponse.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/ISetupRequiredAuthenticationResponse.cs
@@ -6,14 +6,12 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
- using System.Diagnostics.Contracts;
/// <summary>
/// An interface to expose useful properties and functionality for handling
/// authentication responses that are returned from Immediate authentication
/// requests that require a subsequent request to be made in non-immediate mode.
/// </summary>
- [ContractClass(typeof(ISetupRequiredAuthenticationResponseContract))]
public interface ISetupRequiredAuthenticationResponse {
/// <summary>
/// Gets the <see cref="Identifier"/> to pass to <see cref="OpenIdRelyingParty.CreateRequest(Identifier)"/>
@@ -21,31 +19,4 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// </summary>
Identifier UserSuppliedIdentifier { get; }
}
-
- /// <summary>
- /// Code contract class for the <see cref="ISetupRequiredAuthenticationResponse"/> type.
- /// </summary>
- [ContractClassFor(typeof(ISetupRequiredAuthenticationResponse))]
- internal abstract class ISetupRequiredAuthenticationResponseContract : ISetupRequiredAuthenticationResponse {
- /// <summary>
- /// Initializes a new instance of the <see cref="ISetupRequiredAuthenticationResponseContract"/> class.
- /// </summary>
- protected ISetupRequiredAuthenticationResponseContract() {
- }
-
- #region ISetupRequiredAuthenticationResponse Members
-
- /// <summary>
- /// Gets the <see cref="Identifier"/> to pass to <see cref="OpenIdRelyingParty.CreateRequest(Identifier)"/>
- /// in a subsequent authentication attempt.
- /// </summary>
- Identifier ISetupRequiredAuthenticationResponse.UserSuppliedIdentifier {
- get {
- RequiresEx.ValidState(((IAuthenticationResponse)this).Status == AuthenticationStatus.SetupRequired, OpenIdStrings.OperationOnlyValidForSetupRequiredState);
- throw new System.NotImplementedException();
- }
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/NegativeAuthenticationResponse.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/NegativeAuthenticationResponse.cs
index 080898d..bf52060 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/NegativeAuthenticationResponse.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/NegativeAuthenticationResponse.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Web;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs
index 0b6cf41..2177591 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/OpenIdRelyingParty.cs
@@ -11,7 +11,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Net;
@@ -41,7 +40,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// Provides the programmatic facilities to act as an OpenID relying party.
/// </summary>
[SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "Unavoidable")]
- [ContractVerification(true)]
public class OpenIdRelyingParty : IDisposable, IOpenIdHost {
/// <summary>
/// The name of the key to use in the HttpApplication cache to store the
@@ -161,8 +159,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static IOpenIdApplicationStore HttpApplicationStore {
get {
- Contract.Ensures(Contract.Result<IOpenIdApplicationStore>() != null);
-
HttpContext context = HttpContext.Current;
ErrorUtilities.VerifyOperation(context != null, Strings.StoreRequiredWhenNoHttpContextAvailable, typeof(IOpenIdApplicationStore).Name);
var store = (IOpenIdApplicationStore)context.Application[ApplicationStoreKey];
@@ -201,7 +197,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// </summary>
public RelyingPartySecuritySettings SecuritySettings {
get {
- Contract.Ensures(Contract.Result<RelyingPartySecuritySettings>() != null);
return this.securitySettings;
}
@@ -348,7 +343,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
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();
} catch (InvalidOperationException ex) {
@@ -380,10 +374,9 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
public IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier, Realm realm) {
Requires.NotNull(userSuppliedIdentifier, "userSuppliedIdentifier");
Requires.NotNull(realm, "realm");
- Contract.Ensures(Contract.Result<IAuthenticationRequest>() != null);
try {
var result = this.CreateRequests(userSuppliedIdentifier, realm).First();
- Contract.Assume(result != null);
+ Assumes.True(result != null);
return result;
} catch (InvalidOperationException ex) {
throw ErrorUtilities.Wrap(ex, OpenIdStrings.OpenIdEndpointNotFound);
@@ -408,7 +401,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// <exception cref="InvalidOperationException">Thrown if <see cref="HttpContext.Current">HttpContext.Current</see> == <c>null</c>.</exception>
public IAuthenticationRequest CreateRequest(Identifier userSuppliedIdentifier) {
Requires.NotNull(userSuppliedIdentifier, "userSuppliedIdentifier");
- Contract.Ensures(Contract.Result<IAuthenticationRequest>() != null);
try {
return this.CreateRequests(userSuppliedIdentifier).First();
} catch (InvalidOperationException ex) {
@@ -447,7 +439,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
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();
}
@@ -481,12 +472,10 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
RequiresEx.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
// at least an extra time.
- ////Contract.Ensures(Contract.ForAll(Contract.Result<IEnumerable<IAuthenticationRequest>>(), el => el != null));
-
+ ////
// Build the return_to URL
UriBuilder returnTo = new UriBuilder(this.Channel.GetRequestFromContext().GetPublicFacingUrl());
@@ -528,7 +517,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
public IEnumerable<IAuthenticationRequest> CreateRequests(Identifier userSuppliedIdentifier) {
Requires.NotNull(userSuppliedIdentifier, "userSuppliedIdentifier");
RequiresEx.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired);
- Contract.Ensures(Contract.Result<IEnumerable<IAuthenticationRequest>>() != null);
return this.CreateRequests(userSuppliedIdentifier, Realm.AutoDetect);
}
@@ -595,7 +583,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// </remarks>
public OutgoingWebResponse ProcessResponseFromPopup() {
RequiresEx.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired);
- Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null);
return this.ProcessResponseFromPopup(this.Channel.GetRequestFromContext());
}
@@ -607,7 +594,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// <returns>The HTTP response to send to this HTTP request.</returns>
public OutgoingWebResponse ProcessResponseFromPopup(HttpRequestBase request) {
Requires.NotNull(request, "request");
- Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null);
return this.ProcessResponseFromPopup(request, null);
}
@@ -694,7 +680,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
[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(HttpRequestBase request, Action<AuthenticationStatus> callback) {
Requires.NotNull(request, "request");
- Contract.Ensures(Contract.Result<OutgoingWebResponse>() != null);
string extensionsJson = null;
var authResponse = this.NonVerifyingRelyingParty.GetResponse();
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAnonymousResponse.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAnonymousResponse.cs
index 5f62e2d..6ec7d04 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAnonymousResponse.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAnonymousResponse.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Web;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponse.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponse.cs
index 9069221..509eb60 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponse.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponse.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Diagnostics;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Web;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponseSnapshot.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponseSnapshot.cs
index eb3d373..0e10087 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponseSnapshot.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/OpenId/RelyingParty/PositiveAuthenticationResponseSnapshot.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Text;
using System.Web;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId.RelyingParty/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OpenId.RelyingParty/Properties/AssemblyInfo.cs
index 4d35e76..e3bbc74 100644
--- a/src/DotNetOpenAuth.OpenId.RelyingParty/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OpenId.RelyingParty/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OpenId.UI/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OpenId.UI/Properties/AssemblyInfo.cs
index a488d1d..5a3a8a4 100644
--- a/src/DotNetOpenAuth.OpenId.UI/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OpenId.UI/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -33,8 +32,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OpenId.UI/XrdsPublisher.cs b/src/DotNetOpenAuth.OpenId.UI/XrdsPublisher.cs
index 87e3a8b..640bee7 100644
--- a/src/DotNetOpenAuth.OpenId.UI/XrdsPublisher.cs
+++ b/src/DotNetOpenAuth.OpenId.UI/XrdsPublisher.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth {
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Drawing.Design;
using System.Text;
using System.Web;
@@ -211,7 +210,7 @@ namespace DotNetOpenAuth {
/// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"/> object that receives the server control content.</param>
[SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "System.Diagnostics.Contracts.__ContractsRuntime.Assume(System.Boolean,System.String,System.String)", Justification = "Code contracts"), SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings", Justification = "Uri(Uri, string) accepts second arguments that Uri(Uri, new Uri(string)) does not that we must support.")]
protected override void Render(HtmlTextWriter writer) {
- Contract.Assume(writer != null, "Missing contract.");
+ Assumes.True(writer != null, "Missing contract.");
if (this.Enabled && this.Visible && !string.IsNullOrEmpty(this.XrdsUrl)) {
Uri xrdsAddress = new Uri(MessagingUtilities.GetRequestUrlFromContext(), Page.Response.ApplyAppPathModifier(this.XrdsUrl));
if ((this.XrdsAdvertisement & XrdsUrlLocations.HttpHeader) != 0) {
diff --git a/src/DotNetOpenAuth.OpenId/Configuration/AssociationTypeCollection.cs b/src/DotNetOpenAuth.OpenId/Configuration/AssociationTypeCollection.cs
index 419a76a..384497c 100644
--- a/src/DotNetOpenAuth.OpenId/Configuration/AssociationTypeCollection.cs
+++ b/src/DotNetOpenAuth.OpenId/Configuration/AssociationTypeCollection.cs
@@ -7,12 +7,10 @@
namespace DotNetOpenAuth.Configuration {
using System.Collections.Generic;
using System.Configuration;
- using System.Diagnostics.Contracts;
/// <summary>
/// Describes a collection of association type sub-elements in a .config file.
/// </summary>
- [ContractVerification(true)]
internal class AssociationTypeCollection : ConfigurationElementCollection, IEnumerable<AssociationTypeElement> {
/// <summary>
/// Initializes a new instance of the <see cref="AssociationTypeCollection"/> class.
diff --git a/src/DotNetOpenAuth.OpenId/Configuration/AssociationTypeElement.cs b/src/DotNetOpenAuth.OpenId/Configuration/AssociationTypeElement.cs
index 32c1cc9..c64913d 100644
--- a/src/DotNetOpenAuth.OpenId/Configuration/AssociationTypeElement.cs
+++ b/src/DotNetOpenAuth.OpenId/Configuration/AssociationTypeElement.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Configuration {
using System;
using System.Collections.Generic;
using System.Configuration;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
@@ -16,7 +15,6 @@ namespace DotNetOpenAuth.Configuration {
/// Describes an association type and its maximum lifetime as an element
/// in a .config file.
/// </summary>
- [ContractVerification(true)]
internal class AssociationTypeElement : ConfigurationElement {
/// <summary>
/// The name of the attribute that stores the association type.
diff --git a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdElement.cs b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdElement.cs
index 7d3007a..6c6ad10 100644
--- a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdElement.cs
+++ b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdElement.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Configuration {
using System;
using System.Collections.Generic;
using System.Configuration;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.OpenId.ChannelElements;
using DotNetOpenAuth.OpenId.Messages;
using Validation;
@@ -16,7 +15,6 @@ namespace DotNetOpenAuth.Configuration {
/// <summary>
/// Represents the &lt;openid&gt; element in the host's .config file.
/// </summary>
- [ContractVerification(true)]
internal class OpenIdElement : ConfigurationSection {
/// <summary>
/// The name of the section under which this library's settings must be found.
@@ -64,7 +62,6 @@ namespace DotNetOpenAuth.Configuration {
/// </summary>
public static OpenIdElement Configuration {
get {
- Contract.Ensures(Contract.Result<OpenIdElement>() != null);
return (OpenIdElement)ConfigurationManager.GetSection(SectionName) ?? new OpenIdElement();
}
}
@@ -81,9 +78,8 @@ namespace DotNetOpenAuth.Configuration {
[PositiveTimeSpanValidator]
internal TimeSpan MaxAuthenticationTime {
get {
- Contract.Ensures(Contract.Result<TimeSpan>() > TimeSpan.Zero);
TimeSpan result = (TimeSpan)this[MaxAuthenticationTimePropertyName];
- Contract.Assume(result > TimeSpan.Zero); // our PositiveTimeSpanValidator should take care of this
+ Assumes.True(result > TimeSpan.Zero); // our PositiveTimeSpanValidator should take care of this
return result;
}
diff --git a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdProviderElement.cs b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdProviderElement.cs
index df93d3b..dfa5a86 100644
--- a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdProviderElement.cs
+++ b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdProviderElement.cs
@@ -6,14 +6,12 @@
namespace DotNetOpenAuth.Configuration {
using System.Configuration;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Provider;
/// <summary>
/// The section in the .config file that allows customization of OpenID Provider behaviors.
/// </summary>
- [ContractVerification(true)]
internal class OpenIdProviderElement : ConfigurationElement {
/// <summary>
/// The name of the &lt;provider&gt; sub-element.
diff --git a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdProviderSecuritySettingsElement.cs b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdProviderSecuritySettingsElement.cs
index f003900..3579faa 100644
--- a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdProviderSecuritySettingsElement.cs
+++ b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdProviderSecuritySettingsElement.cs
@@ -6,14 +6,12 @@
namespace DotNetOpenAuth.Configuration {
using System.Configuration;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Provider;
/// <summary>
/// Represents the .config file element that allows for setting the security policies of the Provider.
/// </summary>
- [ContractVerification(true)]
internal class OpenIdProviderSecuritySettingsElement : ConfigurationElement {
/// <summary>
/// Gets the name of the @protectDownlevelReplayAttacks attribute.
@@ -111,7 +109,6 @@ namespace DotNetOpenAuth.Configuration {
[ConfigurationCollection(typeof(AssociationTypeCollection))]
public AssociationTypeCollection AssociationLifetimes {
get {
- Contract.Ensures(Contract.Result<AssociationTypeCollection>() != null);
return (AssociationTypeCollection)this[AssociationsConfigName] ?? new AssociationTypeCollection();
}
@@ -144,7 +141,7 @@ namespace DotNetOpenAuth.Configuration {
settings.UnsolicitedAssertionVerification = this.UnsolicitedAssertionVerification;
settings.EncodeAssociationSecretsInHandles = this.EncodeAssociationSecretsInHandles;
foreach (AssociationTypeElement element in this.AssociationLifetimes) {
- Contract.Assume(element != null);
+ Assumes.True(element != null);
settings.AssociationLifetimes.Add(element.AssociationType, element.MaximumLifetime);
}
diff --git a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartyElement.cs b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartyElement.cs
index 8af1129..681ba38 100644
--- a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartyElement.cs
+++ b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartyElement.cs
@@ -7,14 +7,12 @@
namespace DotNetOpenAuth.Configuration {
using System;
using System.Configuration;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.RelyingParty;
/// <summary>
/// The section in the .config file that allows customization of OpenID Relying Party behaviors.
/// </summary>
- [ContractVerification(true)]
internal class OpenIdRelyingPartyElement : ConfigurationElement {
/// <summary>
/// The name of the custom store sub-element.
diff --git a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartySecuritySettingsElement.cs b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartySecuritySettingsElement.cs
index f0d8942..a2e2c34 100644
--- a/src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartySecuritySettingsElement.cs
+++ b/src/DotNetOpenAuth.OpenId/Configuration/OpenIdRelyingPartySecuritySettingsElement.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Configuration {
using System;
using System.Configuration;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.RelyingParty;
@@ -238,8 +237,6 @@ namespace DotNetOpenAuth.Configuration {
/// </summary>
/// <returns>The newly created security settings object.</returns>
public RelyingPartySecuritySettings CreateSecuritySettings() {
- Contract.Ensures(Contract.Result<RelyingPartySecuritySettings>() != null);
-
RelyingPartySecuritySettings settings = new RelyingPartySecuritySettings();
settings.RequireSsl = this.RequireSsl;
settings.RequireDirectedIdentity = this.RequireDirectedIdentity;
diff --git a/src/DotNetOpenAuth.OpenId/DotNetOpenAuth.OpenId.csproj b/src/DotNetOpenAuth.OpenId/DotNetOpenAuth.OpenId.csproj
index 718b0b3..09beb3f 100644
--- a/src/DotNetOpenAuth.OpenId/DotNetOpenAuth.OpenId.csproj
+++ b/src/DotNetOpenAuth.OpenId/DotNetOpenAuth.OpenId.csproj
@@ -40,7 +40,6 @@
</Compile>
<Compile Include="OpenId\Behaviors\GsaIcamProfileBase.cs" />
<Compile Include="OpenId\ChannelElements\BackwardCompatibilityBindingElement.cs" />
- <Compile Include="OpenId\ChannelElements\SigningBindingElementContract.cs" />
<Compile Include="OpenId\ChannelElements\ExtensionsBindingElement.cs" />
<Compile Include="OpenId\ChannelElements\IOpenIdExtensionFactory.cs" />
<Compile Include="OpenId\ChannelElements\ITamperResistantOpenIdMessage.cs" />
@@ -50,7 +49,6 @@
<Compile Include="OpenId\ChannelElements\OpenIdChannel.cs" />
<Compile Include="OpenId\ChannelElements\ReturnToSignatureBindingElement.cs" />
<Compile Include="OpenId\ChannelElements\SkipSecurityBindingElement.cs" />
- <Compile Include="OpenId\AssociationContract.cs" />
<Compile Include="OpenId\Extensions\AliasManager.cs" />
<Compile Include="OpenId\Extensions\AttributeExchange\AttributeRequest.cs" />
<Compile Include="OpenId\Extensions\AttributeExchange\AttributeValues.cs" />
@@ -89,7 +87,6 @@
<Compile Include="OpenId\Extensions\UI\UIRequest.cs" />
<Compile Include="OpenId\Extensions\UI\UIUtilities.cs" />
<Compile Include="OpenId\Identifier.cs" />
- <Compile Include="OpenId\IdentifierContract.cs" />
<Compile Include="OpenId\Extensions\OpenIdExtensionsInteropHelper.cs" />
<Compile Include="OpenId\IdentifierDiscoveryResult.cs" />
<Compile Include="OpenId\IIdentifierDiscoveryService.cs" />
@@ -104,13 +101,11 @@
<Compile Include="OpenId\Provider\RelyingPartyDiscoveryResult.cs" />
<Compile Include="OpenId\RelyingParty\AuthenticationStatus.cs" />
<Compile Include="OpenId\RelyingParty\IAuthenticationRequest.cs" />
- <Compile Include="OpenId\RelyingParty\IAuthenticationRequestContract.cs" />
<Compile Include="OpenId\RelyingParty\IAuthenticationResponse.cs" />
<Compile Include="OpenId\RelyingParty\IRelyingPartyBehavior.cs" />
<Compile Include="OpenId\Messages\CheckAuthenticationRequest.cs" />
<Compile Include="OpenId\Messages\CheckAuthenticationResponse.cs" />
<Compile Include="OpenId\Messages\CheckIdRequest.cs" />
- <Compile Include="OpenId\Messages\AssociateSuccessfulResponseContract.cs" />
<Compile Include="OpenId\Messages\IErrorMessage.cs" />
<Compile Include="OpenId\Messages\IndirectResponseBase.cs" />
<Compile Include="OpenId\Messages\IndirectSignedResponse.cs" />
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Association.cs b/src/DotNetOpenAuth.OpenId/OpenId/Association.cs
index 4e927bd..502afb3 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Association.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Association.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId {
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.IO;
using System.Security.Cryptography;
using System.Text;
@@ -25,8 +24,6 @@ namespace DotNetOpenAuth.OpenId {
/// (dumb associations).
/// </remarks>
[DebuggerDisplay("Handle = {Handle}, Expires = {Expires}")]
- [ContractVerification(true)]
- [ContractClass(typeof(AssociationContract))]
public abstract class Association {
/// <summary>
/// Initializes a new instance of the <see cref="Association"/> class.
@@ -41,7 +38,6 @@ namespace DotNetOpenAuth.OpenId {
Requires.Range(totalLifeLength > TimeSpan.Zero, "totalLifeLength");
Requires.That(issued.Kind == DateTimeKind.Utc, "issued", "UTC time required.");
Requires.Range(issued <= DateTime.UtcNow, "issued");
- Contract.Ensures(this.TotalLifeLength == totalLifeLength);
this.Handle = handle;
this.SecretKey = secret;
@@ -94,7 +90,6 @@ namespace DotNetOpenAuth.OpenId {
/// </summary>
protected internal static TimeSpan DumbSecretLifetime {
get {
- Contract.Ensures(Contract.Result<TimeSpan>() > TimeSpan.Zero);
return OpenIdElement.Configuration.MaxAuthenticationTime;
}
}
@@ -105,7 +100,6 @@ namespace DotNetOpenAuth.OpenId {
/// </summary>
protected internal long SecondsTillExpiration {
get {
- Contract.Ensures(Contract.Result<long>() >= 0);
return Math.Max(0, (long)this.TimeTillExpiration.TotalSeconds);
}
}
@@ -131,7 +125,6 @@ namespace DotNetOpenAuth.OpenId {
/// </remarks>
private static TimeSpan MinimumUsefulAssociationLifetime {
get {
- Contract.Ensures(Contract.Result<TimeSpan>() > TimeSpan.Zero);
return OpenIdElement.Configuration.MaxAuthenticationTime;
}
}
@@ -165,7 +158,6 @@ namespace DotNetOpenAuth.OpenId {
public static Association Deserialize(string handle, DateTime expiresUtc, byte[] privateData) {
Requires.NotNullOrEmpty(handle, "handle");
Requires.NotNull(privateData, "privateData");
- Contract.Ensures(Contract.Result<Association>() != null);
expiresUtc = expiresUtc.ToUniversalTimeSafe();
TimeSpan remainingLifeLength = expiresUtc - DateTime.UtcNow;
@@ -192,8 +184,6 @@ namespace DotNetOpenAuth.OpenId {
/// in this byte array, as they are useful for fast database lookup and are persisted separately.
/// </remarks>
public byte[] SerializePrivateData() {
- Contract.Ensures(Contract.Result<byte[]>() != null);
-
// We may want to encrypt this secret using the machine.config private key,
// and add data regarding which Association derivative will need to be
// re-instantiated on deserialization.
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/AssociationContract.cs b/src/DotNetOpenAuth.OpenId/OpenId/AssociationContract.cs
deleted file mode 100644
index a04a612..0000000
--- a/src/DotNetOpenAuth.OpenId/OpenId/AssociationContract.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="AssociationContract.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.OpenId {
- using System;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
- using System.IO;
- using System.Security.Cryptography;
- using System.Text;
- using DotNetOpenAuth.Configuration;
- using DotNetOpenAuth.Messaging;
- using Validation;
-
- /// <summary>
- /// Code contract for the <see cref="Association"/> class.
- /// </summary>
- [ContractClassFor(typeof(Association))]
- internal abstract class AssociationContract : Association {
- /// <summary>
- /// Prevents a default instance of the <see cref="AssociationContract"/> class from being created.
- /// </summary>
- private AssociationContract()
- : base(null, null, TimeSpan.Zero, DateTime.Now) {
- }
-
- /// <summary>
- /// Gets the length (in bits) of the hash this association creates when signing.
- /// </summary>
- public override int HashBitLength {
- get {
- Contract.Ensures(Contract.Result<int>() > 0);
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// The string to pass as the assoc_type value in the OpenID protocol.
- /// </summary>
- /// <param name="protocol">The protocol version of the message that the assoc_type value will be included in.</param>
- /// <returns>
- /// The value that should be used for the openid.assoc_type parameter.
- /// </returns>
- [Pure]
- internal override string GetAssociationType(Protocol protocol) {
- Requires.NotNull(protocol, "protocol");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Returns the specific hash algorithm used for message signing.
- /// </summary>
- /// <returns>
- /// The hash algorithm used for message signing.
- /// </returns>
- [Pure]
- protected override HashAlgorithm CreateHasher() {
- Contract.Ensures(Contract.Result<HashAlgorithm>() != null);
- throw new NotImplementedException();
- }
- }
-}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/GsaIcamProfileBase.cs b/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/GsaIcamProfileBase.cs
index c7352c8..a51e844 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/GsaIcamProfileBase.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Behaviors/GsaIcamProfileBase.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Behaviors {
using System;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Configuration;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/ExtensionsBindingElement.cs b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/ExtensionsBindingElement.cs
index 5e2da99..f24c8b4 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/ExtensionsBindingElement.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/ExtensionsBindingElement.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/KeyValueFormEncoding.cs b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/KeyValueFormEncoding.cs
index 88b8a3c..6ad66c0 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/KeyValueFormEncoding.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/KeyValueFormEncoding.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Text;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/OpenIdChannel.cs b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/OpenIdChannel.cs
index 35339d1..5a6b8bb 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/OpenIdChannel.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/OpenIdChannel.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -23,7 +22,6 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
/// <summary>
/// A channel that knows how to send and receive OpenID messages.
/// </summary>
- [ContractVerification(true)]
internal class OpenIdChannel : Channel {
/// <summary>
/// The HTTP Content-Type to use in Key-Value Form responses.
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/ReturnToSignatureBindingElement.cs b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/ReturnToSignatureBindingElement.cs
index 2e5e01e..726c01f 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/ReturnToSignatureBindingElement.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/ReturnToSignatureBindingElement.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
- using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using System.Web;
using DotNetOpenAuth.Configuration;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/SigningBindingElement.cs b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/SigningBindingElement.cs
index d5d2cd5..584b0e9 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/SigningBindingElement.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/SigningBindingElement.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
using System;
using System.Collections.Generic;
using System.Diagnostics;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Net.Security;
@@ -23,7 +22,6 @@ namespace DotNetOpenAuth.OpenId.ChannelElements {
/// <summary>
/// Signs and verifies authentication assertions.
/// </summary>
- [ContractClass(typeof(SigningBindingElementContract))]
internal abstract class SigningBindingElement : IChannelBindingElement {
#region IChannelBindingElement Properties
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/SigningBindingElementContract.cs b/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/SigningBindingElementContract.cs
deleted file mode 100644
index c4e06d4..0000000
--- a/src/DotNetOpenAuth.OpenId/OpenId/ChannelElements/SigningBindingElementContract.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="SigningBindingElementContract.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.OpenId.ChannelElements {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.Contracts;
- using System.Globalization;
- using System.Linq;
- using System.Net.Security;
- using System.Web;
- using DotNetOpenAuth.Loggers;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.Messaging.Bindings;
- using DotNetOpenAuth.Messaging.Reflection;
- using DotNetOpenAuth.OpenId.Messages;
- using Validation;
-
- /// <summary>
- /// Code contract for the <see cref="SigningBindingElement"/> class.
- /// </summary>
- [ContractClassFor(typeof(SigningBindingElement))]
- internal abstract class SigningBindingElementContract : SigningBindingElement {
- /// <summary>
- /// Verifies the signature by unrecognized handle.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="signedMessage">The signed message.</param>
- /// <param name="protectionsApplied">The protections applied.</param>
- /// <returns>
- /// The applied protections.
- /// </returns>
- protected override MessageProtections VerifySignatureByUnrecognizedHandle(IProtocolMessage message, ITamperResistantOpenIdMessage signedMessage, MessageProtections protectionsApplied) {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets the association to use to sign or verify a message.
- /// </summary>
- /// <param name="signedMessage">The message to sign or verify.</param>
- /// <returns>
- /// The association to use to sign or verify the message.
- /// </returns>
- protected override Association GetAssociation(ITamperResistantOpenIdMessage signedMessage) {
- Requires.NotNull(signedMessage, "signedMessage");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets a specific association referenced in a given message's association handle.
- /// </summary>
- /// <param name="signedMessage">The signed message whose association handle should be used to lookup the association to return.</param>
- /// <returns>
- /// The referenced association; or <c>null</c> if such an association cannot be found.
- /// </returns>
- protected override Association GetSpecificAssociation(ITamperResistantOpenIdMessage signedMessage) {
- Requires.NotNull(signedMessage, "signedMessage");
- throw new NotImplementedException();
- }
- }
-}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/DiffieHellmanUtilities.cs b/src/DotNetOpenAuth.OpenId/OpenId/DiffieHellmanUtilities.cs
index a7ab7dc..6f7fc31 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/DiffieHellmanUtilities.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/DiffieHellmanUtilities.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Security.Cryptography;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AliasManager.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AliasManager.cs
index 5010e5d..94f7762 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AliasManager.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AliasManager.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Extensions {
using System;
using System.Collections.Generic;
using System.Diagnostics;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AXUtilities.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AXUtilities.cs
index 4155371..539e570 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AXUtilities.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AXUtilities.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Extensions.AttributeExchange {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using DotNetOpenAuth.Messaging;
using Validation;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AttributeRequest.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AttributeRequest.cs
index c75cd56..06ddb45 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AttributeRequest.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AttributeRequest.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Extensions.AttributeExchange {
using System;
using System.Diagnostics;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using Validation;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AttributeValues.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AttributeValues.cs
index 017ba5d..2aea683 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AttributeValues.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/AttributeValues.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Extensions.AttributeExchange {
using System;
using System.Collections.Generic;
using System.Diagnostics;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using Validation;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/FetchRequest.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/FetchRequest.cs
index ff47ee6..083d19c 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/FetchRequest.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/FetchRequest.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Extensions.AttributeExchange {
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using DotNetOpenAuth.Messaging;
@@ -69,7 +68,6 @@ namespace DotNetOpenAuth.OpenId.Extensions.AttributeExchange {
/// is all the attribute request details.</value>
public KeyedCollection<string, AttributeRequest> Attributes {
get {
- Contract.Ensures(Contract.Result<KeyedCollection<string, AttributeRequest>>() != null);
return this.attributes;
}
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/FetchResponse.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/FetchResponse.cs
index d5633c3..425b5e2 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/FetchResponse.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/AttributeExchange/FetchResponse.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Extensions.AttributeExchange {
using System;
using System.Collections.ObjectModel;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Messages;
@@ -54,7 +53,6 @@ namespace DotNetOpenAuth.OpenId.Extensions.AttributeExchange {
/// </summary>
public KeyedCollection<string, AttributeValues> Attributes {
get {
- Contract.Ensures(Contract.Result<KeyedCollection<string, AttributeValues>>() != null);
return this.attributesProvided;
}
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ExtensionArgumentsManager.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ExtensionArgumentsManager.cs
index d6e15fb..f3fa7f2 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ExtensionArgumentsManager.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ExtensionArgumentsManager.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Extensions {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/OpenIdExtensionFactoryAggregator.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/OpenIdExtensionFactoryAggregator.cs
index 2b851dd..ddd60f3 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/OpenIdExtensionFactoryAggregator.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/OpenIdExtensionFactoryAggregator.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId.Extensions {
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.ChannelElements;
using DotNetOpenAuth.OpenId.Messages;
@@ -70,7 +69,6 @@ namespace DotNetOpenAuth.OpenId.Extensions {
/// </summary>
/// <returns>A new instance of <see cref="OpenIdExtensionFactoryAggregator"/>.</returns>
internal static OpenIdExtensionFactoryAggregator LoadFromConfiguration() {
- Contract.Ensures(Contract.Result<OpenIdExtensionFactoryAggregator>() != null);
var factoriesElement = DotNetOpenAuth.Configuration.OpenIdElement.Configuration.ExtensionFactories;
var aggregator = new OpenIdExtensionFactoryAggregator();
aggregator.Factories.Add(new StandardOpenIdExtensionFactory());
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/OpenIdExtensionsInteropHelper.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/OpenIdExtensionsInteropHelper.cs
index 228a992..d90dd2a 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/OpenIdExtensionsInteropHelper.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/OpenIdExtensionsInteropHelper.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Extensions {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ProviderAuthenticationPolicy/PapeUtilities.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ProviderAuthenticationPolicy/PapeUtilities.cs
index 0a80b4d..e9e8e95 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ProviderAuthenticationPolicy/PapeUtilities.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ProviderAuthenticationPolicy/PapeUtilities.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Text;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyResponse.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyResponse.cs
index 60f7ff6..d764118 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyResponse.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/ProviderAuthenticationPolicy/PolicyResponse.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Extensions.ProviderAuthenticationPolicy {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Messages;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsRequest.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsRequest.cs
index c83fb60..f6fd620 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsRequest.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsRequest.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.OpenId.Extensions.SimpleRegistration {
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsResponse.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsResponse.cs
index 061279e..361910d 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsResponse.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/SimpleRegistration/ClaimsResponse.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Extensions.SimpleRegistration {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Net.Mail;
using System.Text;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/UI/UIRequest.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/UI/UIRequest.cs
index 0902a00..731ca1c 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/UI/UIRequest.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/UI/UIRequest.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Extensions.UI {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/UI/UIUtilities.cs b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/UI/UIUtilities.cs
index 19e333d..1f48ce3 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Extensions/UI/UIUtilities.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Extensions/UI/UIUtilities.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId.Extensions.UI {
using System;
- using System.Diagnostics.Contracts;
using System.Globalization;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.RelyingParty;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/HmacShaAssociation.cs b/src/DotNetOpenAuth.OpenId/OpenId/HmacShaAssociation.cs
index 59dbd37..2eaa8cf 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/HmacShaAssociation.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/HmacShaAssociation.cs
@@ -20,7 +20,6 @@ namespace DotNetOpenAuth.OpenId {
/// <summary>
/// An association that uses the HMAC-SHA family of algorithms for message signing.
/// </summary>
- [ContractVerification(true)]
internal class HmacShaAssociation : Association {
/// <summary>
/// A list of HMAC-SHA algorithms in order of decreasing bit lengths.
@@ -45,7 +44,6 @@ namespace DotNetOpenAuth.OpenId {
Requires.NotNullOrEmpty(handle, "handle");
Requires.NotNull(secret, "secret");
Requires.Range(totalLifeLength > TimeSpan.Zero, "totalLifeLength");
- Contract.Ensures(this.TotalLifeLength == totalLifeLength);
ErrorUtilities.VerifyProtocol(secret.Length == typeIdentity.SecretLength, OpenIdStrings.AssociationSecretAndTypeLengthMismatch, secret.Length, typeIdentity.GetAssociationType(Protocol.Default));
this.typeIdentity = typeIdentity;
@@ -74,7 +72,6 @@ namespace DotNetOpenAuth.OpenId {
Requires.NotNull(protocol, "protocol");
Requires.NotNullOrEmpty(associationType, "associationType");
Requires.NotNull(secret, "secret");
- Contract.Ensures(Contract.Result<HmacShaAssociation>() != null);
HmacSha match = hmacShaAssociationTypes.FirstOrDefault(sha => string.Equals(sha.GetAssociationType(protocol), associationType, StringComparison.Ordinal));
ErrorUtilities.VerifyProtocol(match != null, OpenIdStrings.NoAssociationTypeFoundByName, associationType);
return new HmacShaAssociation(match, handle, secret, totalLifeLength);
@@ -90,7 +87,6 @@ namespace DotNetOpenAuth.OpenId {
public static HmacShaAssociation Create(string handle, byte[] secret, TimeSpan totalLifeLength) {
Requires.NotNullOrEmpty(handle, "handle");
Requires.NotNull(secret, "secret");
- Contract.Ensures(Contract.Result<HmacShaAssociation>() != null);
HmacSha shaType = hmacShaAssociationTypes.FirstOrDefault(sha => sha.SecretLength == secret.Length);
ErrorUtilities.VerifyProtocol(shaType != null, OpenIdStrings.NoAssociationTypeFoundByLength, secret.Length);
@@ -212,7 +208,7 @@ namespace DotNetOpenAuth.OpenId {
[Pure]
protected override HashAlgorithm CreateHasher() {
var result = this.typeIdentity.CreateHasher(SecretKey);
- Contract.Assume(result != null);
+ Assumes.True(result != null);
return result;
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/IIdentifierDiscoveryService.cs b/src/DotNetOpenAuth.OpenId/OpenId/IIdentifierDiscoveryService.cs
index 13465a1..20b8f1c 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/IIdentifierDiscoveryService.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/IIdentifierDiscoveryService.cs
@@ -18,7 +18,6 @@ namespace DotNetOpenAuth.OpenId {
/// <summary>
/// A module that provides discovery services for OpenID identifiers.
/// </summary>
- [ContractClass(typeof(IIdentifierDiscoveryServiceContract))]
public interface IIdentifierDiscoveryService {
/// <summary>
/// Performs discovery on the specified identifier.
@@ -33,36 +32,4 @@ namespace DotNetOpenAuth.OpenId {
[Pure]
IEnumerable<IdentifierDiscoveryResult> Discover(Identifier identifier, IDirectWebRequestHandler requestHandler, out bool abortDiscoveryChain);
}
-
- /// <summary>
- /// Code contract for the <see cref="IIdentifierDiscoveryService"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IIdentifierDiscoveryService))]
- internal abstract class IIdentifierDiscoveryServiceContract : IIdentifierDiscoveryService {
- /// <summary>
- /// Prevents a default instance of the <see cref="IIdentifierDiscoveryServiceContract"/> class from being created.
- /// </summary>
- private IIdentifierDiscoveryServiceContract() {
- }
-
- #region IDiscoveryService Members
-
- /// <summary>
- /// Performs discovery on the specified identifier.
- /// </summary>
- /// <param name="identifier">The identifier to perform discovery on.</param>
- /// <param name="requestHandler">The means to place outgoing HTTP requests.</param>
- /// <param name="abortDiscoveryChain">if set to <c>true</c>, no further discovery services will be called for this identifier.</param>
- /// <returns>
- /// A sequence of service endpoints yielded by discovery. Must not be null, but may be empty.
- /// </returns>
- IEnumerable<IdentifierDiscoveryResult> IIdentifierDiscoveryService.Discover(Identifier identifier, IDirectWebRequestHandler requestHandler, out bool abortDiscoveryChain) {
- Requires.NotNull(identifier, "identifier");
- Requires.NotNull(requestHandler, "requestHandler");
- Contract.Ensures(Contract.Result<IEnumerable<IdentifierDiscoveryResult>>() != null);
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/IProviderEndpoint.cs b/src/DotNetOpenAuth.OpenId/OpenId/IProviderEndpoint.cs
index 0888eeb..b5c1c03 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/IProviderEndpoint.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/IProviderEndpoint.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Messages;
@@ -21,7 +20,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// Because information provided by this interface is suppplied by a
/// user's individually published documents, it may be incomplete or inaccurate.
/// </remarks>
- [ContractClass(typeof(IProviderEndpointContract))]
public interface IProviderEndpoint {
/// <summary>
/// Gets the detected version of OpenID implemented by the Provider.
@@ -67,77 +65,4 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
[Obsolete("Use IAuthenticationRequest.DiscoveryResult.IsExtensionSupported instead.")]
bool IsExtensionSupported(Type extensionType);
}
-
- /// <summary>
- /// Code contract for the <see cref="IProviderEndpoint"/> type.
- /// </summary>
- [ContractClassFor(typeof(IProviderEndpoint))]
- internal abstract class IProviderEndpointContract : IProviderEndpoint {
- /// <summary>
- /// Prevents a default instance of the <see cref="IProviderEndpointContract"/> class from being created.
- /// </summary>
- private IProviderEndpointContract() {
- }
-
- #region IProviderEndpoint Members
-
- /// <summary>
- /// Gets the detected version of OpenID implemented by the Provider.
- /// </summary>
- Version IProviderEndpoint.Version {
- get {
- Contract.Ensures(Contract.Result<Version>() != null);
- throw new System.NotImplementedException();
- }
- }
-
- /// <summary>
- /// Gets the URL that the OpenID Provider receives authentication requests at.
- /// </summary>
- Uri IProviderEndpoint.Uri {
- get {
- Contract.Ensures(Contract.Result<Uri>() != null);
- throw new System.NotImplementedException();
- }
- }
-
- /// <summary>
- /// Checks whether the OpenId Identifier claims support for a given extension.
- /// </summary>
- /// <typeparam name="T">The extension whose support is being queried.</typeparam>
- /// <returns>
- /// True if support for the extension is advertised. False otherwise.
- /// </returns>
- /// <remarks>
- /// Note that a true or false return value is no guarantee of a Provider's
- /// support for or lack of support for an extension. The return value is
- /// determined by how the authenticating user filled out his/her XRDS document only.
- /// The only way to be sure of support for a given extension is to include
- /// the extension in the request and see if a response comes back for that extension.
- /// </remarks>
- bool IProviderEndpoint.IsExtensionSupported<T>() {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Checks whether the OpenId Identifier claims support for a given extension.
- /// </summary>
- /// <param name="extensionType">The extension whose support is being queried.</param>
- /// <returns>
- /// True if support for the extension is advertised. False otherwise.
- /// </returns>
- /// <remarks>
- /// Note that a true or false return value is no guarantee of a Provider's
- /// support for or lack of support for an extension. The return value is
- /// determined by how the authenticating user filled out his/her XRDS document only.
- /// The only way to be sure of support for a given extension is to include
- /// the extension in the request and see if a response comes back for that extension.
- /// </remarks>
- bool IProviderEndpoint.IsExtensionSupported(Type extensionType) {
- RequiresEx.NotNullSubtype<IOpenIdMessageExtension>(extensionType, "extensionType");
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Identifier.cs b/src/DotNetOpenAuth.OpenId/OpenId/Identifier.cs
index 7c08e66..310ebd2 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Identifier.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Identifier.cs
@@ -18,9 +18,7 @@ namespace DotNetOpenAuth.OpenId {
/// An Identifier is either a "http" or "https" URI, or an XRI.
/// </summary>
[Serializable]
- [ContractVerification(true)]
[Pure]
- [ContractClass(typeof(IdentifierContract))]
[DefaultEncoder(typeof(IdentifierEncoder))]
public abstract class Identifier {
/// <summary>
@@ -94,7 +92,6 @@ namespace DotNetOpenAuth.OpenId {
[DebuggerStepThrough]
public static implicit operator Identifier(string identifier) {
Requires.That(identifier == null || identifier.Length > 0, "identifier", "Empty string cannot be translated to an identifier.");
- Contract.Ensures((identifier == null) == (Contract.Result<Identifier>() == null));
if (identifier == null) {
return null;
@@ -110,7 +107,6 @@ namespace DotNetOpenAuth.OpenId {
[SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Justification = "We have a Parse function.")]
[DebuggerStepThrough]
public static implicit operator Identifier(Uri identifier) {
- Contract.Ensures((identifier == null) == (Contract.Result<Identifier>() == null));
if (identifier == null) {
return null;
}
@@ -126,7 +122,6 @@ namespace DotNetOpenAuth.OpenId {
[SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates", Justification = "We have a Parse function.")]
[DebuggerStepThrough]
public static implicit operator string(Identifier identifier) {
- Contract.Ensures((identifier == null) == (Contract.Result<string>() == null));
if (identifier == null) {
return null;
}
@@ -142,7 +137,6 @@ namespace DotNetOpenAuth.OpenId {
[SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings", Justification = "Some of these identifiers are not properly formatted to be Uris at this stage.")]
public static Identifier Parse(string identifier) {
Requires.NotNullOrEmpty(identifier, "identifier");
- Contract.Ensures(Contract.Result<Identifier>() != null);
return Parse(identifier, false);
}
@@ -159,7 +153,6 @@ namespace DotNetOpenAuth.OpenId {
[SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings", Justification = "Some of these identifiers are not properly formatted to be Uris at this stage.")]
public static Identifier Parse(string identifier, bool serializeExactValue) {
Requires.NotNullOrEmpty(identifier, "identifier");
- Contract.Ensures(Contract.Result<Identifier>() != null);
Identifier id;
if (XriIdentifier.IsValidXri(identifier)) {
@@ -266,7 +259,6 @@ namespace DotNetOpenAuth.OpenId {
/// <returns>Either <see cref="XriIdentifier"/> or <see cref="UriIdentifier"/>.</returns>
internal static Identifier Reparse(Identifier identifier) {
Requires.NotNull(identifier, "identifier");
- Contract.Ensures(Contract.Result<Identifier>() != null);
return Parse(identifier, identifier.IsDeserializedInstance);
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/IdentifierContract.cs b/src/DotNetOpenAuth.OpenId/OpenId/IdentifierContract.cs
deleted file mode 100644
index 0156d12..0000000
--- a/src/DotNetOpenAuth.OpenId/OpenId/IdentifierContract.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="IdentifierContract.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.OpenId {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.Contracts;
- using DotNetOpenAuth.Messaging;
-
- /// <summary>
- /// Code Contract for the <see cref="Identifier"/> class.
- /// </summary>
- [ContractClassFor(typeof(Identifier))]
- internal abstract class IdentifierContract : Identifier {
- /// <summary>
- /// Prevents a default instance of the IdentifierContract class from being created.
- /// </summary>
- private IdentifierContract()
- : base(null, false) {
- }
-
- /// <summary>
- /// Returns an <see cref="Identifier"/> that has no URI fragment.
- /// Quietly returns the original <see cref="Identifier"/> if it is not
- /// a <see cref="UriIdentifier"/> or no fragment exists.
- /// </summary>
- /// <returns>
- /// A new <see cref="Identifier"/> instance if there was a
- /// fragment to remove, otherwise this same instance..
- /// </returns>
- internal override Identifier TrimFragment() {
- Contract.Ensures(Contract.Result<Identifier>() != null);
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Converts a given identifier to its secure equivalent.
- /// UriIdentifiers originally created with an implied HTTP scheme change to HTTPS.
- /// Discovery is made to require SSL for the entire resolution process.
- /// </summary>
- /// <param name="secureIdentifier">The newly created secure identifier.
- /// If the conversion fails, <paramref name="secureIdentifier"/> retains
- /// <i>this</i> identifiers identity, but will never discover any endpoints.</param>
- /// <returns>
- /// True if the secure conversion was successful.
- /// False if the Identifier was originally created with an explicit HTTP scheme.
- /// </returns>
- internal override bool TryRequireSsl(out Identifier secureIdentifier) {
- Contract.Ensures(Contract.ValueAtReturn(out secureIdentifier) != null);
- throw new NotImplementedException();
- }
- }
-}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/IdentifierDiscoveryResult.cs b/src/DotNetOpenAuth.OpenId/OpenId/IdentifierDiscoveryResult.cs
index 9cd2eb9..c7eabf0 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/IdentifierDiscoveryResult.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/IdentifierDiscoveryResult.cs
@@ -10,7 +10,6 @@ namespace DotNetOpenAuth.OpenId {
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Linq;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/IdentifierDiscoveryServices.cs b/src/DotNetOpenAuth.OpenId/OpenId/IdentifierDiscoveryServices.cs
index 6cc3831..1b20d4e 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/IdentifierDiscoveryServices.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/IdentifierDiscoveryServices.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId {
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Configuration;
using DotNetOpenAuth.Messaging;
@@ -51,7 +50,6 @@ namespace DotNetOpenAuth.OpenId {
/// <returns>A non-null sequence of services discovered for the identifier.</returns>
public IEnumerable<IdentifierDiscoveryResult> Discover(Identifier identifier) {
Requires.NotNull(identifier, "identifier");
- Contract.Ensures(Contract.Result<IEnumerable<IdentifierDiscoveryResult>>() != null);
IEnumerable<IdentifierDiscoveryResult> results = Enumerable.Empty<IdentifierDiscoveryResult>();
foreach (var discoverer in this.DiscoveryServices) {
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateDiffieHellmanResponse.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateDiffieHellmanResponse.cs
index 3860565..1510e97 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateDiffieHellmanResponse.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateDiffieHellmanResponse.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId.Messages {
using System;
- using System.Diagnostics.Contracts;
using System.Security.Cryptography;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Reflection;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateRequest.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateRequest.cs
index 1e716e2..1eaf7b6 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateRequest.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateRequest.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Collections.Generic;
using System.Diagnostics;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateSuccessfulResponse.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateSuccessfulResponse.cs
index 6605530..8daafbd 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateSuccessfulResponse.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateSuccessfulResponse.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Collections.Generic;
using System.Diagnostics;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -20,7 +19,6 @@ namespace DotNetOpenAuth.OpenId.Messages {
/// Association response messages are described in OpenID 2.0 section 8.2. This type covers section 8.2.1.
/// </remarks>
[DebuggerDisplay("OpenID {Version} associate response {AssociationHandle} {AssociationType} {SessionType}")]
- [ContractClass(typeof(AssociateSuccessfulResponseContract))]
internal abstract class AssociateSuccessfulResponse : DirectResponseBase {
/// <summary>
/// Initializes a new instance of the <see cref="AssociateSuccessfulResponse"/> class.
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateSuccessfulResponseContract.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateSuccessfulResponseContract.cs
deleted file mode 100644
index 39a79a4..0000000
--- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateSuccessfulResponseContract.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// <auto-generated />
-
-namespace DotNetOpenAuth.OpenId.Messages {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.Contracts;
- using System.Linq;
- using System.Text;
- using DotNetOpenAuth.Messaging;
-
- [ContractClassFor(typeof(AssociateSuccessfulResponse))]
- internal abstract class AssociateSuccessfulResponseContract : AssociateSuccessfulResponse {
- protected AssociateSuccessfulResponseContract() : base(null, null) {
- }
- }
-}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/CheckAuthenticationRequest.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/CheckAuthenticationRequest.cs
index bcc87c1..93cf9d7 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/CheckAuthenticationRequest.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Messages/CheckAuthenticationRequest.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/CheckAuthenticationResponse.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/CheckAuthenticationResponse.cs
index 9c31ea5..ee9a0b0 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/CheckAuthenticationResponse.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Messages/CheckAuthenticationResponse.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/DirectResponseBase.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/DirectResponseBase.cs
index 4014dc2..a081159 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/DirectResponseBase.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Messages/DirectResponseBase.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.OpenId.Messages {
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using Validation;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/IOpenIdMessageExtension.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/IOpenIdMessageExtension.cs
index dabb752..a7e2268 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/IOpenIdMessageExtension.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Messages/IOpenIdMessageExtension.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -20,7 +19,6 @@ namespace DotNetOpenAuth.OpenId.Messages {
/// [<see cref="SerializableAttribute"/>] to allow serializing state servers
/// to cache messages, particularly responses.
/// </remarks>
- [ContractClass(typeof(IOpenIdMessageExtensionContract))]
public interface IOpenIdMessageExtension : IExtensionMessage {
/// <summary>
/// Gets the TypeURI the extension uses in the OpenID protocol and in XRDS advertisements.
@@ -53,108 +51,4 @@ namespace DotNetOpenAuth.OpenId.Messages {
/// </value>
bool IsSignedByRemoteParty { get; set; }
}
-
- /// <summary>
- /// Code contract class for the IOpenIdMessageExtension interface.
- /// </summary>
- [ContractClassFor(typeof(IOpenIdMessageExtension))]
- internal abstract class IOpenIdMessageExtensionContract : IOpenIdMessageExtension {
- /// <summary>
- /// Prevents a default instance of the <see cref="IOpenIdMessageExtensionContract"/> class from being created.
- /// </summary>
- private IOpenIdMessageExtensionContract() {
- }
-
- #region IOpenIdMessageExtension Members
-
- /// <summary>
- /// Gets the TypeURI the extension uses in the OpenID protocol and in XRDS advertisements.
- /// </summary>
- string IOpenIdMessageExtension.TypeUri {
- get {
- Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>()));
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// Gets the additional TypeURIs that are supported by this extension, in preferred order.
- /// May be empty if none other than <see cref="IOpenIdMessageExtension.TypeUri"/> is supported, but
- /// should not be null.
- /// </summary>
- /// <remarks>
- /// Useful for reading in messages with an older version of an extension.
- /// The value in the <see cref="IOpenIdMessageExtension.TypeUri"/> property is always checked before
- /// trying this list.
- /// If you do support multiple versions of an extension using this method,
- /// consider adding a CreateResponse method to your request extension class
- /// so that the response can have the context it needs to remain compatible
- /// given the version of the extension in the request message.
- /// The <see cref="Extensions.SimpleRegistration.ClaimsRequest.CreateResponse"/> for an example.
- /// </remarks>
- IEnumerable<string> IOpenIdMessageExtension.AdditionalSupportedTypeUris {
- get {
- Contract.Ensures(Contract.Result<IEnumerable<string>>() != null);
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether this extension was
- /// signed by the sender.
- /// </summary>
- /// <value>
- /// <c>true</c> if this instance is signed by the sender; otherwise, <c>false</c>.
- /// </value>
- bool IOpenIdMessageExtension.IsSignedByRemoteParty {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- #endregion
-
- #region IMessage Members
-
- /// <summary>
- /// Gets the version of the protocol or extension this message is prepared to implement.
- /// </summary>
- /// <remarks>
- /// Implementations of this interface should ensure that this property never returns null.
- /// </remarks>
- Version IMessage.Version {
- get {
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// Gets the extra, non-standard Protocol parameters included in the message.
- /// </summary>
- /// <remarks>
- /// Implementations of this interface should ensure that this property never returns null.
- /// </remarks>
- IDictionary<string, string> IMessage.ExtraData {
- get {
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// Checks the message state for conformity to the protocol specification
- /// and throws an exception if the message is invalid.
- /// </summary>
- /// <remarks>
- /// <para>Some messages have required fields, or combinations of fields that must relate to each other
- /// in specialized ways. After deserializing a message, this method checks the state of the
- /// message to see if it conforms to the protocol.</para>
- /// <para>Note that this property should <i>not</i> check signatures or perform any state checks
- /// outside this scope of this particular message.</para>
- /// </remarks>
- /// <exception cref="ProtocolException">Thrown if the message is invalid.</exception>
- void IMessage.EnsureValidMessage() {
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/IndirectResponseBase.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/IndirectResponseBase.cs
index 61158bd..cd56175 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/IndirectResponseBase.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Messages/IndirectResponseBase.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/IndirectSignedResponse.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/IndirectSignedResponse.cs
index 1072a99..51d6805 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/IndirectSignedResponse.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Messages/IndirectSignedResponse.cs
@@ -10,7 +10,6 @@ namespace DotNetOpenAuth.OpenId.Messages {
using System.Collections.Specialized;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Net.Security;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/NegativeAssertionResponse.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/NegativeAssertionResponse.cs
index 9ce9f68..9aac107 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/NegativeAssertionResponse.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Messages/NegativeAssertionResponse.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/RequestBase.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/RequestBase.cs
index 779e666..f91dc96 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/RequestBase.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Messages/RequestBase.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.OpenId.Messages {
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using Validation;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/SignedResponseRequest.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/SignedResponseRequest.cs
index 2755deb..688bb40 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/SignedResponseRequest.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Messages/SignedResponseRequest.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Messages {
using System;
using System.Collections.Generic;
using System.Diagnostics;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/NoDiscoveryIdentifier.cs b/src/DotNetOpenAuth.OpenId/OpenId/NoDiscoveryIdentifier.cs
index e32f8c7..aa12067 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/NoDiscoveryIdentifier.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/NoDiscoveryIdentifier.cs
@@ -15,7 +15,6 @@ namespace DotNetOpenAuth.OpenId {
/// <summary>
/// Wraps an existing Identifier and prevents it from performing discovery.
/// </summary>
- [ContractVerification(true)]
[Pure]
internal class NoDiscoveryIdentifier : Identifier {
/// <summary>
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/OpenIdUtilities.cs b/src/DotNetOpenAuth.OpenId/OpenId/OpenIdUtilities.cs
index af9e12a..e04a633 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/OpenIdUtilities.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/OpenIdUtilities.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -70,8 +69,6 @@ namespace DotNetOpenAuth.OpenId {
/// </summary>
/// <returns>The association handle.</returns>
public static string GenerateRandomAssociationHandle() {
- Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>()));
-
// Generate the handle. It must be unique, and preferably unpredictable,
// so we use a time element and a random data element to generate it.
string uniq = MessagingUtilities.GetCryptoRandomDataAsBase64(4);
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/OpenIdXrdsHelper.cs b/src/DotNetOpenAuth.OpenId/OpenId/OpenIdXrdsHelper.cs
index f38a1f3..4fca2af 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/OpenIdXrdsHelper.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/OpenIdXrdsHelper.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Xrds;
@@ -28,7 +27,6 @@ namespace DotNetOpenAuth.OpenId {
/// </remarks>
internal static IEnumerable<RelyingPartyEndpointDescription> FindRelyingPartyReceivingEndpoints(this XrdsDocument xrds) {
Requires.NotNull(xrds, "xrds");
- Contract.Ensures(Contract.Result<IEnumerable<RelyingPartyEndpointDescription>>() != null);
return from service in xrds.FindReturnToServices()
from uri in service.UriElements
@@ -43,7 +41,6 @@ namespace DotNetOpenAuth.OpenId {
/// <returns>A sequence of the icon URLs in preferred order.</returns>
internal static IEnumerable<Uri> FindRelyingPartyIcons(this XrdsDocument xrds) {
Requires.NotNull(xrds, "xrds");
- Contract.Ensures(Contract.Result<IEnumerable<Uri>>() != null);
return from xrd in xrds.XrdElements
from service in xrd.OpenIdRelyingPartyIcons
@@ -59,7 +56,6 @@ namespace DotNetOpenAuth.OpenId {
/// <returns>A sequence of service elements.</returns>
private static IEnumerable<ServiceElement> FindReturnToServices(this XrdsDocument xrds) {
Requires.NotNull(xrds, "xrds");
- Contract.Ensures(Contract.Result<IEnumerable<ServiceElement>>() != null);
return from xrd in xrds.XrdElements
from service in xrd.OpenIdRelyingPartyReturnToServices
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Protocol.cs b/src/DotNetOpenAuth.OpenId/OpenId/Protocol.cs
index c744c09..7ef3ab5 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Protocol.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Protocol.cs
@@ -11,7 +11,6 @@ namespace DotNetOpenAuth.OpenId {
using DotNetOpenAuth.Messaging;
using System.Globalization;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Diagnostics;
using Validation;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Provider/IAuthenticationRequest.cs b/src/DotNetOpenAuth.OpenId/OpenId/Provider/IAuthenticationRequest.cs
index df29fb2..0b121b7 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Provider/IAuthenticationRequest.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Provider/IAuthenticationRequest.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -16,7 +15,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// This interface provides the details of the request and allows setting
/// the response.
/// </summary>
- [ContractClass(typeof(IAuthenticationRequestContract))]
public interface IAuthenticationRequest : IHostProcessedRequest {
/// <summary>
/// Gets a value indicating whether the Provider should help the user
@@ -95,273 +93,4 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// </exception>
void SetClaimedIdentifierFragment(string fragment);
}
-
- /// <summary>
- /// Code contract class for the <see cref="IAuthenticationRequest"/> type.
- /// </summary>
- [ContractClassFor(typeof(IAuthenticationRequest))]
- internal abstract class IAuthenticationRequestContract : IAuthenticationRequest {
- /// <summary>
- /// Initializes a new instance of the <see cref="IAuthenticationRequestContract"/> class.
- /// </summary>
- protected IAuthenticationRequestContract() {
- }
-
- #region IAuthenticationRequest Properties
-
- /// <summary>
- /// Gets a value indicating whether the Provider should help the user
- /// select a Claimed Identifier to send back to the relying party.
- /// </summary>
- bool IAuthenticationRequest.IsDirectedIdentity {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets a value indicating whether the requesting Relying Party is using a delegated URL.
- /// </summary>
- /// <remarks>
- /// When delegated identifiers are used, the <see cref="IAuthenticationRequest.ClaimedIdentifier"/> should not
- /// be changed at the Provider during authentication.
- /// Delegation is only detectable on requests originating from OpenID 2.0 relying parties.
- /// A relying party implementing only OpenID 1.x may use delegation and this property will
- /// return false anyway.
- /// </remarks>
- bool IAuthenticationRequest.IsDelegatedIdentifier {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets or sets the Local Identifier to this OpenID Provider of the user attempting
- /// to authenticate. Check <see cref="IAuthenticationRequest.IsDirectedIdentity"/> to see if
- /// this value is valid.
- /// </summary>
- /// <remarks>
- /// This may or may not be the same as the Claimed Identifier that the user agent
- /// originally supplied to the relying party. The Claimed Identifier
- /// endpoint may be delegating authentication to this provider using
- /// this provider's local id, which is what this property contains.
- /// Use this identifier when looking up this user in the provider's user account
- /// list.
- /// </remarks>
- Identifier IAuthenticationRequest.LocalIdentifier {
- get {
- throw new NotImplementedException();
- }
-
- set {
- throw new NotImplementedException();
- }
- }
-
- /// <summary>
- /// Gets or sets the identifier that the user agent is claiming at the relying party site.
- /// Check <see cref="IAuthenticationRequest.IsDirectedIdentity"/> to see if this value is valid.
- /// </summary>
- /// <remarks>
- /// <para>This property can only be set if <see cref="IAuthenticationRequest.IsDelegatedIdentifier"/> is
- /// false, to prevent breaking URL delegation.</para>
- /// <para>This will not be the same as this provider's local identifier for the user
- /// if the user has set up his/her own identity page that points to this
- /// provider for authentication.</para>
- /// <para>The provider may use this identifier for displaying to the user when
- /// asking for the user's permission to authenticate to the relying party.</para>
- /// </remarks>
- /// <exception cref="InvalidOperationException">Thrown from the setter
- /// if <see cref="IAuthenticationRequest.IsDelegatedIdentifier"/> is true.</exception>
- Identifier IAuthenticationRequest.ClaimedIdentifier {
- get {
- throw new NotImplementedException();
- }
-
- set {
- IAuthenticationRequest req = this;
- RequiresEx.ValidState(!req.IsDelegatedIdentifier, OpenIdStrings.ClaimedIdentifierCannotBeSetOnDelegatedAuthentication);
- RequiresEx.ValidState(!req.IsDirectedIdentity || !(req.LocalIdentifier != null && req.LocalIdentifier != value), OpenIdStrings.IdentifierSelectRequiresMatchingIdentifiers);
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether the provider has determined that the
- /// <see cref="IAuthenticationRequest.ClaimedIdentifier"/> belongs to the currently logged in user
- /// and wishes to share this information with the consumer.
- /// </summary>
- bool? IAuthenticationRequest.IsAuthenticated {
- get {
- throw new NotImplementedException();
- }
-
- set {
- throw new NotImplementedException();
- }
- }
-
- #endregion
-
- #region IHostProcessedRequest Properties
-
- /// <summary>
- /// Gets the version of OpenID being used by the relying party that sent the request.
- /// </summary>
- ProtocolVersion IHostProcessedRequest.RelyingPartyVersion {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the URL the consumer site claims to use as its 'base' address.
- /// </summary>
- Realm IHostProcessedRequest.Realm {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets a value indicating whether the consumer demands an immediate response.
- /// If false, the consumer is willing to wait for the identity provider
- /// to authenticate the user.
- /// </summary>
- bool IHostProcessedRequest.Immediate {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets or sets the provider endpoint claimed in the positive assertion.
- /// </summary>
- /// <value>
- /// The default value is the URL that the request came in on from the relying party.
- /// This value MUST match the value for the OP Endpoint in the discovery results for the
- /// claimed identifier being asserted in a positive response.
- /// </value>
- Uri IHostProcessedRequest.ProviderEndpoint {
- get {
- throw new NotImplementedException();
- }
-
- set {
- throw new NotImplementedException();
- }
- }
-
- #endregion
-
- #region IRequest Properties
-
- /// <summary>
- /// Gets a value indicating whether the response is ready to be sent to the user agent.
- /// </summary>
- /// <remarks>
- /// This property returns false if there are properties that must be set on this
- /// request instance before the response can be sent.
- /// </remarks>
- bool IRequest.IsResponseReady {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets or sets the security settings that apply to this request.
- /// </summary>
- /// <value>
- /// Defaults to the OpenIdProvider.SecuritySettings on the OpenIdProvider.
- /// </value>
- ProviderSecuritySettings IRequest.SecuritySettings {
- get {
- throw new NotImplementedException();
- }
-
- set {
- throw new NotImplementedException();
- }
- }
-
- #endregion
-
- #region IAuthenticationRequest Methods
-
- /// <summary>
- /// Adds an optional fragment (#fragment) portion to the ClaimedIdentifier.
- /// Useful for identifier recycling.
- /// </summary>
- /// <param name="fragment">Should not include the # prefix character as that will be added internally.
- /// May be null or the empty string to clear a previously set fragment.</param>
- /// <remarks>
- /// <para>Unlike the <see cref="IAuthenticationRequest.ClaimedIdentifier"/> property, which can only be set if
- /// using directed identity, this method can be called on any URI claimed identifier.</para>
- /// <para>Because XRI claimed identifiers (the canonical IDs) are never recycled,
- /// this method should<i>not</i> be called for XRIs.</para>
- /// </remarks>
- /// <exception cref="InvalidOperationException">
- /// Thrown when this method is called on an XRI, or on a directed identity
- /// request before the <see cref="IAuthenticationRequest.ClaimedIdentifier"/> property is set.
- /// </exception>
- void IAuthenticationRequest.SetClaimedIdentifierFragment(string fragment) {
- RequiresEx.ValidState(!(((IAuthenticationRequest)this).IsDirectedIdentity && ((IAuthenticationRequest)this).ClaimedIdentifier == null), OpenIdStrings.ClaimedIdentifierMustBeSetFirst);
- RequiresEx.ValidState(!(((IAuthenticationRequest)this).ClaimedIdentifier is XriIdentifier), OpenIdStrings.FragmentNotAllowedOnXRIs);
-
- throw new NotImplementedException();
- }
-
- #endregion
-
- #region IHostProcessedRequest Methods
-
- /// <summary>
- /// Attempts to perform relying party discovery of the return URL claimed by the Relying Party.
- /// </summary>
- /// <param name="webRequestHandler">The web request handler to use for the RP discovery request.</param>
- /// <returns>
- /// The details of how successful the relying party discovery was.
- /// </returns>
- /// <remarks>
- /// <para>Return URL verification is only attempted if this method is called.</para>
- /// <para>See OpenID Authentication 2.0 spec section 9.2.1.</para>
- /// </remarks>
- RelyingPartyDiscoveryResult IHostProcessedRequest.IsReturnUrlDiscoverable(IDirectWebRequestHandler webRequestHandler) {
- throw new NotImplementedException();
- }
-
- #endregion
-
- #region IRequest Methods
-
- /// <summary>
- /// Adds an extension to the response to send to the relying party.
- /// </summary>
- /// <param name="extension">The extension to add to the response message.</param>
- void IRequest.AddResponseExtension(DotNetOpenAuth.OpenId.Messages.IOpenIdMessageExtension extension) {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Removes any response extensions previously added using <see cref="IRequest.AddResponseExtension"/>.
- /// </summary>
- /// <remarks>
- /// This should be called before sending a negative response back to the relying party
- /// if extensions were already added, since negative responses cannot carry extensions.
- /// </remarks>
- void IRequest.ClearResponseExtensions() {
- }
-
- /// <summary>
- /// Gets an extension sent from the relying party.
- /// </summary>
- /// <typeparam name="T">The type of the extension.</typeparam>
- /// <returns>
- /// An instance of the extension initialized with values passed in with the request.
- /// </returns>
- T IRequest.GetExtension<T>() {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets an extension sent from the relying party.
- /// </summary>
- /// <param name="extensionType">The type of the extension.</param>
- /// <returns>
- /// An instance of the extension initialized with values passed in with the request.
- /// </returns>
- DotNetOpenAuth.OpenId.Messages.IOpenIdMessageExtension IRequest.GetExtension(Type extensionType) {
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Provider/IHostProcessedRequest.cs b/src/DotNetOpenAuth.OpenId/OpenId/Provider/IHostProcessedRequest.cs
index 6d6c3e0..4a464b9 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Provider/IHostProcessedRequest.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Provider/IHostProcessedRequest.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Messages;
using Validation;
@@ -15,7 +14,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// Interface exposing incoming messages to the OpenID Provider that
/// require interaction with the host site.
/// </summary>
- [ContractClass(typeof(IHostProcessedRequestContract))]
public interface IHostProcessedRequest : IRequest {
/// <summary>
/// Gets the version of OpenID being used by the relying party that sent the request.
@@ -57,147 +55,4 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// </remarks>
RelyingPartyDiscoveryResult IsReturnUrlDiscoverable(IDirectWebRequestHandler webRequestHandler);
}
-
- /// <summary>
- /// Code contract for the <see cref="IHostProcessedRequest"/> type.
- /// </summary>
- [ContractClassFor(typeof(IHostProcessedRequest))]
- internal abstract class IHostProcessedRequestContract : IHostProcessedRequest {
- /// <summary>
- /// Initializes a new instance of the <see cref="IHostProcessedRequestContract"/> class.
- /// </summary>
- protected IHostProcessedRequestContract() {
- }
-
- #region IHostProcessedRequest Properties
-
- /// <summary>
- /// Gets the version of OpenID being used by the relying party that sent the request.
- /// </summary>
- ProtocolVersion IHostProcessedRequest.RelyingPartyVersion {
- get { throw new System.NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the URL the consumer site claims to use as its 'base' address.
- /// </summary>
- Realm IHostProcessedRequest.Realm {
- get { throw new System.NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets a value indicating whether the consumer demands an immediate response.
- /// If false, the consumer is willing to wait for the identity provider
- /// to authenticate the user.
- /// </summary>
- bool IHostProcessedRequest.Immediate {
- get { throw new System.NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets or sets the provider endpoint.
- /// </summary>
- /// <value>
- /// The default value is the URL that the request came in on from the relying party.
- /// </value>
- Uri IHostProcessedRequest.ProviderEndpoint {
- get {
- Contract.Ensures(Contract.Result<Uri>() != null);
- throw new NotImplementedException();
- }
-
- set {
- Contract.Requires(value != null);
- throw new NotImplementedException();
- }
- }
-
- #endregion
-
- #region IRequest Members
-
- /// <summary>
- /// Gets or sets the security settings that apply to this request.
- /// </summary>
- /// <value>
- /// Defaults to the OpenIdProvider.SecuritySettings on the OpenIdProvider.
- /// </value>
- ProviderSecuritySettings IRequest.SecuritySettings {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets a value indicating whether the response is ready to be sent to the user agent.
- /// </summary>
- /// <remarks>
- /// This property returns false if there are properties that must be set on this
- /// request instance before the response can be sent.
- /// </remarks>
- bool IRequest.IsResponseReady {
- get { throw new System.NotImplementedException(); }
- }
-
- /// <summary>
- /// Adds an extension to the response to send to the relying party.
- /// </summary>
- /// <param name="extension">The extension to add to the response message.</param>
- void IRequest.AddResponseExtension(DotNetOpenAuth.OpenId.Messages.IOpenIdMessageExtension extension) {
- throw new System.NotImplementedException();
- }
-
- /// <summary>
- /// Removes any response extensions previously added using <see cref="IRequest.AddResponseExtension"/>.
- /// </summary>
- /// <remarks>
- /// This should be called before sending a negative response back to the relying party
- /// if extensions were already added, since negative responses cannot carry extensions.
- /// </remarks>
- void IRequest.ClearResponseExtensions() {
- }
-
- /// <summary>
- /// Gets an extension sent from the relying party.
- /// </summary>
- /// <typeparam name="T">The type of the extension.</typeparam>
- /// <returns>
- /// An instance of the extension initialized with values passed in with the request.
- /// </returns>
- T IRequest.GetExtension<T>() {
- throw new System.NotImplementedException();
- }
-
- /// <summary>
- /// Gets an extension sent from the relying party.
- /// </summary>
- /// <param name="extensionType">The type of the extension.</param>
- /// <returns>
- /// An instance of the extension initialized with values passed in with the request.
- /// </returns>
- DotNetOpenAuth.OpenId.Messages.IOpenIdMessageExtension IRequest.GetExtension(System.Type extensionType) {
- throw new System.NotImplementedException();
- }
-
- #endregion
-
- #region IHostProcessedRequest Methods
-
- /// <summary>
- /// Attempts to perform relying party discovery of the return URL claimed by the Relying Party.
- /// </summary>
- /// <param name="webRequestHandler">The web request handler.</param>
- /// <returns>
- /// The details of how successful the relying party discovery was.
- /// </returns>
- /// <remarks>
- /// <para>Return URL verification is only attempted if this method is called.</para>
- /// <para>See OpenID Authentication 2.0 spec section 9.2.1.</para>
- /// </remarks>
- RelyingPartyDiscoveryResult IHostProcessedRequest.IsReturnUrlDiscoverable(IDirectWebRequestHandler webRequestHandler) {
- Requires.NotNull(webRequestHandler, "webRequestHandler");
- throw new System.NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Provider/IProviderBehavior.cs b/src/DotNetOpenAuth.OpenId/OpenId/Provider/IProviderBehavior.cs
index 1d5baeb..57fe66b 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Provider/IProviderBehavior.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Provider/IProviderBehavior.cs
@@ -6,14 +6,12 @@
namespace DotNetOpenAuth.OpenId.Provider {
using System;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.OpenId.ChannelElements;
using Validation;
/// <summary>
/// Applies a custom security policy to certain OpenID security settings and behaviors.
/// </summary>
- [ContractClass(typeof(IProviderBehaviorContract))]
public interface IProviderBehavior {
/// <summary>
/// Applies a well known set of security requirements to a default set of security settings.
@@ -51,65 +49,4 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// </returns>
bool OnOutgoingResponse(IAuthenticationRequest request);
}
-
- /// <summary>
- /// Code contract for the <see cref="IProviderBehavior"/> type.
- /// </summary>
- [ContractClassFor(typeof(IProviderBehavior))]
- internal abstract class IProviderBehaviorContract : IProviderBehavior {
- /// <summary>
- /// Initializes a new instance of the <see cref="IProviderBehaviorContract"/> class.
- /// </summary>
- protected IProviderBehaviorContract() {
- }
-
- #region IProviderBehavior Members
-
- /// <summary>
- /// Applies a well known set of security requirements to a default set of security settings.
- /// </summary>
- /// <param name="securitySettings">The security settings to enhance with the requirements of this profile.</param>
- /// <remarks>
- /// Care should be taken to never decrease security when applying a profile.
- /// Profiles should only enhance security requirements to avoid being
- /// incompatible with each other.
- /// </remarks>
- void IProviderBehavior.ApplySecuritySettings(ProviderSecuritySettings securitySettings) {
- Requires.NotNull(securitySettings, "securitySettings");
- throw new System.NotImplementedException();
- }
-
- /// <summary>
- /// Called when a request is received by the Provider.
- /// </summary>
- /// <param name="request">The incoming request.</param>
- /// <returns>
- /// <c>true</c> if this behavior owns this request and wants to stop other behaviors
- /// from handling it; <c>false</c> to allow other behaviors to process this request.
- /// </returns>
- /// <remarks>
- /// Implementations may set a new value to <see cref="IRequest.SecuritySettings"/> but
- /// should not change the properties on the instance of <see cref="ProviderSecuritySettings"/>
- /// itself as that instance may be shared across many requests.
- /// </remarks>
- bool IProviderBehavior.OnIncomingRequest(IRequest request) {
- Requires.NotNull(request, "request");
- throw new System.NotImplementedException();
- }
-
- /// <summary>
- /// Called when the Provider is preparing to send a response to an authentication request.
- /// </summary>
- /// <param name="request">The request that is configured to generate the outgoing response.</param>
- /// <returns>
- /// <c>true</c> if this behavior owns this request and wants to stop other behaviors
- /// from handling it; <c>false</c> to allow other behaviors to process this request.
- /// </returns>
- bool IProviderBehavior.OnOutgoingResponse(IAuthenticationRequest request) {
- Requires.NotNull(request, "request");
- throw new System.NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Provider/IRequest.cs b/src/DotNetOpenAuth.OpenId/OpenId/Provider/IRequest.cs
index 9abcd28..791237f 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Provider/IRequest.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Provider/IRequest.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Text;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Messages;
@@ -22,7 +21,6 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// be authentication requests where the Provider site has to make decisions based
/// on its own user database and policies.
/// </remarks>
- [ContractClass(typeof(IRequestContract))]
public interface IRequest {
/// <summary>
/// Gets a value indicating whether the response is ready to be sent to the user agent.
@@ -69,82 +67,4 @@ namespace DotNetOpenAuth.OpenId.Provider {
/// <returns>An instance of the extension initialized with values passed in with the request.</returns>
IOpenIdMessageExtension GetExtension(Type extensionType);
}
-
- /// <summary>
- /// Code contract for the <see cref="IRequest"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IRequest))]
- internal abstract class IRequestContract : IRequest {
- /// <summary>
- /// Prevents a default instance of the <see cref="IRequestContract"/> class from being created.
- /// </summary>
- private IRequestContract() {
- }
-
- #region IRequest Members
-
- /// <summary>
- /// Gets or sets the security settings that apply to this request.
- /// </summary>
- /// <value>Defaults to the OpenIdProvider.SecuritySettings on the OpenIdProvider.</value>
- ProviderSecuritySettings IRequest.SecuritySettings {
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets a value indicating whether the response is ready to be sent to the user agent.
- /// </summary>
- /// <remarks>
- /// This property returns false if there are properties that must be set on this
- /// request instance before the response can be sent.
- /// </remarks>
- bool IRequest.IsResponseReady {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Adds an extension to the response to send to the relying party.
- /// </summary>
- /// <param name="extension">The extension to add to the response message.</param>
- void IRequest.AddResponseExtension(IOpenIdMessageExtension extension) {
- Requires.NotNull(extension, "extension");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Removes any response extensions previously added using <see cref="IRequest.AddResponseExtension"/>.
- /// </summary>
- /// <remarks>
- /// This should be called before sending a negative response back to the relying party
- /// if extensions were already added, since negative responses cannot carry extensions.
- /// </remarks>
- void IRequest.ClearResponseExtensions() {
- }
-
- /// <summary>
- /// Gets an extension sent from the relying party.
- /// </summary>
- /// <typeparam name="T">The type of the extension.</typeparam>
- /// <returns>
- /// An instance of the extension initialized with values passed in with the request.
- /// </returns>
- T IRequest.GetExtension<T>() {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets an extension sent from the relying party.
- /// </summary>
- /// <param name="extensionType">The type of the extension.</param>
- /// <returns>
- /// An instance of the extension initialized with values passed in with the request.
- /// </returns>
- IOpenIdMessageExtension IRequest.GetExtension(Type extensionType) {
- Requires.NotNull(extensionType, "extensionType");
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/ProviderEndpointDescription.cs b/src/DotNetOpenAuth.OpenId/OpenId/ProviderEndpointDescription.cs
index f2e46f3..ff87795 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/ProviderEndpointDescription.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/ProviderEndpointDescription.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.OpenId {
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.Messages;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Realm.cs b/src/DotNetOpenAuth.OpenId/OpenId/Realm.cs
index 65fac73..c1a959e 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/Realm.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/Realm.cs
@@ -115,7 +115,6 @@ namespace DotNetOpenAuth.OpenId {
public static Realm AutoDetect {
get {
RequiresEx.ValidState(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired);
- Contract.Ensures(Contract.Result<Realm>() != null);
var realmUrl = new UriBuilder(MessagingUtilities.GetWebRoot());
@@ -261,7 +260,6 @@ namespace DotNetOpenAuth.OpenId {
[SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings", Justification = "Not all Realms are valid URLs.")]
[DebuggerStepThrough]
public static implicit operator Realm(string uri) {
- Contract.Ensures((Contract.Result<Realm>() != null) == (uri != null));
return uri != null ? new Realm(uri) : null;
}
@@ -272,7 +270,6 @@ namespace DotNetOpenAuth.OpenId {
/// <returns>The result of the conversion.</returns>
[DebuggerStepThrough]
public static implicit operator Realm(Uri uri) {
- Contract.Ensures((Contract.Result<Realm>() != null) == (uri != null));
return uri != null ? new Realm(uri) : null;
}
@@ -283,7 +280,6 @@ namespace DotNetOpenAuth.OpenId {
/// <returns>The result of the conversion.</returns>
[DebuggerStepThrough]
public static implicit operator string(Realm realm) {
- Contract.Ensures((Contract.Result<string>() != null) == (realm != null));
return realm != null ? realm.ToString() : null;
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationRequest.cs b/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationRequest.cs
index 92e3233..886029c 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationRequest.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationRequest.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
@@ -18,7 +17,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// requests that may be queried/modified in specific ways before being
/// routed to the OpenID Provider.
/// </summary>
- [ContractClass(typeof(IAuthenticationRequestContract))]
public interface IAuthenticationRequest {
/// <summary>
/// Gets or sets the mode the Provider should use during authentication.
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationRequestContract.cs b/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationRequestContract.cs
deleted file mode 100644
index 0cbd70a..0000000
--- a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationRequestContract.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-// <auto-generated />
-
-namespace DotNetOpenAuth.OpenId.RelyingParty {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.Contracts;
- using System.Linq;
- using System.Text;
- using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.OpenId.Messages;
- using Validation;
-
- [ContractClassFor(typeof(IAuthenticationRequest))]
- internal abstract class IAuthenticationRequestContract : IAuthenticationRequest {
- #region IAuthenticationRequest Members
-
- AuthenticationRequestMode IAuthenticationRequest.Mode {
- get {
- throw new NotImplementedException();
- }
-
- set {
- throw new NotImplementedException();
- }
- }
-
- OutgoingWebResponse IAuthenticationRequest.RedirectingResponse {
- get { throw new NotImplementedException(); }
- }
-
- Uri IAuthenticationRequest.ReturnToUrl {
- get { throw new NotImplementedException(); }
- }
-
- Realm IAuthenticationRequest.Realm {
- get {
- Contract.Ensures(Contract.Result<Realm>() != null);
- throw new NotImplementedException();
- }
- }
-
- Identifier IAuthenticationRequest.ClaimedIdentifier {
- get {
- throw new NotImplementedException();
- }
- }
-
- bool IAuthenticationRequest.IsDirectedIdentity {
- get { throw new NotImplementedException(); }
- }
-
- bool IAuthenticationRequest.IsExtensionOnly {
- get {
- throw new NotImplementedException();
- }
-
- set {
- throw new NotImplementedException();
- }
- }
-
- IProviderEndpoint IAuthenticationRequest.Provider {
- get {
- Contract.Ensures(Contract.Result<IProviderEndpoint>() != null);
- throw new NotImplementedException();
- }
- }
-
- IdentifierDiscoveryResult IAuthenticationRequest.DiscoveryResult {
- get {
- Contract.Ensures(Contract.Result<IdentifierDiscoveryResult>() != null);
- throw new NotImplementedException();
- }
- }
-
- void IAuthenticationRequest.AddCallbackArguments(IDictionary<string, string> arguments) {
- Requires.NotNull(arguments, "arguments");
- Requires.That(arguments.Keys.All(k => !string.IsNullOrEmpty(k)), "arguments", "Empty string as key in arguments not allowed.");
- Requires.NullOrNotNullElements(arguments.Values, "arguments");
- throw new NotImplementedException();
- }
-
- void IAuthenticationRequest.AddCallbackArguments(string key, string value) {
- Requires.NotNullOrEmpty(key, "key");
- Requires.NotNull(value, "value");
- throw new NotImplementedException();
- }
-
- void IAuthenticationRequest.SetCallbackArgument(string key, string value) {
- Requires.NotNullOrEmpty(key, "key");
- Requires.NotNull(value, "value");
- throw new NotImplementedException();
- }
-
- void IAuthenticationRequest.AddExtension(IOpenIdMessageExtension extension) {
- Requires.NotNull(extension, "extension");
- throw new NotImplementedException();
- }
-
- void IAuthenticationRequest.RedirectToProvider() {
- throw new NotImplementedException();
- }
-
- void IAuthenticationRequest.SetUntrustedCallbackArgument(string key, string value) {
- Requires.NotNullOrEmpty(key, "key");
- Requires.NotNull(value, "value");
- throw new NotImplementedException();
- }
-
- #endregion
- }
-}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationResponse.cs b/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationResponse.cs
index c00c9e5..bfdc65d 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationResponse.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IAuthenticationResponse.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Text;
using System.Web;
@@ -27,7 +26,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// assertions. This interface does not offer a way to discern between
/// solicited and unsolicited assertions as they should be treated equally.
/// </remarks>
- [ContractClass(typeof(IAuthenticationResponseContract))]
public interface IAuthenticationResponse {
/// <summary>
/// Gets the Identifier that the end user claims to own. For use with user database storage and lookup.
@@ -255,277 +253,4 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// </remarks>
IOpenIdMessageExtension GetUntrustedExtension(Type extensionType);
}
-
- /// <summary>
- /// Code contract for the <see cref="IAuthenticationResponse"/> type.
- /// </summary>
- [ContractClassFor(typeof(IAuthenticationResponse))]
- internal abstract class IAuthenticationResponseContract : IAuthenticationResponse {
- /// <summary>
- /// Initializes a new instance of the <see cref="IAuthenticationResponseContract"/> class.
- /// </summary>
- protected IAuthenticationResponseContract() {
- }
-
- #region IAuthenticationResponse Members
-
- /// <summary>
- /// Gets the Identifier that the end user claims to own. For use with user database storage and lookup.
- /// May be null for some failed authentications (i.e. failed directed identity authentications).
- /// </summary>
- /// <value></value>
- /// <remarks>
- /// <para>
- /// This is the secure identifier that should be used for database storage and lookup.
- /// It is not always friendly (i.e. =Arnott becomes =!9B72.7DD1.50A9.5CCD), but it protects
- /// user identities against spoofing and other attacks.
- /// </para>
- /// <para>
- /// For user-friendly identifiers to display, use the
- /// <see cref="IAuthenticationResponse.FriendlyIdentifierForDisplay"/> property.
- /// </para>
- /// </remarks>
- Identifier IAuthenticationResponse.ClaimedIdentifier {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets a user-friendly OpenID Identifier for display purposes ONLY.
- /// </summary>
- /// <value></value>
- /// <remarks>
- /// <para>
- /// This <i>should</i> be put through <see cref="HttpUtility.HtmlEncode(string)"/> before
- /// sending to a browser to secure against javascript injection attacks.
- /// </para>
- /// <para>
- /// This property retains some aspects of the user-supplied identifier that get lost
- /// in the <see cref="IAuthenticationResponse.ClaimedIdentifier"/>. For example, XRIs used as user-supplied
- /// identifiers (i.e. =Arnott) become unfriendly unique strings (i.e. =!9B72.7DD1.50A9.5CCD).
- /// For display purposes, such as text on a web page that says "You're logged in as ...",
- /// this property serves to provide the =Arnott string, or whatever else is the most friendly
- /// string close to what the user originally typed in.
- /// </para>
- /// <para>
- /// If the user-supplied identifier is a URI, this property will be the URI after all
- /// redirects, and with the protocol and fragment trimmed off.
- /// If the user-supplied identifier is an XRI, this property will be the original XRI.
- /// If the user-supplied identifier is an OpenID Provider identifier (i.e. yahoo.com),
- /// this property will be the Claimed Identifier, with the protocol stripped if it is a URI.
- /// </para>
- /// <para>
- /// It is <b>very</b> important that this property <i>never</i> be used for database storage
- /// or lookup to avoid identity spoofing and other security risks. For database storage
- /// and lookup please use the <see cref="IAuthenticationResponse.ClaimedIdentifier"/> property.
- /// </para>
- /// </remarks>
- string IAuthenticationResponse.FriendlyIdentifierForDisplay {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the detailed success or failure status of the authentication attempt.
- /// </summary>
- /// <value></value>
- AuthenticationStatus IAuthenticationResponse.Status {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets information about the OpenId Provider, as advertised by the
- /// OpenID discovery documents found at the <see cref="IAuthenticationResponse.ClaimedIdentifier"/>
- /// location, if available.
- /// </summary>
- /// <value>
- /// The Provider endpoint that issued the positive assertion;
- /// or <c>null</c> if information about the Provider is unavailable.
- /// </value>
- IProviderEndpoint IAuthenticationResponse.Provider {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets the details regarding a failed authentication attempt, if available.
- /// This will be set if and only if <see cref="IAuthenticationResponse.Status"/> is <see cref="AuthenticationStatus.Failed"/>.
- /// </summary>
- /// <value></value>
- Exception IAuthenticationResponse.Exception {
- get { throw new NotImplementedException(); }
- }
-
- /// <summary>
- /// Gets a callback argument's value that was previously added using
- /// <see cref="IAuthenticationRequest.AddCallbackArguments(string, string)"/>.
- /// </summary>
- /// <param name="key">The name of the parameter whose value is sought.</param>
- /// <returns>
- /// The value of the argument, or null if the named parameter could not be found.
- /// </returns>
- /// <remarks>
- /// <para>This may return any argument on the querystring that came with the authentication response,
- /// which may include parameters not explicitly added using
- /// <see cref="IAuthenticationRequest.AddCallbackArguments(string, string)"/>.</para>
- /// <para>Note that these values are NOT protected against tampering in transit.</para>
- /// </remarks>
- string IAuthenticationResponse.GetCallbackArgument(string key) {
- Requires.NotNullOrEmpty(key, "key");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets all the callback arguments that were previously added using
- /// <see cref="IAuthenticationRequest.AddCallbackArguments(string, string)"/> or as a natural part
- /// of the return_to URL.
- /// </summary>
- /// <returns>A name-value dictionary. Never null.</returns>
- /// <remarks>
- /// <para>This MAY return any argument on the querystring that came with the authentication response,
- /// which may include parameters not explicitly added using
- /// <see cref="IAuthenticationRequest.AddCallbackArguments(string, string)"/>.</para>
- /// <para>Note that these values are NOT protected against tampering in transit.</para>
- /// </remarks>
- IDictionary<string, string> IAuthenticationResponse.GetCallbackArguments() {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Tries to get an OpenID extension that may be present in the response.
- /// </summary>
- /// <typeparam name="T">The type of extension to look for in the response message.</typeparam>
- /// <returns>
- /// The extension, if it is found. Null otherwise.
- /// </returns>
- /// <remarks>
- /// <para>Extensions are returned only if the Provider signed them.
- /// Relying parties that do not care if the values were modified in
- /// transit should use the <see cref="IAuthenticationResponse.GetUntrustedExtension&lt;T&gt;"/> method
- /// in order to allow the Provider to not sign the extension. </para>
- /// <para>Unsigned extensions are completely unreliable and should be
- /// used only to prefill user forms since the user or any other third
- /// party may have tampered with the data carried by the extension.</para>
- /// <para>Signed extensions are only reliable if the relying party
- /// trusts the OpenID Provider that signed them. Signing does not mean
- /// the relying party can trust the values -- it only means that the values
- /// have not been tampered with since the Provider sent the message.</para>
- /// </remarks>
- T IAuthenticationResponse.GetExtension<T>() {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Tries to get an OpenID extension that may be present in the response.
- /// </summary>
- /// <param name="extensionType">Type of the extension to look for in the response.</param>
- /// <returns>
- /// The extension, if it is found. Null otherwise.
- /// </returns>
- /// <remarks>
- /// <para>Extensions are returned only if the Provider signed them.
- /// Relying parties that do not care if the values were modified in
- /// transit should use the <see cref="IAuthenticationResponse.GetUntrustedExtension"/> method
- /// in order to allow the Provider to not sign the extension. </para>
- /// <para>Unsigned extensions are completely unreliable and should be
- /// used only to prefill user forms since the user or any other third
- /// party may have tampered with the data carried by the extension.</para>
- /// <para>Signed extensions are only reliable if the relying party
- /// trusts the OpenID Provider that signed them. Signing does not mean
- /// the relying party can trust the values -- it only means that the values
- /// have not been tampered with since the Provider sent the message.</para>
- /// </remarks>
- IOpenIdMessageExtension IAuthenticationResponse.GetExtension(Type extensionType) {
- RequiresEx.NotNullSubtype<IOpenIdMessageExtension>(extensionType, "extensionType");
- ////ErrorUtilities.VerifyArgument(typeof(IOpenIdMessageExtension).IsAssignableFrom(extensionType), string.Format(CultureInfo.CurrentCulture, OpenIdStrings.TypeMustImplementX, typeof(IOpenIdMessageExtension).FullName));
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Tries to get an OpenID extension that may be present in the response, without
- /// requiring it to be signed by the Provider.
- /// </summary>
- /// <typeparam name="T">The type of extension to look for in the response message.</typeparam>
- /// <returns>
- /// The extension, if it is found. Null otherwise.
- /// </returns>
- /// <remarks>
- /// <para>Extensions are returned whether they are signed or not.
- /// Use the <see cref="IAuthenticationResponse.GetExtension&lt;T&gt;"/> method to retrieve
- /// extension responses only if they are signed by the Provider to
- /// protect against tampering. </para>
- /// <para>Unsigned extensions are completely unreliable and should be
- /// used only to prefill user forms since the user or any other third
- /// party may have tampered with the data carried by the extension.</para>
- /// <para>Signed extensions are only reliable if the relying party
- /// trusts the OpenID Provider that signed them. Signing does not mean
- /// the relying party can trust the values -- it only means that the values
- /// have not been tampered with since the Provider sent the message.</para>
- /// </remarks>
- T IAuthenticationResponse.GetUntrustedExtension<T>() {
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Tries to get an OpenID extension that may be present in the response, without
- /// requiring it to be signed by the Provider.
- /// </summary>
- /// <param name="extensionType">Type of the extension to look for in the response.</param>
- /// <returns>
- /// The extension, if it is found. Null otherwise.
- /// </returns>
- /// <remarks>
- /// <para>Extensions are returned whether they are signed or not.
- /// Use the <see cref="IAuthenticationResponse.GetExtension"/> method to retrieve
- /// extension responses only if they are signed by the Provider to
- /// protect against tampering. </para>
- /// <para>Unsigned extensions are completely unreliable and should be
- /// used only to prefill user forms since the user or any other third
- /// party may have tampered with the data carried by the extension.</para>
- /// <para>Signed extensions are only reliable if the relying party
- /// trusts the OpenID Provider that signed them. Signing does not mean
- /// the relying party can trust the values -- it only means that the values
- /// have not been tampered with since the Provider sent the message.</para>
- /// </remarks>
- IOpenIdMessageExtension IAuthenticationResponse.GetUntrustedExtension(Type extensionType) {
- RequiresEx.NotNullSubtype<IOpenIdMessageExtension>(extensionType, "extensionType");
- ////ErrorUtilities.VerifyArgument(typeof(IOpenIdMessageExtension).IsAssignableFrom(extensionType), string.Format(CultureInfo.CurrentCulture, OpenIdStrings.TypeMustImplementX, typeof(IOpenIdMessageExtension).FullName));
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets a callback argument's value that was previously added using
- /// <see cref="IAuthenticationRequest.AddCallbackArguments(string, string)"/>.
- /// </summary>
- /// <param name="key">The name of the parameter whose value is sought.</param>
- /// <returns>
- /// The value of the argument, or null if the named parameter could not be found.
- /// </returns>
- /// <remarks>
- /// Callback parameters are only available even if the RP is in stateless mode,
- /// or the callback parameters are otherwise unverifiable as untampered with.
- /// Therefore, use this method only when the callback argument is not to be
- /// used to make a security-sensitive decision.
- /// </remarks>
- string IAuthenticationResponse.GetUntrustedCallbackArgument(string key) {
- Requires.NotNullOrEmpty(key, "key");
- throw new NotImplementedException();
- }
-
- /// <summary>
- /// Gets all the callback arguments that were previously added using
- /// <see cref="IAuthenticationRequest.AddCallbackArguments(string, string)"/> or as a natural part
- /// of the return_to URL.
- /// </summary>
- /// <returns>A name-value dictionary. Never null.</returns>
- /// <remarks>
- /// Callback parameters are only available even if the RP is in stateless mode,
- /// or the callback parameters are otherwise unverifiable as untampered with.
- /// Therefore, use this method only when the callback argument is not to be
- /// used to make a security-sensitive decision.
- /// </remarks>
- IDictionary<string, string> IAuthenticationResponse.GetUntrustedCallbackArguments() {
- Contract.Ensures(Contract.Result<IDictionary<string, string>>() != null);
- throw new NotImplementedException();
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IRelyingPartyBehavior.cs b/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IRelyingPartyBehavior.cs
index 27d84f9..b056fcd 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IRelyingPartyBehavior.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/IRelyingPartyBehavior.cs
@@ -6,13 +6,11 @@
namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
- using System.Diagnostics.Contracts;
using Validation;
/// <summary>
/// Applies a custom security policy to certain OpenID security settings and behaviors.
/// </summary>
- [ContractClass(typeof(IRelyingPartyBehaviorContract))]
public interface IRelyingPartyBehavior {
/// <summary>
/// Applies a well known set of security requirements to a default set of security settings.
@@ -41,53 +39,4 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// <param name="assertion">The positive assertion.</param>
void OnIncomingPositiveAssertion(IAuthenticationResponse assertion);
}
-
- /// <summary>
- /// Contract class for the <see cref="IRelyingPartyBehavior"/> interface.
- /// </summary>
- [ContractClassFor(typeof(IRelyingPartyBehavior))]
- internal abstract class IRelyingPartyBehaviorContract : IRelyingPartyBehavior {
- /// <summary>
- /// Prevents a default instance of the <see cref="IRelyingPartyBehaviorContract"/> class from being created.
- /// </summary>
- private IRelyingPartyBehaviorContract() {
- }
-
- #region IRelyingPartyBehavior Members
-
- /// <summary>
- /// Applies a well known set of security requirements to a default set of security settings.
- /// </summary>
- /// <param name="securitySettings">The security settings to enhance with the requirements of this profile.</param>
- /// <remarks>
- /// Care should be taken to never decrease security when applying a profile.
- /// Profiles should only enhance security requirements to avoid being
- /// incompatible with each other.
- /// </remarks>
- void IRelyingPartyBehavior.ApplySecuritySettings(RelyingPartySecuritySettings securitySettings) {
- Requires.NotNull(securitySettings, "securitySettings");
- }
-
- /// <summary>
- /// Called when an authentication request is about to be sent.
- /// </summary>
- /// <param name="request">The request.</param>
- /// <remarks>
- /// Implementations should be prepared to be called multiple times on the same outgoing message
- /// without malfunctioning.
- /// </remarks>
- void IRelyingPartyBehavior.OnOutgoingAuthenticationRequest(IAuthenticationRequest request) {
- Requires.NotNull(request, "request");
- }
-
- /// <summary>
- /// Called when an incoming positive assertion is received.
- /// </summary>
- /// <param name="assertion">The positive assertion.</param>
- void IRelyingPartyBehavior.OnIncomingPositiveAssertion(IAuthenticationResponse assertion) {
- Requires.NotNull(assertion, "assertion");
- }
-
- #endregion
- }
}
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/RelyingPartySecuritySettings.cs b/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/RelyingPartySecuritySettings.cs
index 77ccbca..e866f24 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/RelyingPartySecuritySettings.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/RelyingParty/RelyingPartySecuritySettings.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/RelyingPartyEndpointDescription.cs b/src/DotNetOpenAuth.OpenId/OpenId/RelyingPartyEndpointDescription.cs
index de33a40..d7ebd3a 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/RelyingPartyEndpointDescription.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/RelyingPartyEndpointDescription.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/SecuritySettings.cs b/src/DotNetOpenAuth.OpenId/OpenId/SecuritySettings.cs
index 30cdd90..589f470 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/SecuritySettings.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/SecuritySettings.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId {
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using Validation;
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/UriIdentifier.cs b/src/DotNetOpenAuth.OpenId/OpenId/UriIdentifier.cs
index 82e08de..b9f6ebc 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/UriIdentifier.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/UriIdentifier.cs
@@ -481,7 +481,6 @@ namespace DotNetOpenAuth.OpenId {
/// <returns>The non-compressing equivalent scheme or URL for the given value.</returns>
private static string NormalSchemeToSpecialRoundTrippingScheme(string normal) {
Requires.NotNullOrEmpty(normal, "normal");
- Contract.Ensures(!string.IsNullOrEmpty(Contract.Result<string>()));
ErrorUtilities.VerifyInternal(schemeSubstitution, "Wrong schemeSubstitution value.");
int delimiterIndex = normal.IndexOf(Uri.SchemeDelimiter, StringComparison.Ordinal);
@@ -565,14 +564,14 @@ namespace DotNetOpenAuth.OpenId {
// Get the Path out ourselves, since the default Uri parser compresses it too much for OpenID.
int schemeLength = value.IndexOf(Uri.SchemeDelimiter, StringComparison.Ordinal);
- Contract.Assume(schemeLength > 0);
+ Assumes.True(schemeLength > 0);
int hostStart = schemeLength + Uri.SchemeDelimiter.Length;
int hostFinish = value.IndexOf('/', hostStart);
if (hostFinish < 0) {
this.Path = "/";
} else {
int pathFinish = value.IndexOfAny(PathEndingCharacters, hostFinish);
- Contract.Assume(pathFinish >= hostFinish || pathFinish < 0);
+ Assumes.True(pathFinish >= hostFinish || pathFinish < 0);
if (pathFinish < 0) {
this.Path = value.Substring(hostFinish);
} else {
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/XriDiscoveryProxyService.cs b/src/DotNetOpenAuth.OpenId/OpenId/XriDiscoveryProxyService.cs
index d47629e..a3e8345 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/XriDiscoveryProxyService.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/XriDiscoveryProxyService.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId {
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Text;
@@ -75,7 +74,6 @@ namespace DotNetOpenAuth.OpenId {
private static XrdsDocument DownloadXrds(XriIdentifier identifier, IDirectWebRequestHandler requestHandler) {
Requires.NotNull(identifier, "identifier");
Requires.NotNull(requestHandler, "requestHandler");
- Contract.Ensures(Contract.Result<XrdsDocument>() != null);
XrdsDocument doc;
using (var xrdsResponse = Yadis.Request(requestHandler, GetXrdsUrl(identifier), identifier.IsDiscoverySecureEndToEnd)) {
var readerSettings = MessagingUtilities.CreateUntrustedXmlReaderSettings();
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/XriIdentifier.cs b/src/DotNetOpenAuth.OpenId/OpenId/XriIdentifier.cs
index aa41a04..4222726 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/XriIdentifier.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/XriIdentifier.cs
@@ -21,7 +21,6 @@ namespace DotNetOpenAuth.OpenId {
/// An XRI style of OpenID Identifier.
/// </summary>
[Serializable]
- [ContractVerification(true)]
[Pure]
public sealed class XriIdentifier : Identifier {
/// <summary>
@@ -61,7 +60,7 @@ namespace DotNetOpenAuth.OpenId {
: base(xri, requireSsl) {
Requires.NotNullOrEmpty(xri, "xri");
RequiresEx.Format(IsValidXri(xri), OpenIdStrings.InvalidXri);
- Contract.Assume(xri != null); // Proven by IsValidXri
+ Assumes.True(xri != null); // Proven by IsValidXri
this.OriginalXri = xri;
this.canonicalXri = CanonicalizeXri(xri);
}
@@ -76,7 +75,6 @@ namespace DotNetOpenAuth.OpenId {
/// </summary>
internal string CanonicalXri {
get {
- Contract.Ensures(Contract.Result<string>() != null);
return this.canonicalXri;
}
}
@@ -170,7 +168,6 @@ namespace DotNetOpenAuth.OpenId {
/// True if the secure conversion was successful.
/// False if the Identifier was originally created with an explicit HTTP scheme.
/// </returns>
- [ContractVerification(false)] // bugs/limitations in CC static analysis
internal override bool TryRequireSsl(out Identifier secureIdentifier) {
secureIdentifier = IsDiscoverySecureEndToEnd ? this : new XriIdentifier(this, true);
return true;
@@ -184,10 +181,9 @@ namespace DotNetOpenAuth.OpenId {
/// <remarks>The canonical form, per the OpenID spec, is no scheme and no whitespace on either end.</remarks>
private static string CanonicalizeXri(string xri) {
Requires.NotNull(xri, "xri");
- Contract.Ensures(Contract.Result<string>() != null);
xri = xri.Trim();
if (xri.StartsWith(XriScheme, StringComparison.OrdinalIgnoreCase)) {
- Contract.Assume(XriScheme.Length <= xri.Length); // should be implied by StartsWith
+ Assumes.True(XriScheme.Length <= xri.Length); // should be implied by StartsWith
xri = xri.Substring(XriScheme.Length);
}
return xri;
diff --git a/src/DotNetOpenAuth.OpenId/OpenIdXrdsHelperRelyingParty.cs b/src/DotNetOpenAuth.OpenId/OpenIdXrdsHelperRelyingParty.cs
index a431b83..885370c 100644
--- a/src/DotNetOpenAuth.OpenId/OpenIdXrdsHelperRelyingParty.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenIdXrdsHelperRelyingParty.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.OpenId {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.RelyingParty;
@@ -32,7 +31,6 @@ namespace DotNetOpenAuth.OpenId {
Requires.NotNull(xrds, "xrds");
Requires.NotNull(claimedIdentifier, "claimedIdentifier");
Requires.NotNull(userSuppliedIdentifier, "userSuppliedIdentifier");
- Contract.Ensures(Contract.Result<IEnumerable<IdentifierDiscoveryResult>>() != null);
var endpoints = new List<IdentifierDiscoveryResult>();
endpoints.AddRange(xrds.GenerateOPIdentifierServiceEndpoints(userSuppliedIdentifier));
@@ -53,7 +51,6 @@ namespace DotNetOpenAuth.OpenId {
internal static IEnumerable<IdentifierDiscoveryResult> CreateServiceEndpoints(this IEnumerable<XrdElement> xrds, XriIdentifier userSuppliedIdentifier) {
Requires.NotNull(xrds, "xrds");
Requires.NotNull(userSuppliedIdentifier, "userSuppliedIdentifier");
- Contract.Ensures(Contract.Result<IEnumerable<IdentifierDiscoveryResult>>() != null);
var endpoints = new List<IdentifierDiscoveryResult>();
endpoints.AddRange(xrds.GenerateOPIdentifierServiceEndpoints(userSuppliedIdentifier));
@@ -72,7 +69,6 @@ namespace DotNetOpenAuth.OpenId {
private static IEnumerable<IdentifierDiscoveryResult> GenerateOPIdentifierServiceEndpoints(this IEnumerable<XrdElement> xrds, Identifier opIdentifier) {
Requires.NotNull(xrds, "xrds");
Requires.NotNull(opIdentifier, "opIdentifier");
- Contract.Ensures(Contract.Result<IEnumerable<IdentifierDiscoveryResult>>() != null);
return from service in xrds.FindOPIdentifierServices()
from uri in service.UriElements
let protocol = Protocol.FindBestVersion(p => p.OPIdentifierServiceTypeURI, service.TypeElementUris)
@@ -93,7 +89,6 @@ namespace DotNetOpenAuth.OpenId {
private static IEnumerable<IdentifierDiscoveryResult> GenerateClaimedIdentifierServiceEndpoints(this IEnumerable<XrdElement> xrds, UriIdentifier claimedIdentifier, UriIdentifier userSuppliedIdentifier) {
Requires.NotNull(xrds, "xrds");
Requires.NotNull(claimedIdentifier, "claimedIdentifier");
- Contract.Ensures(Contract.Result<IEnumerable<IdentifierDiscoveryResult>>() != null);
return from service in xrds.FindClaimedIdentifierServices()
from uri in service.UriElements
@@ -112,8 +107,7 @@ namespace DotNetOpenAuth.OpenId {
private static IEnumerable<IdentifierDiscoveryResult> GenerateClaimedIdentifierServiceEndpoints(this IEnumerable<XrdElement> xrds, XriIdentifier userSuppliedIdentifier) {
// Cannot use code contracts because this method uses yield return.
////Requires.NotNull(xrds, "xrds");
- ////Contract.Ensures(Contract.Result<IEnumerable<IdentifierDiscoveryResult>>() != null);
- ErrorUtilities.VerifyArgumentNotNull(xrds, "xrds");
+ //// ErrorUtilities.VerifyArgumentNotNull(xrds, "xrds");
foreach (var service in xrds.FindClaimedIdentifierServices()) {
foreach (var uri in service.UriElements) {
@@ -139,7 +133,6 @@ namespace DotNetOpenAuth.OpenId {
/// <returns>A sequence of service elements.</returns>
private static IEnumerable<ServiceElement> FindOPIdentifierServices(this IEnumerable<XrdElement> xrds) {
Requires.NotNull(xrds, "xrds");
- Contract.Ensures(Contract.Result<IEnumerable<ServiceElement>>() != null);
return from xrd in xrds
from service in xrd.OpenIdProviderIdentifierServices
@@ -154,7 +147,6 @@ namespace DotNetOpenAuth.OpenId {
/// <returns>A sequence of the services offered.</returns>
private static IEnumerable<ServiceElement> FindClaimedIdentifierServices(this IEnumerable<XrdElement> xrds) {
Requires.NotNull(xrds, "xrds");
- Contract.Ensures(Contract.Result<IEnumerable<ServiceElement>>() != null);
return from xrd in xrds
from service in xrd.OpenIdClaimedIdentifierServices
diff --git a/src/DotNetOpenAuth.OpenId/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OpenId/Properties/AssemblyInfo.cs
index 42aa959..ac795f5 100644
--- a/src/DotNetOpenAuth.OpenId/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OpenId/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OpenId/Xrds/TypeElement.cs b/src/DotNetOpenAuth.OpenId/Xrds/TypeElement.cs
index 05590a9..97f7ded 100644
--- a/src/DotNetOpenAuth.OpenId/Xrds/TypeElement.cs
+++ b/src/DotNetOpenAuth.OpenId/Xrds/TypeElement.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Xrds {
using System;
- using System.Diagnostics.Contracts;
using System.Xml.XPath;
using Validation;
diff --git a/src/DotNetOpenAuth.OpenId/Xrds/XrdsNode.cs b/src/DotNetOpenAuth.OpenId/Xrds/XrdsNode.cs
index 7342b1f..91c59ba 100644
--- a/src/DotNetOpenAuth.OpenId/Xrds/XrdsNode.cs
+++ b/src/DotNetOpenAuth.OpenId/Xrds/XrdsNode.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Xrds {
using System;
- using System.Diagnostics.Contracts;
using System.Xml;
using System.Xml.XPath;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.OpenId/Yadis/HtmlParser.cs b/src/DotNetOpenAuth.OpenId/Yadis/HtmlParser.cs
index e9628c4..36b7bf1 100644
--- a/src/DotNetOpenAuth.OpenId/Yadis/HtmlParser.cs
+++ b/src/DotNetOpenAuth.OpenId/Yadis/HtmlParser.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Yadis {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Linq;
using System.Text;
diff --git a/src/DotNetOpenAuth.OpenId/Yadis/Yadis.cs b/src/DotNetOpenAuth.OpenId/Yadis/Yadis.cs
index 83f3006..4a06ea7 100644
--- a/src/DotNetOpenAuth.OpenId/Yadis/Yadis.cs
+++ b/src/DotNetOpenAuth.OpenId/Yadis/Yadis.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Yadis {
using System;
- using System.Diagnostics.Contracts;
using System.IO;
using System.Net;
using System.Net.Cache;
@@ -138,8 +137,6 @@ namespace DotNetOpenAuth.Yadis {
internal static IncomingWebResponse Request(IDirectWebRequestHandler requestHandler, Uri uri, bool requireSsl, params string[] acceptTypes) {
Requires.NotNull(requestHandler, "requestHandler");
Requires.NotNull(uri, "uri");
- Contract.Ensures(Contract.Result<IncomingWebResponse>() != null);
- Contract.Ensures(Contract.Result<IncomingWebResponse>().ResponseStream != null);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.CachePolicy = IdentifierDiscoveryCachePolicy;
diff --git a/src/DotNetOpenAuth.OpenIdInfoCard.UI/OpenId/RelyingParty/OpenIdInfoCardSelector.cs b/src/DotNetOpenAuth.OpenIdInfoCard.UI/OpenId/RelyingParty/OpenIdInfoCardSelector.cs
index a68fd95..9470ef0 100644
--- a/src/DotNetOpenAuth.OpenIdInfoCard.UI/OpenId/RelyingParty/OpenIdInfoCardSelector.cs
+++ b/src/DotNetOpenAuth.OpenIdInfoCard.UI/OpenId/RelyingParty/OpenIdInfoCardSelector.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IdentityModel.Claims;
using System.Linq;
@@ -22,6 +21,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using DotNetOpenAuth.InfoCard;
////using DotNetOpenAuth.InfoCard;
using DotNetOpenAuth.Messaging;
+ using Validation;
/// <summary>
/// An ASP.NET control that provides a user-friendly way of logging into a web site using OpenID.
@@ -75,8 +75,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// </summary>
/// <param name="e">The token, if it was decrypted.</param>
protected virtual void OnReceivedToken(ReceivedTokenEventArgs e) {
- Contract.Requires(e != null);
- ErrorUtilities.VerifyArgumentNotNull(e, "e");
+ Requires.NotNull(e, "paramName");
var receivedInfoCard = this.ReceivedToken;
if (receivedInfoCard != null) {
@@ -89,8 +88,7 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
/// </summary>
/// <param name="e">The <see cref="DotNetOpenAuth.InfoCard.TokenProcessingErrorEventArgs"/> instance containing the event data.</param>
protected virtual void OnTokenProcessingError(TokenProcessingErrorEventArgs e) {
- Contract.Requires(e != null);
- ErrorUtilities.VerifyArgumentNotNull(e, "e");
+ Requires.NotNull(e, "paramName");
var tokenProcessingError = this.TokenProcessingError;
if (tokenProcessingError != null) {
diff --git a/src/DotNetOpenAuth.OpenIdInfoCard.UI/OpenId/RelyingParty/SelectorInfoCardButton.cs b/src/DotNetOpenAuth.OpenIdInfoCard.UI/OpenId/RelyingParty/SelectorInfoCardButton.cs
index 01a1cf8..cbb1011 100644
--- a/src/DotNetOpenAuth.OpenIdInfoCard.UI/OpenId/RelyingParty/SelectorInfoCardButton.cs
+++ b/src/DotNetOpenAuth.OpenIdInfoCard.UI/OpenId/RelyingParty/SelectorInfoCardButton.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.OpenId.RelyingParty {
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
- using System.Diagnostics.Contracts;
using System.Web.UI;
using DotNetOpenAuth.InfoCard;
using Validation;
diff --git a/src/DotNetOpenAuth.OpenIdInfoCard.UI/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OpenIdInfoCard.UI/Properties/AssemblyInfo.cs
index 5c9dc63..16d6896 100644
--- a/src/DotNetOpenAuth.OpenIdInfoCard.UI/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OpenIdInfoCard.UI/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/DotNetOpenAuth.OpenIdOAuth/OAuth/ServiceProviderOpenIdProvider.cs b/src/DotNetOpenAuth.OpenIdOAuth/OAuth/ServiceProviderOpenIdProvider.cs
index 708c161..f827857 100644
--- a/src/DotNetOpenAuth.OpenIdOAuth/OAuth/ServiceProviderOpenIdProvider.cs
+++ b/src/DotNetOpenAuth.OpenIdOAuth/OAuth/ServiceProviderOpenIdProvider.cs
@@ -9,7 +9,6 @@ namespace DotNetOpenAuth.OAuth {
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.Security.Principal;
using System.ServiceModel.Channels;
diff --git a/src/DotNetOpenAuth.OpenIdOAuth/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.OpenIdOAuth/Properties/AssemblyInfo.cs
index 759bd3f..a3afcd7 100644
--- a/src/DotNetOpenAuth.OpenIdOAuth/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.OpenIdOAuth/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -30,7 +29,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("F9AFC069-8291-497F-B2A1-3E4D1646C572")]
-[assembly: ContractVerification(true)]
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
diff --git a/src/DotNetOpenAuth.Test/AssemblyTesting.cs b/src/DotNetOpenAuth.Test/AssemblyTesting.cs
deleted file mode 100644
index dac5bea..0000000
--- a/src/DotNetOpenAuth.Test/AssemblyTesting.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-//-----------------------------------------------------------------------
-// <copyright file="AssemblyTesting.cs" company="Outercurve Foundation">
-// Copyright (c) Outercurve Foundation. All rights reserved.
-// </copyright>
-//-----------------------------------------------------------------------
-
-namespace DotNetOpenAuth.Test {
- using System.Diagnostics.Contracts;
- using NUnit.Framework;
-
- [SetUpFixture]
- public class AssemblyTesting {
- [SetUp]
- public static void AssemblyInitialize() {
- // Make contract failures become test failures.
- Contract.ContractFailed += (sender, e) => {
- // For now, we have tests that verify that preconditions throw exceptions.
- // So we don't want to fail a test just because a precondition check failed.
- if (e.FailureKind != ContractFailureKind.Precondition) {
- e.SetHandled();
- Assert.Fail(e.FailureKind.ToString() + ": " + e.Message);
- }
- };
- }
- }
-}
diff --git a/src/DotNetOpenAuth.Test/CoordinatorBase.cs b/src/DotNetOpenAuth.Test/CoordinatorBase.cs
index 5747e4d..d1c6f85 100644
--- a/src/DotNetOpenAuth.Test/CoordinatorBase.cs
+++ b/src/DotNetOpenAuth.Test/CoordinatorBase.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Test {
using System;
- using System.Diagnostics.Contracts;
using System.Threading;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId.RelyingParty;
diff --git a/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj b/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj
index 968bc8b..1ecfa30 100644
--- a/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj
+++ b/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj
@@ -97,7 +97,6 @@
</Reference>
</ItemGroup>
<ItemGroup>
- <Compile Include="AssemblyTesting.cs" />
<Compile Include="Configuration\SectionTests.cs" />
<Compile Include="CoordinatorBase.cs" />
<Compile Include="Hosting\AspNetHost.cs" />
diff --git a/src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs b/src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs
index 7c5a6fc..40dcc09 100644
--- a/src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/CollectionAssert.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Test.Messaging {
using System;
using System.Collections;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Messaging;
using NUnit.Framework;
diff --git a/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs b/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs
index 39267ca..e9ac5aa 100644
--- a/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/MultipartPostPartTests.cs
@@ -7,11 +7,11 @@
namespace DotNetOpenAuth.Test.Messaging {
using System.CodeDom.Compiler;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.IO;
using System.Net;
using DotNetOpenAuth.Messaging;
using NUnit.Framework;
+ using Validation;
[TestFixture]
public class MultipartPostPartTests : TestBase {
@@ -77,7 +77,7 @@ namespace DotNetOpenAuth.Test.Messaging {
}
private static void VerifyLength(MultipartPostPart part) {
- Contract.Requires(part != null);
+ Requires.NotNull(part, "part");
var expectedLength = part.Length;
var ms = new MemoryStream();
diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
index 1465379..475f4b5 100644
--- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Test.Mocks {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Net;
using System.Text;
diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs
index 2713765..497503c 100644
--- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs
@@ -7,11 +7,11 @@
namespace DotNetOpenAuth.Test.Mocks {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Net;
using System.Web;
using DotNetOpenAuth.Messaging;
+ using Validation;
internal class CoordinatingHttpRequestInfo : HttpRequestInfo {
private readonly Channel channel;
@@ -40,9 +40,9 @@ namespace DotNetOpenAuth.Test.Mocks {
MessageReceivingEndpoint recipient,
HttpCookieCollection cookies)
: this(recipient, cookies) {
- Contract.Requires(channel != null);
- Contract.Requires(messageFactory != null);
- Contract.Requires(messageData != null);
+ Requires.NotNull(channel, "channel");
+ Requires.NotNull(messageFactory, "messageFactory");
+ Requires.NotNull(messageData, "messageData");
this.channel = channel;
this.messageData = messageData;
this.messageFactory = messageFactory;
diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthConsumerChannel.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthConsumerChannel.cs
index 359fbe9..9b552d3 100644
--- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthConsumerChannel.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthConsumerChannel.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Test.Mocks {
using System;
- using System.Diagnostics.Contracts;
using System.Threading;
using System.Web;
diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthServiceProviderChannel.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthServiceProviderChannel.cs
index df0b1b3..a6f2a7f 100644
--- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthServiceProviderChannel.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthServiceProviderChannel.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Test.Mocks {
using System;
- using System.Diagnostics.Contracts;
using System.Threading;
using System.Web;
diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs
index c81e48f..9df791c 100644
--- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Test.Mocks {
using System;
using System.Collections.Generic;
using System.ComponentModel;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs b/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs
index e745e0e..d20671e 100644
--- a/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Test.Mocks {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Net;
diff --git a/src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs b/src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs
index 27aa9df..f020923 100644
--- a/src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Test.Mocks {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.RelyingParty;
diff --git a/src/DotNetOpenAuth.Test/Mocks/MockRealm.cs b/src/DotNetOpenAuth.Test/Mocks/MockRealm.cs
index 4e86251..8509c03 100644
--- a/src/DotNetOpenAuth.Test/Mocks/MockRealm.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/MockRealm.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Test.Mocks {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
using Validation;
diff --git a/src/DotNetOpenAuth.Test/Mocks/TestMessageFactory.cs b/src/DotNetOpenAuth.Test/Mocks/TestMessageFactory.cs
index 0ec4f46..5a47ab4 100644
--- a/src/DotNetOpenAuth.Test/Mocks/TestMessageFactory.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/TestMessageFactory.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Test.Mocks {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs
index 219ca40..b081038 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs
@@ -8,7 +8,6 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
- using System.Diagnostics.Contracts;
using System.IO;
using System.Net;
using System.Text;
diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs
index dffe6c1..490399c 100644
--- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/SigningBindingElementBaseTests.cs
@@ -6,13 +6,13 @@
namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Reflection;
using DotNetOpenAuth.OAuth;
using DotNetOpenAuth.OAuth.ChannelElements;
using DotNetOpenAuth.OAuth.Messages;
using NUnit.Framework;
+ using Validation;
[TestFixture]
public class SigningBindingElementBaseTests : MessagingTestBase {
@@ -125,7 +125,8 @@ namespace DotNetOpenAuth.Test.OAuth.ChannelElements {
}
internal AccessProtectedResourceRequest CreateResourceRequest(MessageReceivingEndpoint endpoint) {
- Contract.Requires(endpoint != null);
+ Requires.NotNull(endpoint, "endpoint");
+
var message = new AccessProtectedResourceRequest(endpoint, Protocol.V10.Version);
return message;
}
diff --git a/src/DotNetOpenAuth.Test/OAuth/OAuthCoordinator.cs b/src/DotNetOpenAuth.Test/OAuth/OAuthCoordinator.cs
index 10266ff..21c1775 100644
--- a/src/DotNetOpenAuth.Test/OAuth/OAuthCoordinator.cs
+++ b/src/DotNetOpenAuth.Test/OAuth/OAuthCoordinator.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Test.OAuth {
using System;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.OAuth;
diff --git a/src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs b/src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs
index b00b13b..14bcaec 100644
--- a/src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/AuthenticationTests.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Test.OpenId {
using System;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.OpenId;
diff --git a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs
index 52a1c95..dd47782 100644
--- a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using System.Text.RegularExpressions;
using DotNetOpenAuth.Messaging;
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs
index 643bbae..8d0e6ff 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs
@@ -7,7 +7,6 @@
namespace DotNetOpenAuth.Test.OpenId.Extensions {
using System;
using System.Collections.Generic;
- using System.Diagnostics.Contracts;
using System.Linq;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
diff --git a/src/DotNetOpenAuth.Test/OpenId/OpenIdCoordinator.cs b/src/DotNetOpenAuth.Test/OpenId/OpenIdCoordinator.cs
index 0017b42..5000833 100644
--- a/src/DotNetOpenAuth.Test/OpenId/OpenIdCoordinator.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/OpenIdCoordinator.cs
@@ -6,7 +6,6 @@
namespace DotNetOpenAuth.Test.OpenId {
using System;
- using System.Diagnostics.Contracts;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.OpenId;
diff --git a/src/DotNetOpenAuth.Test/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.Test/Properties/AssemblyInfo.cs
index 2960d75..723aabf 100644
--- a/src/DotNetOpenAuth.Test/Properties/AssemblyInfo.cs
+++ b/src/DotNetOpenAuth.Test/Properties/AssemblyInfo.cs
@@ -4,7 +4,6 @@
// </copyright>
//-----------------------------------------------------------------------
-using System.Diagnostics.Contracts;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -21,5 +20,3 @@ using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("aef0bb13-b79c-4854-a69a-de58b8feb5d1")]
-
-[assembly: ContractVerification(true)] \ No newline at end of file
diff --git a/src/Mono.Math/Properties/AssemblyInfo.cs b/src/Mono.Math/Properties/AssemblyInfo.cs
index 0e40bff..93e3a7f 100644
--- a/src/Mono.Math/Properties/AssemblyInfo.cs
+++ b/src/Mono.Math/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/Org.Mentalis.Security.Cryptography/Properties/AssemblyInfo.cs b/src/Org.Mentalis.Security.Cryptography/Properties/AssemblyInfo.cs
index 4a9e9b9..6b93f7f 100644
--- a/src/Org.Mentalis.Security.Cryptography/Properties/AssemblyInfo.cs
+++ b/src/Org.Mentalis.Security.Cryptography/Properties/AssemblyInfo.cs
@@ -7,7 +7,6 @@
// We DON'T put an AssemblyVersionAttribute in here because it is generated in the build.
using System;
-using System.Diagnostics.Contracts;
using System.Net;
using System.Reflection;
using System.Resources;
@@ -31,8 +30,6 @@ using System.Web.UI;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7d73990c-47c0-4256-9f20-a893add9e289")]
-[assembly: ContractVerification(true)]
-
#if StrongNameSigned
// See comment at top of this file. We need this so that strong-naming doesn't
// keep this assembly from being useful to shared host (medium trust) web sites.
diff --git a/src/packages/repositories.config b/src/packages/repositories.config
index bcdec33..0b7a47b 100644
--- a/src/packages/repositories.config
+++ b/src/packages/repositories.config
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<repositories>
+ <repository path="..\..\samples\OAuthConsumerWpf\packages.config" />
+ <repository path="..\..\samples\OpenIdOfflineProvider\packages.config" />
<repository path="..\DotNetOpenAuth.AspNet\packages.config" />
<repository path="..\DotNetOpenAuth.Core.UI\packages.config" />
<repository path="..\DotNetOpenAuth.Core\packages.config" />