Browse Source

React to API changes in aspnet-contrib/AspNet.Security.OpenIdConnect.Server

ebc22462aa

65b1a9ab00
pull/34/head
Kévin Chalet 10 years ago
parent
commit
7b97de4912
  1. 12
      src/OpenIddict.Core/OpenIddictBuilder.cs
  2. 10
      src/OpenIddict.Core/OpenIddictExtensions.cs
  3. 2
      src/OpenIddict.Mvc/OpenIddictExtensions.cs

12
src/OpenIddict.Core/OpenIddictBuilder.cs

@ -5,12 +5,7 @@ namespace Microsoft.AspNet.Builder {
/// <summary>
/// Holds various properties allowing to configure OpenIddct.
/// </summary>
public class OpenIddictBuilder : OpenIdConnectServerBuilder {
public OpenIddictBuilder(IApplicationBuilder builder)
: base(builder) {
Options = new OpenIddictOptions();
}
public class OpenIddictBuilder {
/// <summary>
/// Gets the list of the OpenIddict modules.
/// </summary>
@ -19,9 +14,6 @@ namespace Microsoft.AspNet.Builder {
/// <summary>
/// Gets or sets the options used by OpenIddict.
/// </summary>
public new OpenIddictOptions Options {
get { return base.Options as OpenIddictOptions; }
set { base.Options = value; }
}
public OpenIddictOptions Options { get; set; } = new OpenIddictOptions();
}
}

10
src/OpenIddict.Core/OpenIddictExtensions.cs

@ -62,7 +62,10 @@ namespace Microsoft.AspNet.Builder {
public static IApplicationBuilder UseOpenIddictCore(
[NotNull] this IApplicationBuilder app,
[NotNull] Action<OpenIddictBuilder> configuration) {
var builder = new OpenIddictBuilder(app);
var builder = new OpenIddictBuilder();
// Resolve the OpenIddict provider from the services container.
builder.Options.Provider = app.ApplicationServices.GetRequiredService<OpenIdConnectServerProvider>();
// By default, enable AllowInsecureHttp in development/testing environments.
var environment = app.ApplicationServices.GetRequiredService<IHostingEnvironment>();
@ -78,10 +81,7 @@ namespace Microsoft.AspNet.Builder {
}));
// Add OpenIdConnectServerMiddleware to the ASP.NET 5 pipeline.
builder.AddModule(0, map => map.UseOpenIdConnectServer(options => {
options.Options = builder.Options;
options.Provider = app.ApplicationServices.GetRequiredService<OpenIdConnectServerProvider>();
}));
builder.AddModule(0, map => map.UseOpenIdConnectServer(builder.Options));
// Register the OpenIddict modules in the ASP.NET 5 pipeline.
foreach (var module in builder.Modules.OrderBy(module => module.Position)) {

2
src/OpenIddict.Mvc/OpenIddictExtensions.cs

@ -71,7 +71,7 @@ namespace Microsoft.AspNet.Builder {
});
}
}), services => {
var registration = builder.Builder.ApplicationServices.GetRequiredService<OpenIddictServices>();
var registration = app.ApplicationServices.GetRequiredService<OpenIddictServices>();
services.AddMvc()
// Register the OpenIddict controller.

Loading…
Cancel
Save