Skip to content
This repository was archived by the owner on Mar 20, 2019. It is now read-only.

Commit 36bbbea

Browse files
committed
Switched Channel to receiving messages via HttpRequestMessage as well.
1 parent fd85211 commit 36bbbea

File tree

59 files changed

+493
-360
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+493
-360
lines changed

projecttemplates/MvcRelyingParty/Code/OpenIdRelyingPartyService.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ public interface IOpenIdRelyingParty {
2323

2424
Task<string> PreloadDiscoveryResultsAsync(Realm realm, Uri returnTo, Uri privacyPolicy, CancellationToken cancellationToken = default(CancellationToken), params Identifier[] identifiers);
2525

26-
Task<ActionResult> ProcessAjaxOpenIdResponseAsync(CancellationToken cancellationToken = default(CancellationToken));
27-
28-
Task<IAuthenticationResponse> GetResponseAsync(CancellationToken cancellationToken = default(CancellationToken));
26+
Task<ActionResult> ProcessAjaxOpenIdResponseAsync(HttpRequestBase request, CancellationToken cancellationToken = default(CancellationToken));
2927

3028
Task<IAuthenticationResponse> GetResponseAsync(HttpRequestBase request, CancellationToken cancellationToken = default(CancellationToken));
3129
}
@@ -96,12 +94,8 @@ await this.CreateRequestsAsync(userSuppliedIdentifier, realm, returnTo, privacyP
9694
return await relyingParty.AsAjaxPreloadedDiscoveryResultAsync(results, cancellationToken);
9795
}
9896

99-
public async Task<ActionResult> ProcessAjaxOpenIdResponseAsync(CancellationToken cancellationToken = default(CancellationToken)) {
100-
return (await relyingParty.ProcessResponseFromPopupAsync(cancellationToken)).AsActionResult();
101-
}
102-
103-
public Task<IAuthenticationResponse> GetResponseAsync(CancellationToken cancellationToken = default(CancellationToken)) {
104-
return relyingParty.GetResponseAsync(cancellationToken);
97+
public async Task<ActionResult> ProcessAjaxOpenIdResponseAsync(HttpRequestBase request, CancellationToken cancellationToken = default(CancellationToken)) {
98+
return (await relyingParty.ProcessResponseFromPopupAsync(request, cancellationToken)).AsActionResult();
10599
}
106100

107101
public Task<IAuthenticationResponse> GetResponseAsync(HttpRequestBase request, CancellationToken cancellationToken = default(CancellationToken)) {

projecttemplates/MvcRelyingParty/Controllers/AccountController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public async Task<ActionResult> Authorize() {
7676
}
7777

7878
[Authorize, AcceptVerbs(HttpVerbs.Post), ValidateAntiForgeryToken]
79-
public async Task<ActionResult> AuthorizeResponseAsync(bool isApproved) {
79+
public async Task<ActionResult> AuthorizeResponse(bool isApproved) {
8080
var pendingRequest = await OAuthServiceProvider.AuthorizationServer.ReadAuthorizationRequestAsync(Request, Response.ClientDisconnectedToken);
8181
if (pendingRequest == null) {
8282
throw new HttpException((int)HttpStatusCode.BadRequest, "Missing authorization request.");

projecttemplates/MvcRelyingParty/Controllers/AuthController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public async Task<ActionResult> LogOnPopUp() {
106106
/// </remarks>
107107
[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post), ValidateInput(false)]
108108
public Task<ActionResult> PopUpReturnTo() {
109-
return this.RelyingParty.ProcessAjaxOpenIdResponseAsync(Response.ClientDisconnectedToken);
109+
return this.RelyingParty.ProcessAjaxOpenIdResponseAsync(this.Request, this.Response.ClientDisconnectedToken);
110110
}
111111

112112
/// <summary>
@@ -128,7 +128,7 @@ public async Task<ActionResult> LogOnPostAssertion(string openid_openidAuthData)
128128
HttpRequestBase clientResponseInfo = HttpRequestInfo.Create("GET", auth, headers: Request.Headers);
129129
response = await this.RelyingParty.GetResponseAsync(clientResponseInfo, Response.ClientDisconnectedToken);
130130
} else {
131-
response = await this.RelyingParty.GetResponseAsync(Response.ClientDisconnectedToken);
131+
response = await this.RelyingParty.GetResponseAsync(Request, Response.ClientDisconnectedToken);
132132
}
133133
if (response != null) {
134134
switch (response.Status) {

projecttemplates/MvcRelyingParty/OAuthTokenEndpoint.ashx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public override bool IsReusable {
4040
protected override async Task ProcessRequestAsync(HttpContext context) {
4141
var serviceProvider = OAuthServiceProvider.AuthorizationServer;
4242
var response = await serviceProvider.HandleTokenRequestAsync(new HttpRequestWrapper(context.Request), context.Response.ClientDisconnectedToken);
43-
await response.SendAsync(new HttpResponseWrapper(context.Response), context.Response.ClientDisconnectedToken);
43+
await response.SendAsync(new HttpContextWrapper(context), context.Response.ClientDisconnectedToken);
4444
}
4545
}
4646
}

projecttemplates/WebFormsRelyingParty/Members/OAuthAuthorize.aspx.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected async void Page_Load(object sender, EventArgs e) {
3939
if (((OAuthAuthorizationServer)OAuthServiceProvider.AuthorizationServer.AuthorizationServerServices).CanBeAutoApproved(this.pendingRequest)) {
4040
var response = OAuthServiceProvider.AuthorizationServer.PrepareApproveAuthorizationRequest(this.pendingRequest, HttpContext.Current.User.Identity.Name);
4141
var responseMessage = await OAuthServiceProvider.AuthorizationServer.Channel.PrepareResponseAsync(response, Response.ClientDisconnectedToken);
42-
await responseMessage.SendAsync(new HttpResponseWrapper(Response), Response.ClientDisconnectedToken);
42+
await responseMessage.SendAsync(new HttpContextWrapper(this.Context), Response.ClientDisconnectedToken);
4343
}
4444
this.ViewState["AuthRequest"] = this.pendingRequest;
4545
} else {
@@ -59,13 +59,13 @@ protected async void yesButton_Click(object sender, EventArgs e) {
5959
});
6060
var response = OAuthServiceProvider.AuthorizationServer.PrepareApproveAuthorizationRequest(this.pendingRequest, HttpContext.Current.User.Identity.Name);
6161
var responseMessage = await OAuthServiceProvider.AuthorizationServer.Channel.PrepareResponseAsync(response, Response.ClientDisconnectedToken);
62-
await responseMessage.SendAsync(new HttpResponseWrapper(Response), Response.ClientDisconnectedToken);
62+
await responseMessage.SendAsync(new HttpContextWrapper(this.Context), Response.ClientDisconnectedToken);
6363
}
6464

6565
protected async void noButton_Click(object sender, EventArgs e) {
6666
var response = OAuthServiceProvider.AuthorizationServer.PrepareRejectAuthorizationRequest(this.pendingRequest);
6767
var responseMessage = await OAuthServiceProvider.AuthorizationServer.Channel.PrepareResponseAsync(response, Response.ClientDisconnectedToken);
68-
await responseMessage.SendAsync(new HttpResponseWrapper(Response), Response.ClientDisconnectedToken);
68+
await responseMessage.SendAsync(new HttpContextWrapper(this.Context), Response.ClientDisconnectedToken);
6969
}
7070
}
7171
}

projecttemplates/WebFormsRelyingParty/OAuthTokenEndpoint.ashx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public override bool IsReusable {
4040
protected override async Task ProcessRequestAsync(HttpContext context) {
4141
var serviceProvider = OAuthServiceProvider.AuthorizationServer;
4242
var response = await serviceProvider.HandleTokenRequestAsync(new HttpRequestWrapper(context.Request), context.Response.ClientDisconnectedToken);
43-
await response.SendAsync(new HttpResponseWrapper(context.Response), context.Response.ClientDisconnectedToken);
43+
await response.SendAsync(new HttpContextWrapper(context), context.Response.ClientDisconnectedToken);
4444
}
4545
}
4646
}

samples/OAuthClient/Facebook.aspx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected async void Page_Load(object sender, EventArgs e) {
1919
if (authorization == null) {
2020
// Kick off authorization request
2121
var request = await client.PrepareRequestUserAuthorizationAsync(cancellationToken: Response.ClientDisconnectedToken);
22-
await request.SendAsync(new HttpResponseWrapper(Response), Response.ClientDisconnectedToken);
22+
await request.SendAsync(new HttpContextWrapper(Context), Response.ClientDisconnectedToken);
2323
} else {
2424
var request = WebRequest.Create("https://graph.facebook.com/me?access_token=" + Uri.EscapeDataString(authorization.AccessToken));
2525
using (var response = request.GetResponse()) {

samples/OAuthClient/WindowsLive.aspx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected async void Page_Load(object sender, EventArgs e) {
3030
if (authorization == null) {
3131
// Kick off authorization request
3232
var request = await client.PrepareRequestUserAuthorizationAsync(scopes: new[] { WindowsLiveClient.Scopes.Basic }); // this scope isn't even required just to log in
33-
await request.SendAsync(new HttpResponseWrapper(Response), Response.ClientDisconnectedToken);
33+
await request.SendAsync(new HttpContextWrapper(this.Context), Response.ClientDisconnectedToken);
3434
} else {
3535
var request =
3636
WebRequest.Create("https://apis.live.net/v5.0/me?access_token=" + Uri.EscapeDataString(authorization.AccessToken));

samples/OAuthConsumer/GoogleApps2Legged.aspx.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@ protected async void Page_Load(object sender, EventArgs e) {
1919
await httpClient.GetAsync("http://someUri", Response.ClientDisconnectedToken);
2020
}
2121
}
22+
23+
protected void getAddressBookButton_Click(object sender, EventArgs e) {
24+
throw new NotImplementedException();
25+
}
2226
}
2327
}

samples/OAuthConsumer/SignInWithTwitter.aspx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
</asp:Panel>
3434
</asp:View>
3535
</asp:MultiView>
36+
</div>
3637
</form>
3738
</body>
3839
</html>

0 commit comments

Comments
 (0)