From dde3dc1acab93660f5e71b333ca473d17b7ee459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Wed, 12 Oct 2016 13:21:58 +0200 Subject: [PATCH] Update the Mvc.Server sample to use the default entity key type --- .../Mvc.Server/Controllers/AuthorizationController.cs | 5 ++--- samples/Mvc.Server/Models/ApplicationDbContext.cs | 2 +- samples/Mvc.Server/Models/ApplicationUser.cs | 2 +- samples/Mvc.Server/Startup.cs | 10 +++++----- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/samples/Mvc.Server/Controllers/AuthorizationController.cs b/samples/Mvc.Server/Controllers/AuthorizationController.cs index e5b11955..d0c7937e 100644 --- a/samples/Mvc.Server/Controllers/AuthorizationController.cs +++ b/samples/Mvc.Server/Controllers/AuthorizationController.cs @@ -4,7 +4,6 @@ * the license and the contributors participating to this project. */ -using System; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; @@ -22,12 +21,12 @@ using OpenIddict; namespace Mvc.Server { public class AuthorizationController : Controller { - private readonly OpenIddictApplicationManager> _applicationManager; + private readonly OpenIddictApplicationManager _applicationManager; private readonly SignInManager _signInManager; private readonly UserManager _userManager; public AuthorizationController( - OpenIddictApplicationManager> applicationManager, + OpenIddictApplicationManager applicationManager, SignInManager signInManager, UserManager userManager) { _applicationManager = applicationManager; diff --git a/samples/Mvc.Server/Models/ApplicationDbContext.cs b/samples/Mvc.Server/Models/ApplicationDbContext.cs index 6cd1398a..3aca6de3 100644 --- a/samples/Mvc.Server/Models/ApplicationDbContext.cs +++ b/samples/Mvc.Server/Models/ApplicationDbContext.cs @@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore; using OpenIddict; namespace Mvc.Server.Models { - public class ApplicationDbContext : OpenIddictDbContext, Guid> { + public class ApplicationDbContext : OpenIddictDbContext { public ApplicationDbContext(DbContextOptions options) : base(options) { } diff --git a/samples/Mvc.Server/Models/ApplicationUser.cs b/samples/Mvc.Server/Models/ApplicationUser.cs index c83df9f3..19c02c98 100644 --- a/samples/Mvc.Server/Models/ApplicationUser.cs +++ b/samples/Mvc.Server/Models/ApplicationUser.cs @@ -3,5 +3,5 @@ using OpenIddict; namespace Mvc.Server.Models { // Add profile data for application users by adding properties to the ApplicationUser class - public class ApplicationUser : OpenIddictUser { } + public class ApplicationUser : OpenIddictUser { } } diff --git a/samples/Mvc.Server/Startup.cs b/samples/Mvc.Server/Startup.cs index fb445f99..3196bc12 100644 --- a/samples/Mvc.Server/Startup.cs +++ b/samples/Mvc.Server/Startup.cs @@ -25,12 +25,12 @@ namespace Mvc.Server { options.UseSqlServer(configuration["Data:DefaultConnection:ConnectionString"])); // Register the Identity services. - services.AddIdentity>() - .AddEntityFrameworkStores() + services.AddIdentity() + .AddEntityFrameworkStores() .AddDefaultTokenProviders(); // Register the OpenIddict services, including the default Entity Framework stores. - services.AddOpenIddict() + services.AddOpenIddict() // Register the ASP.NET Core MVC binder used by OpenIddict. // Note: if you don't call this method, you won't be able to // bind OpenIdConnectRequest or OpenIdConnectResponse parameters. @@ -149,7 +149,7 @@ namespace Mvc.Server { // Type = OpenIddictConstants.ClientTypes.Confidential // }); - context.Applications.Add(new OpenIddictApplication { + context.Applications.Add(new OpenIddictApplication { ClientId = "myClient", ClientSecret = Crypto.HashPassword("secret_secret_secret"), DisplayName = "My client application", @@ -167,7 +167,7 @@ namespace Mvc.Server { // * Scope: openid email profile roles // * Grant type: authorization code // * Request access token locally: yes - context.Applications.Add(new OpenIddictApplication { + context.Applications.Add(new OpenIddictApplication { ClientId = "postman", DisplayName = "Postman", RedirectUri = "https://www.getpostman.com/oauth2/callback",