summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.AspNet/Clients/OAuth/IOAuthWebWorker.cs
blob: 719e520e14c7af846c47c795d2f83f888fb61121 (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
//-----------------------------------------------------------------------
// <copyright file="IOAuthWebWorker.cs" company="Microsoft">
//     Copyright (c) Microsoft. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.AspNet.Clients {
	using System;
	using System.Net;
	using System.Net.Http;
	using System.Threading;
	using System.Threading.Tasks;
	using System.Web;
	using DotNetOpenAuth.Messaging;
	using DotNetOpenAuth.OAuth;
	using DotNetOpenAuth.OAuth.Messages;

	/// <summary>
	/// The interface implemented by all OAuth web authentication modules in this assembly.
	/// </summary>
	public interface IOAuthWebWorker {
		/// <summary>
		/// Creates an HTTP message handler that authorizes outgoing web requests.
		/// </summary>
		/// <param name="accessToken">The access token.</param>
		/// <returns>An <see cref="HttpMessageHandler"/> that applies the access token to all outgoing requests.</returns>
		HttpMessageHandler CreateMessageHandler(AccessToken accessToken);

		/// <summary>
		/// The process user authorization.
		/// </summary>
		/// <param name="context">The HTTP context.</param>
		/// <param name="cancellationToken">The cancellation token.</param>
		/// <returns>
		/// The access token, if obtained; otherwise <c>null</c>.
		/// </returns>
		Task<AccessTokenResponse> ProcessUserAuthorizationAsync(HttpContextBase context = null, CancellationToken cancellationToken = default(CancellationToken));

		/// <summary>
		/// The request authentication.
		/// </summary>
		/// <param name="callback">The callback.</param>
		/// <param name="cancellationToken">The cancellation token.</param>
		/// <returns>The URL to redirect the user agent to.</returns>
		Task<Uri> RequestAuthenticationAsync(Uri callback, CancellationToken cancellationToken = default(CancellationToken));
	}
}