Exemplo n.º 1
0
        /// <summary>
        /// Logs a user into the application but performs no
        /// authentication. The user should have already passed
        /// authentication prior to calling this method.
        /// </summary>
        /// <param name="userId">The id of the user to log in.</param>
        /// <param name="rememberUser">
        /// True if the user should stay logged in perminantely; false
        /// if the user should only stay logged in for the duration of
        /// the session.
        /// </param>
        public async Task LogAuthenticatedUserInAsync(int userId, bool rememberUser)
        {
            // Remove any existing login (user may be switching between login areas)
            SignOut();

            var command = new LogAuthenticatedUserInCommand()
            {
                UserId = userId
            };
            await _commandExecutor.ExecuteAsync(command);

            _userSessionService.SetCurrentUserId(userId, rememberUser);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Logs a user into the application but performs no
        /// authentication. The user should have already passed
        /// authentication prior to calling this method.
        /// </summary>
        /// <param name="userAreaCode">The code of the user area to log into.</param>
        /// <param name="userId">The id of the user to log in.</param>
        /// <param name="rememberUser">
        /// True if the user should stay logged in perminantely; false
        /// if the user should only stay logged in for the duration of
        /// the session.
        /// </param>
        public async Task LogAuthenticatedUserInAsync(string userAreaCode, int userId, bool rememberUser)
        {
            // Remove any existing login
            await SignOutAsync(userAreaCode);

            var command = new LogAuthenticatedUserInCommand()
            {
                UserId = userId
            };
            await _commandExecutor.ExecuteAsync(command);

            await _userSessionService.LogUserInAsync(userAreaCode, userId, rememberUser);
        }