コード例 #1
0
        private IIdentity GetCurrentIdentity()
        {
            var currentIdentity    = _userIdentityProvider.GetUserIdentity();
            var currentUserId      = currentIdentity.GetUserId();
            var isNotAuthenticated = string.IsNullOrEmpty(currentUserId);

            return(isNotAuthenticated ? null : currentIdentity);
        }
コード例 #2
0
        private IIdentity GetCurrentIdentity()
        {
            var currentIdentity = _userIdentityProvider.GetUserIdentity();

            if (currentIdentity != null && !currentIdentity.IsAuthenticated)
            {
                throw new InvalidOperationException(Resources.RequestIsNotAuthenticated);
            }

            return(currentIdentity);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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));
        }