diff options
| author | Michael <[email protected]> | 2017-04-17 09:21:15 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-04-17 09:21:15 -0400 |
| commit | 41ced12e3b43ce74d022cc075f645f23cb6b94ec (patch) | |
| tree | 878549a7b2f7afe7d1a17fb5757bcb9cd3d085fe /Project-Unite/App_Start/Startup.Auth.cs | |
| parent | f87ad0550b36feaf5447d5bbcd0b6cde2f8b83d0 (diff) | |
| download | project-unite-41ced12e3b43ce74d022cc075f645f23cb6b94ec.tar.gz project-unite-41ced12e3b43ce74d022cc075f645f23cb6b94ec.tar.bz2 project-unite-41ced12e3b43ce74d022cc075f645f23cb6b94ec.zip | |
fix user provider
Diffstat (limited to 'Project-Unite/App_Start/Startup.Auth.cs')
| -rw-r--r-- | Project-Unite/App_Start/Startup.Auth.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Project-Unite/App_Start/Startup.Auth.cs b/Project-Unite/App_Start/Startup.Auth.cs index 6852f3e..4b6951d 100644 --- a/Project-Unite/App_Start/Startup.Auth.cs +++ b/Project-Unite/App_Start/Startup.Auth.cs @@ -1,6 +1,8 @@ using System; +using System.Linq; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.Owin; +using Microsoft.AspNet.SignalR; using Microsoft.Owin; using Microsoft.Owin.Security.Cookies; using Microsoft.Owin.Security.Google; @@ -14,6 +16,10 @@ namespace Project_Unite // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864 public void ConfigureAuth(IAppBuilder app) { + var idProvider = new UniteUserIdProvider(); + + GlobalHost.DependencyResolver.Register(typeof(IUserIdProvider), () => idProvider); + app.MapSignalR(); @@ -70,4 +76,13 @@ namespace Project_Unite } } + + public class UniteUserIdProvider : IUserIdProvider + { + public string GetUserId(IRequest request) + { + var db = new ApplicationDbContext(); + return db.Users.FirstOrDefault(x => x.UserName == request.User.Identity.Name).Id; + } + } }
\ No newline at end of file |
