public static IdentityServerServiceFactory Configure(this IdentityServerServiceFactory factory) { factory .UseInMemoryClients(Clients.Load()) .UseInMemoryScopes(Scopes.Load()); factory.Register(new Registration <WasteContext>(resolver => new WasteContext(null))); factory.Register(new Registration <UserStore>()); factory.Register(new Registration <UserManager>()); factory.UserService = new Registration <IUserService, IdentityUserService>(); return(factory); }
// 1. AppHandler // 2. AuthorizeAttribute // 3. DefaultRole InfoLogService // 4. Perfomance IUserService ++ // 5. Loger fileName InfoLogService ++ // 6. canActivate: [RocketAuthGuard] front // 7. delete /Users front. ++ public void Configuration(IAppBuilder app) { app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll); app.MapSignalR(); var factory = new IdentityServerServiceFactory() { UserService = new Registration <IUserService, RocketIdentityService>() } .UseInMemoryClients(Clients.Load()) .UseInMemoryScopes(Scopes.Load()); factory.Register(new Registration <UserManager <DbUser, string> >()); factory.Register(new Registration <IUserStore <DbUser, string> >(resolver => new UserStore <DbUser>(new RocketContext()))); app.UseIdentityServer(new IdentityServerOptions { RequireSsl = false, SiteName = "Identity Server", SigningCertificate = LoadCertificate(), EnableWelcomePage = false, Factory = factory }); var opt = new IdentityServerBearerTokenAuthenticationOptions { Authority = "http://localhost:63613", // ? RequiredScopes = new[] { "openid" }, IssuerName = "http://localhost:63613", // ? SigningCertificate = LoadCertificate(), ValidationMode = ValidationMode.Local }; app.UseIdentityServerBearerTokenAuthentication(opt); }