/// <summary> /// Get the currently logged in user /// </summary> private User GetLoggedInUser(INancyModule nancyModule) { var currentUser = nancyModule.GetPrincipal(); if (!currentUser.IsAuthenticated()) return null; if (string.IsNullOrWhiteSpace(currentUser.Email)) return null; User loggedInUser = null;//ReadStore.Users.Get(currentUser.Email).FirstOrDefault(); return loggedInUser; }
/// <summary> /// Get the currently logged in user /// </summary> private User GetLoggedInUser(INancyModule nancyModule) { var currentUser = nancyModule.GetPrincipal(); if (!currentUser.IsAuthenticated()) { return(null); } if (string.IsNullOrWhiteSpace(currentUser.Email)) { return(null); } User loggedInUser = null;//ReadStore.Users.Get(currentUser.Email).FirstOrDefault(); return(loggedInUser); }
public static bool IsAuthenticated(this INancyModule module) { return(module.GetPrincipal().IsAuthenticated()); }