/// <summary>
        /// Sign In User method.
        /// </summary>
        /// <param name="username">Username parameter.</param>
        /// <param name="isPersistent">Is persistent parameter.</param>
        private void SignInUser(ISSOUser user, bool isPersistent)
        {
            // Initialization.
            var claims = new List <Claim>();

            try
            {
                // Setting
                claims.Add(new Claim(ClaimTypes.Name, user.Name));
                claims.Add(new Claim(ClaimTypes.System, user.ExternalId.ToString()));
                claims.Add(new Claim(ClaimTypes.Email, user.Email));
                claims.Add(new Claim(ClaimTypes.NameIdentifier, user.UserName));
                var claimIdenties         = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie);
                var ctx                   = Request.GetOwinContext();
                var authenticationManager = ctx.Authentication;
                // Sign In.
                authenticationManager.SignIn(new AuthenticationProperties()
                {
                    IsPersistent = isPersistent,
                }, claimIdenties);
            }
            catch (Exception ex)
            {
                // Info
                throw ex;
            }
        }
Example #2
0
 public ProjectController(ILogger <ProjectController> logger, IProjectRepository projectRepository, ILogRepository logRepository, ISSOUser sSOUser)
 {
     _logger            = logger;
     _projectRepository = projectRepository;
     _logRepository     = logRepository;
     _ssoUser           = sSOUser;
 }
Example #3
0
 //rd  就是result data
 public DataManageController(ILogger <DataManageController> logger, IDataManageRepository dataManageRepository, ISSOUser sSOUser, ILogRepository logRepository)
 {
     _logger = logger;
     _dataManageRepository = dataManageRepository;
     _ssoUser       = sSOUser;
     _logRepository = logRepository;
 }
Example #4
0
 public DataSetController(ILogger <DataSetController> logger, IDataSetRepository dataSetRepository, ILogRepository logRepository, ISSOUser sSOUser)
 {
     _logger            = logger;
     _dataSetRepository = dataSetRepository;
     _logRepository     = logRepository;
     _ssoUser           = sSOUser;
 }
Example #5
0
 public HomeController(ILogger <HomeController> logger, IProjectRepository projectRepository, IHttpContextAccessor httpContextAccessor, ISSOUser sSOUser)
 {
     _logger              = logger;
     _projectRepository   = projectRepository;
     _httpContextAccessor = httpContextAccessor;
     _ssoUser             = sSOUser;
 }
Example #6
0
 public LogController(ILogRepository logRepository, ILogger <LogController> logger, ISSOUser sSOUser)
 {
     _logRepository = logRepository;
     _logger        = logger;
     _ssoUser       = sSOUser;
 }
Example #7
0
 public LogRepository(ILogger<LogRepository> logger, IHttpContextAccessor httpContextAccessor, ISSOUser sSOUser)
 {
     _logger = logger;
     _httpContextAccessor = httpContextAccessor;
     _ssoUser = sSOUser;
 }