-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Fix bug of CAE new request disposing #17214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d051024 to
9f61555
Compare
isra-fel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Have you tested CAE scenario?
| if (!string.IsNullOrEmpty(claimsChallenge)) | ||
| { | ||
| await processor.OnClaimsChallenageAsync(newRequest, claimsChallenge, cancelToken).ConfigureAwait(false); | ||
| response = await next(newRequest, cancelToken, cancelAction, signal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I double check the code and think we need to dispose the old response here.
isra-fel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Request are used after disposed in AuthenticationHelper and so the previous request cannot be disposed. The new request should be disposed finally.
3d38660 to
369e246
Compare
| var response = await next(request, cancelToken, cancelAction, signal); | ||
|
|
||
| if (response.MatchClaimsChallengePattern()) | ||
| using (var newRequest = await request.CloneWithContent(request.RequestUri, request.Method)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| using (var newRequest = await request.CloneWithContent(request.RequestUri, request.Method)) | |
| using (var newRequest = await request.CloneWithContent(request.RequestUri, request.Method)) | |
| using (var response = await next(request, cancelToken, cancelAction, signal)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refer to the implementation of pipeline, the original request and response will be disposed finally.
Request are used after disposed in AuthenticationHelper and so the previous request cannot be disposed.
The new request should be disposed finally.
Description
Checklist
CONTRIBUTING.mdChangeLog.mdfile(s) has been updated:ChangeLog.mdfile can be found atsrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md## Upcoming Releaseheader -- no new version header should be added