summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth/OAuthWrap/IClientTokenManager.cs
blob: c6beb905cd3d4849646b7f19dfb5ca11fe594547 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//-----------------------------------------------------------------------
// <copyright file="IClientTokenManager.cs" company="Andrew Arnott">
//     Copyright (c) Andrew Arnott. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.OAuthWrap {
	using System;
	using System.Diagnostics.Contracts;

	/// <summary>
	/// A token manager implemented by some clients to assist in tracking authorization state.
	/// </summary>
	[ContractClass(typeof(IClientTokenManagerContract))]
	public interface IClientTokenManager {
		/// <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 GetAuthorizationState(Uri callbackUrl, string clientState);
	}

	/// <summary>
	/// Contract class for the <see cref="IClientTokenManager"/> interface.
	/// </summary>
	[ContractClassFor(typeof(IClientTokenManager))]
	internal abstract class IClientTokenManagerContract : IClientTokenManager {
		/// <summary>
		/// Prevents a default instance of the <see cref="IClientTokenManagerContract"/> class from being created.
		/// </summary>
		private IClientTokenManagerContract() {
		}

		#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 IClientTokenManager.GetAuthorizationState(Uri callbackUrl, string clientState) {
			Contract.Requires<ArgumentNullException>(callbackUrl != null);
			throw new NotImplementedException();
		}

		#endregion
	}
}