diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-12-26 20:20:46 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-12-26 20:20:46 -0800 |
commit | 3475fab579db0f6a1454ebc83d2e8a9c271e4c18 (patch) | |
tree | bc1cc264acba9edc486eefbbfbb5fd4822111fb1 /src/DotNetOpenAuth.InfoCard | |
parent | 002ce0e39af3b684ce6060dce60805e3333420fa (diff) | |
download | DotNetOpenAuth-3475fab579db0f6a1454ebc83d2e8a9c271e4c18.zip DotNetOpenAuth-3475fab579db0f6a1454ebc83d2e8a9c271e4c18.tar.gz DotNetOpenAuth-3475fab579db0f6a1454ebc83d2e8a9c271e4c18.tar.bz2 |
Removes more remnants of Code Contracts.
Diffstat (limited to 'src/DotNetOpenAuth.InfoCard')
5 files changed, 4 insertions, 19 deletions
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. |