private IIdentity GetCurrentIdentity() { var currentIdentity = _userIdentityProvider.GetUserIdentity(); var currentUserId = currentIdentity.GetUserId(); var isNotAuthenticated = string.IsNullOrEmpty(currentUserId); return(isNotAuthenticated ? null : currentIdentity); }
private IIdentity GetCurrentIdentity() { var currentIdentity = _userIdentityProvider.GetUserIdentity(); if (currentIdentity != null && !currentIdentity.IsAuthenticated) { throw new InvalidOperationException(Resources.RequestIsNotAuthenticated); } return(currentIdentity); }
private string GetCurrentUserId() { var currentIdentity = _userIdentityProvider.GetUserIdentity(); var currentUserId = currentIdentity.GetUserId(); var isNotAuthenticated = string.IsNullOrEmpty(currentUserId); if (isNotAuthenticated) { throw new InvalidOperationException(Resources.RequestIsNotAuthenticated); } return(currentUserId); }
private Tuple <string, string> GetCurrentUserInfo() { var userIdentity = _userIdentityProvider.GetUserIdentity(); var userName = DocumentStorageHelpers.AnonymousUser; var userId = DocumentStorageHelpers.AnonymousUser; if (userIdentity != null && userIdentity.IsAuthenticated) { userName = userIdentity.Name; userId = userIdentity.GetUserId(); } return(new Tuple <string, string>(userName, userId)); }