blob: afee82c0d579175c20d2b37cc4b2e432f822510e (
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
|
namespace OpenIdProviderWebForms {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Services;
using DotNetOpenAuth.OAuth;
using DotNetOpenAuth.Messaging;
using OpenIdProviderWebForms.Code;
using System.Threading;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class access_token : IHttpAsyncHandler {
public bool IsReusable {
get { return true; }
}
public async Task ProcessRequestAsync(HttpContext context) {
var request = await OAuthHybrid.ServiceProvider.ReadAccessTokenRequestAsync(
new HttpRequestWrapper(context.Request),
context.Response.ClientDisconnectedToken);
var response = OAuthHybrid.ServiceProvider.PrepareAccessTokenMessage(request);
var httpResponseMessage = await OAuthHybrid.ServiceProvider.Channel.PrepareResponseAsync(
response,
context.Response.ClientDisconnectedToken);
await httpResponseMessage.SendAsync();
}
public void ProcessRequest(HttpContext context) {
this.ProcessRequestAsync(context).GetAwaiter().GetResult();
}
public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData) {
return this.ProcessRequestAsync(context).ToApm(cb, extraData);
}
public void EndProcessRequest(IAsyncResult result) {
((Task)result).Wait(); // rethrows exceptions
}
}
}
|