//----------------------------------------------------------------------- // // Copyright (c) Outercurve Foundation. All rights reserved. // //----------------------------------------------------------------------- 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; /// /// An interface that resource server hosts should implement if they accept access tokens /// issued by non-DotNetOpenAuth authorization servers. /// [ContractClass((typeof(IAccessTokenAnalyzerContract)))] public interface IAccessTokenAnalyzer { /// /// Reads an access token to find out what data it authorizes access to. /// /// The message carrying the access token. /// The access token's serialized representation. /// The deserialized, validated token. /// Thrown if the access token is expired, invalid, or from an untrusted authorization server. AccessToken DeserializeAccessToken(IDirectedProtocolMessage message, string accessToken); } /// /// Code contract for the interface. /// [ContractClassFor(typeof(IAccessTokenAnalyzer))] internal abstract class IAccessTokenAnalyzerContract : IAccessTokenAnalyzer { /// /// Prevents a default instance of the class from being created. /// private IAccessTokenAnalyzerContract() { } /// /// Reads an access token to find out what data it authorizes access to. /// /// The message carrying the access token. /// The access token's serialized representation. /// The deserialized, validated token. /// Thrown if the access token is expired, invalid, or from an untrusted authorization server. AccessToken IAccessTokenAnalyzer.DeserializeAccessToken(IDirectedProtocolMessage message, string accessToken) { Requires.NotNull(message, "message"); Requires.NotNullOrEmpty(accessToken, "accessToken"); Contract.Ensures(Contract.Result() != null); throw new NotImplementedException(); } } }