/// <summary> /// Initializes a new instance of the <see cref="Association"/> class. /// </summary> /// <param name="handle">The handle.</param> /// <param name="secret">The secret.</param> /// <param name="totalLifeLength">How long the association will be useful.</param> /// <param name="issued">When this association was originally issued by the Provider.</param> protected Association(string handle, byte[] secret, TimeSpan totalLifeLength, DateTime issued) { ErrorUtilities.VerifyNonZeroLength(handle, "handle"); ErrorUtilities.VerifyArgumentNotNull(secret, "secret"); this.Handle = handle; this.SecretKey = secret; this.TotalLifeLength = totalLifeLength; this.Issued = OpenIdUtilities.CutToSecond(issued); }
/// <summary> /// Initializes a new instance of the <see cref="Association"/> class. /// </summary> /// <param name="handle">The handle.</param> /// <param name="secret">The secret.</param> /// <param name="totalLifeLength">How long the association will be useful.</param> /// <param name="issued">The UTC time of when this association was originally issued by the Provider.</param> protected Association(string handle, byte[] secret, TimeSpan totalLifeLength, DateTime issued) { Requires.NotNullOrEmpty(handle, "handle"); Requires.NotNull(secret, "secret"); Requires.Range(totalLifeLength > TimeSpan.Zero, "totalLifeLength"); Requires.That(issued.Kind == DateTimeKind.Utc, "issued", "UTC time required."); Requires.Range(issued <= DateTime.UtcNow, "issued"); this.Handle = handle; this.SecretKey = secret; this.TotalLifeLength = totalLifeLength; this.Issued = OpenIdUtilities.CutToSecond(issued); }
/// <summary> /// Initializes a new instance of the <see cref="Association"/> class. /// </summary> /// <param name="handle">The handle.</param> /// <param name="secret">The secret.</param> /// <param name="totalLifeLength">How long the association will be useful.</param> /// <param name="issued">The UTC time of when this association was originally issued by the Provider.</param> protected Association(string handle, byte[] secret, TimeSpan totalLifeLength, DateTime issued) { Contract.Requires <ArgumentNullException>(!string.IsNullOrEmpty(handle)); Contract.Requires <ArgumentNullException>(secret != null); Contract.Requires <ArgumentOutOfRangeException>(totalLifeLength > TimeSpan.Zero); Contract.Requires <ArgumentException>(issued.Kind == DateTimeKind.Utc); Contract.Requires <ArgumentOutOfRangeException>(issued <= DateTime.UtcNow); Contract.Ensures(this.TotalLifeLength == totalLifeLength); this.Handle = handle; this.SecretKey = secret; this.TotalLifeLength = totalLifeLength; this.Issued = OpenIdUtilities.CutToSecond(issued); }