Esempio n. 1
0
        public AccountController(SignInManager <ApplicationUser> signInManager, ILoggingServices loggingServices)
        {
            _signInManager = signInManager;

            #region Template
            _loggingServices = loggingServices;
            logModel         = new LogModel();
            userScopesModel  = new UserScopesModel(HttpContext);
            logModel.SetModel(userScopesModel.Subject.ToString(), userScopesModel.Name, nameof(AccountController), ApplicationNames.AuthorizationServer, LogTypeEnum.Info);
            #endregion
        }
        public URLConfigurationController(IConfigurationDBUnitOfWork configurationDBUnitOfWork, ILoggingServices loggingServices)
        {
            _configurationDBUnitOfWork = configurationDBUnitOfWork;

            #region Template
            _loggingServices = loggingServices;
            logModel         = new LogModel();
            userScopesModel  = new UserScopesModel(HttpContext);
            logModel.SetModel(userScopesModel.Subject.ToString(), userScopesModel.Name, nameof(URLConfigurationController), ApplicationNames.ConfigurationServer, LogTypeEnum.Info);
            #endregion
        }
Esempio n. 3
0
        public Disable2faModel(
            UserManager <ApplicationUser> userManager,
            ILoggingServices loggingServices)
        {
            _userManager = userManager;

            #region Template
            _loggingServices = loggingServices;
            logModel         = new LogModel();
            userScopesModel  = new UserScopesModel(HttpContext);
            logModel.SetModel(userScopesModel.Subject.ToString(), userScopesModel.Name, nameof(Disable2faModel), ApplicationNames.AuthorizationServer, LogTypeEnum.Info);
            #endregion
        }
Esempio n. 4
0
        public LoginModel(SignInManager <ApplicationUser> signInManager,
                          IIdentityServerInteractionService interaction,
                          ILoggingServices loggingServices)
        {
            _signInManager = signInManager;

            #region Template
            _loggingServices = loggingServices;

            logModel        = new LogModel();
            userScopesModel = new UserScopesModel(HttpContext);
            logModel.SetModel(userScopesModel.Subject.ToString(), userScopesModel.Name, nameof(LoginModel), ApplicationNames.AuthorizationServer, LogTypeEnum.Info);
            #endregion

            _interaction = interaction;
        }
        public RegisterModel(
            UserManager <ApplicationUser> userManager,
            SignInManager <ApplicationUser> signInManager,
            IEmailServices emailSender,
            ILoggingServices loggingServices)
        {
            _userManager   = userManager;
            _signInManager = signInManager;
            _emailSender   = emailSender;

            #region Template
            _loggingServices = loggingServices;

            logModel        = new LogModel();
            userScopesModel = new UserScopesModel(HttpContext);
            logModel.SetModel(userScopesModel.Subject.ToString(), userScopesModel.Name, nameof(RegisterModel), ApplicationNames.AuthorizationServer, LogTypeEnum.Info);
            #endregion
        }
        public ConsentService(
            IIdentityServerInteractionService interaction,
            IClientStore clientStore,
            IResourceStore resourceStore,
            HttpContext httpContext,
            ILoggingServices loggingServices)
        {
            _interaction   = interaction;
            _clientStore   = clientStore;
            _resourceStore = resourceStore;

            #region Template
            _loggingServices = loggingServices;
            logModel         = new LogModel();
            userScopesModel  = new UserScopesModel(httpContext);
            logModel.SetModel(userScopesModel.Subject.ToString(), userScopesModel.Name, nameof(TLogger), ApplicationNames.AuthorizationServer, LogTypeEnum.Error);
            #endregion
        }
        public override void ExecuteResult(ActionContext context)
        {
            #region Log Terminal
            var userScopesModel = new UserScopesModel(context.HttpContext);
            var logModel        = new LogModel()
            {
                CurrentApplication = _exception.Source,
                LogException       = _exception,
                LoggerName         = _exception.Source,
                LogMessage         = _exception.Message,
                LogType            = LogTypeEnum.Error,
                UserID             = userScopesModel.Subject.ToString(),
                UserLogin          = userScopesModel.Name
            };

            _logger.Error(logModel);
            #endregion
            var response = context.HttpContext.Response;
            var result   = JsonConvert.SerializeObject(new { error = _exception.Message });
            response.ContentType = "application/json";
            response.StatusCode  = (int)HttpStatusCode.BadRequest;
            response.WriteAsync(result).Wait();
        }