Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Add AuthenticationProperties to HandleRequestResult and RemoteFailureContext #1299

Merged
merged 1 commit into from
Sep 27, 2017

Conversation

Tratcher
Copy link
Member

@Tratcher Tratcher commented Jul 6, 2017

#1188 Requires aspnet/HttpAbstractions#889
User state for the login is flown via auth properties, but these aren't available in the OnRemoteFailure event. To add them we need to flow them via the AuthResult.

If this works out then we may use it to flow additional data for #1178. The difference is that the data in #1178 isn't a consistent data structure across handlers.

/cc: @brockallen

@Tratcher Tratcher added this to the 2.0.0 milestone Jul 6, 2017
@Tratcher Tratcher self-assigned this Jul 6, 2017
@Tratcher Tratcher requested a review from HaoK July 6, 2017 19:41
@dnfclas
Copy link

dnfclas commented Jul 6, 2017

@Tratcher,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by .NET Foundation. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot

@brockallen
Copy link

More for @anitchanana than for me to review.

@Tratcher Tratcher force-pushed the tratcher/authfailed branch from 4ed0b5e to 5d7be8a Compare July 7, 2017 17:53
@@ -475,6 +475,12 @@ protected virtual Task<bool> HandleSignOutCallbackAsync()
authorizationResponse = messageReceivedContext.ProtocolMessage;
properties = messageReceivedContext.Properties;

// if any of the error fields are set, throw error null
if (!string.IsNullOrEmpty(authorizationResponse.Error))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unwanted change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to make the order of operations consistent between OAuth and OIDC.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, that would be better to fix the OAuth2 handler to validate the state/XSRF cookie before handling the error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair. I was worried about the state being dropped for some error responses and thus hiding the error response with a correlation failure. Not sure how often that happens in practice.

@Tratcher Tratcher modified the milestones: 2.1.0, 2.0.0 Jul 7, 2017
@Tratcher Tratcher force-pushed the tratcher/authfailed branch 3 times, most recently from 46af5bc to 88e91f6 Compare September 26, 2017 17:12
@Tratcher
Copy link
Member Author

bump
I've filled out the tests and addressed some of the ordering issues.

if (!string.IsNullOrEmpty(authorizationResponse.State))
{
properties = Options.StateDataFormat.Unprotect(authorizationResponse.State);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: private helper method for this Unprotect/decode clear state block that's repeated?

@@ -11,6 +11,7 @@ namespace Microsoft.AspNetCore.Authentication
/// </summary>
public class RemoteFailureContext : HandleRequestContext<RemoteAuthenticationOptions>
{
[Obsolete]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have some text to go along with the warning?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shrug we don't really expect anyone to use these directly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why bother with obsolete at all, its not incorrect to use this ctor is it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's obsolete as the first step towards getting rid of it, it's not used anymore.

@Tratcher Tratcher force-pushed the tratcher/authfailed branch 2 times, most recently from c0889db to 5fbc418 Compare September 26, 2017 22:15
@Tratcher
Copy link
Member Author

Updated

@Tratcher Tratcher merged commit 144ee21 into dev Sep 27, 2017
@Tratcher Tratcher deleted the tratcher/authfailed branch September 27, 2017 21:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants