//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- namespace DotNetOpenAuth.OAuth2.ChannelElements { using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; using System.Text; /// /// Describes a delegated authorization between a resource server, a client, and a user. /// [ContractClass(typeof(IAuthorizationDescriptionContract))] public interface IAuthorizationDescription { /// /// Gets the identifier of the client authorized to access protected data. /// string ClientIdentifier { get; } /// /// Gets the date this authorization was established or the token was issued. /// /// A date/time expressed in UTC. DateTime UtcIssued { get; } /// /// Gets the name on the account whose data on the resource server is accessible using this authorization. /// string User { get; } /// /// Gets the scope of operations the client is allowed to invoke. /// HashSet Scope { get; } } /// /// Code contract for the interface. /// [ContractClassFor(typeof(IAuthorizationDescription))] internal abstract class IAuthorizationDescriptionContract : IAuthorizationDescription { /// /// Prevents a default instance of the class from being created. /// private IAuthorizationDescriptionContract() { } /// /// Gets the identifier of the client authorized to access protected data. /// string IAuthorizationDescription.ClientIdentifier { get { Contract.Ensures(!string.IsNullOrEmpty(Contract.Result())); throw new NotImplementedException(); } } /// /// Gets the date this authorization was established or the token was issued. /// /// A date/time expressed in UTC. DateTime IAuthorizationDescription.UtcIssued { get { throw new NotImplementedException(); } } /// /// Gets the name on the account whose data on the resource server is accessible using this authorization. /// string IAuthorizationDescription.User { get { Contract.Ensures(!string.IsNullOrEmpty(Contract.Result())); throw new NotImplementedException(); } } /// /// Gets the scope of operations the client is allowed to invoke. /// HashSet IAuthorizationDescription.Scope { get { Contract.Ensures(Contract.Result>() != null); throw new NotImplementedException(); } } } }