Exemplo n.º 1
0
        public async Task <IUserSession> AuthenticateAsync(long tenantId, LogonModel model)
        {
            try
            {
                // Validate supplier logon user credentials
                await _authenticationValidator.ValidateLogonAsync(tenantId, model);

                // Get user session, comprising identity and security token
                IUserSession session = new UserSession();
                session.Identity = await _userRepository.ReadUserIdentityAsync(tenantId, model.Email.Trim().ToLower());

                session.Security = new UserSecurity
                {
                    Token = _securityTokenService.GenerateToken(session.Identity)
                };

                // Return user session
                return(session);
            }
            catch (UserLockedOutException)
            {
                throw;
            }
        }