Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using Nancy;
  2. using Nancy.Authentication.Forms;
  3. using Nancy.Security;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9.  
  10. namespace Authentication
  11. {
  12.     public class DatabaseUser : IUserMapper
  13.     {
  14.         public IUserIdentity GetUserFromIdentifier(Guid identifier, NancyContext context)
  15.         {
  16.             using (var db = new UserContext())
  17.             {
  18.                 var member = db.Users.SingleOrDefault(u => u.Identifier == identifier);
  19.  
  20.                 if (member == null)
  21.                 {
  22.                     return null;
  23.                 }
  24.  
  25.                 return member;
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement