-
Notifications
You must be signed in to change notification settings - Fork 598
Fix #140, #167, address a comment in #144 and rework the bearer middleware tests #168
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -585,4 +585,4 @@ private async Task<bool> InvokeReplyPathAsync() | |
return false; | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -7,12 +7,12 @@ | |||
using System.IdentityModel.Tokens; | ||||
using System.Net.Http; | ||||
using System.Text; | ||||
using Microsoft.AspNet.Builder; | ||||
using Microsoft.AspNet.DataProtection; | ||||
using Microsoft.AspNet.Http; | ||||
using Microsoft.AspNet.Authentication.DataHandler; | ||||
using Microsoft.AspNet.Authentication.DataHandler.Encoder; | ||||
using Microsoft.AspNet.Authentication.DataHandler.Serializer; | ||||
using Microsoft.AspNet.Builder; | ||||
using Microsoft.AspNet.DataProtection; | ||||
using Microsoft.AspNet.Http; | ||||
using Microsoft.Framework.Logging; | ||||
using Microsoft.Framework.OptionsModel; | ||||
using Microsoft.IdentityModel.Protocols; | ||||
|
@@ -45,9 +45,14 @@ public OpenIdConnectAuthenticationMiddleware( | |||
{ | ||||
_logger = loggerFactory.CreateLogger<OpenIdConnectAuthenticationMiddleware>(); | ||||
|
||||
if (string.IsNullOrEmpty(Options.SignInScheme)) | ||||
{ | ||||
Options.SignInScheme = externalOptions.Options.SignInScheme; | ||||
} | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should you throw if Security/src/Microsoft.AspNet.Authentication.Twitter/TwitterAuthenticationMiddleware.cs Line 74 in e3b457b
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO, the persistence delegation should be optional so that the end dev can implement his own logic, just like the That said, I agree that this kind of inconsistency is bad and should be fixed. https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNet.Authentication.Twitter/TwitterAuthenticationHandler.cs#L206 seems to indicate that we should remove the null check you mentioned and make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, we are talking about SignInScheme that lives on ExternalAuthenticationOptions correct? This should be optional always, since its only useful when forwarding a "passive" (new terminology is Automatic = false), auth middleware's ticket to something automatic like bearer/cookie for persistence. We probably should rename this to convey the usage. Perhaps something like SignInForwardingOptions && SignInScheme maybe? @lodejard what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, this specific That said, I'm not sure that the passive/active/automatic/manual question is pertinent here, as it can be used in both modes (and anyway, this middleware doesn't inherit from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I asked above, so I will ask again here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would require two (or three if you have a global configuration) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So is it more likely to have multiple OIDC middleware in the pipeline, as compared to Google/Facebook/Twitter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More likely? In most cases, I'd say no. But anyway, the same remarks apply to the OAuth2 providers, that also expose a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay for now lets just leave them where they are, I filed #174 to sort this out later There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great 😎 |
||||
|
||||
if (string.IsNullOrWhiteSpace(Options.TokenValidationParameters.AuthenticationType)) | ||||
{ | ||||
Options.TokenValidationParameters.AuthenticationType = externalOptions.Options.SignInScheme; | ||||
Options.TokenValidationParameters.AuthenticationType = Options.AuthenticationScheme; | ||||
} | ||||
|
||||
if (Options.StateDataFormat == null) | ||||
|
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.
What is SignInScheme used for?