public UserService(ISSOService ssoService, IRepositoryCommand <User, long> userCommandRepo, IRepositoryQuery <User, long> userQueryRepo, IRepositoryCommand <UserRole, long> userRoleCommandRepo, IRepositoryQuery <UserRole, long> userRoleQueryRepo, IRepositoryQuery <Role, long> roleQueryRepo, IRepositoryQuery <Company, long> companyQueryRepo, IEmailService emailService, IMapper mapper, IOptions <SSoSetting> sSoSetting, IHttpContextExtensionService httpContext) { _ssoSettings = sSoSetting.Value; _ssoService = ssoService; _userCommandRepo = userCommandRepo; _userQueryRepo = userQueryRepo; _userRoleCommandRepo = userRoleCommandRepo; _roleQueryRepo = roleQueryRepo; _companyQueryRepo = companyQueryRepo; _emailService = emailService; _mapper = mapper; _userRoleQueryRepo = userRoleQueryRepo; _httpContext = httpContext; CurrentUserId = _httpContext.GetCurrentSSOUserId(); }
public CompanyService( IRepositoryCommand <Company, long> companyCommandRepo, IRepositoryQuery <Company, long> companyQueryRepo, IMapper mapper, IHttpContextExtensionService httpContext) { _companyCommandRepo = companyCommandRepo; _companyQueryRepo = companyQueryRepo; _mapper = mapper; _httpContext = httpContext; }
public DepartmentService( IRepositoryCommand <Department, long> departmentCommandRepo, IRepositoryQuery <Department, long> departmentQueryRepo, IMapper mapper, IHttpContextExtensionService httpContext) { _departmentCommandRepo = departmentCommandRepo; _departmentQueryRepo = departmentQueryRepo; _mapper = mapper; _httpContext = httpContext; }
public MetricService( IRepositoryCommand <Metric, long> metricCommandRepo, IRepositoryQuery <Metric, long> metricQueryRepo, IRepositoryQuery <Department, long> departmentQueryRepo, IMapper mapper, IHttpContextExtensionService httpContext) { _metricCommandRepo = metricCommandRepo; _metricQueryRepo = metricQueryRepo; _departmentQueryRepo = departmentQueryRepo; _mapper = mapper; _httpContext = httpContext; }
public VenueService( IRepositoryCommand <Venue, long> venueCommandRepo, IRepositoryQuery <Venue, long> venueQueryRepo, IRepositoryQuery <InterviewSession, long> interviewSessionQueryRepo, IMapper mapper, IHttpContextExtensionService httpContext) { _venueCommandRepo = venueCommandRepo; _venueQueryRepo = venueQueryRepo; _interviewSessionQueryRepo = interviewSessionQueryRepo; _mapper = mapper; _httpContext = httpContext; }
public JobRoleService( IRepositoryCommand <JobRole, long> jobRoleCommandRepo, IRepositoryQuery <JobRole, long> jobRoleQueryRepo, IRepositoryQuery <Department, long> departmentQueryRepo, IMapper mapper, IHttpContextExtensionService httpContext) { _jobRoleCommandRepo = jobRoleCommandRepo; _jobRoleQueryRepo = jobRoleQueryRepo; _departmentQueryRepo = departmentQueryRepo; _mapper = mapper; _httpContext = httpContext; }
public AuthService( IRepositoryQuery <User, long> userQueryRepo, IRepositoryCommand <User, long> userCommandRepo, ISSOService ssoService, IUserService userService, IEmailService emailService, IHttpContextExtensionService httpContextExtensionService) { _httpContextService = httpContextExtensionService; _ssoService = ssoService; _userService = userService; _emailService = emailService; _userQueryRepo = userQueryRepo; _userCommandRepo = userCommandRepo; }
public InterviewSessionService( IRepositoryCommand <InterviewSession, long> interviewSessionCommandRepo, IRepositoryQuery <InterviewSession, long> interviewSessionQueryRepo, IRepositoryQuery <InterviewSessionMetric, long> interviewSessionMetricQueryRepo, IRepositoryCommand <InterviewSessionMetric, long> interviewSessionMetricCommandRepo, IRepositoryQuery <InterviewSessionInterviewer, long> interviewSessionInterviewerQueryRepo, IRepositoryCommand <InterviewSessionInterviewer, long> interviewSessionInterviewerCommandRepo, IRepositoryQuery <InterviewSessionCandidate, long> interviewSessionCandidateQueryRepo, IRepositoryCommand <InterviewSessionCandidate, long> interviewSessionCandidateCommandRepo, IMapper mapper, IHttpContextExtensionService httpContext) { _interviewSessionCommandRepo = interviewSessionCommandRepo; _interviewSessionQueryRepo = interviewSessionQueryRepo; _interviewSessionMetricQueryRepo = interviewSessionMetricQueryRepo; _interviewSessionMetricCommandRepo = interviewSessionMetricCommandRepo; _interviewSessionInterviewerQueryRepo = interviewSessionInterviewerQueryRepo; _interviewSessionInterviewerCommandRepo = interviewSessionInterviewerCommandRepo; _interviewSessionCandidateQueryRepo = interviewSessionCandidateQueryRepo; _interviewSessionCandidateCommandRepo = interviewSessionCandidateCommandRepo; _mapper = mapper; _httpContext = httpContext; }
public async Task Invoke(HttpContext context, IServiceProvider serviceProvider) { try { if (context.Request.Headers.ContainsKey("Authorization") && context.User.Identity.IsAuthenticated) { // get sub IHttpContextExtensionService httpExtSrv = (IHttpContextExtensionService)serviceProvider.GetService(typeof(IHttpContextExtensionService)); string userId = httpExtSrv.GetCurrentSSOUserId(); if (string.IsNullOrEmpty(userId)) { throw new SecurityTokenValidationException(); } IAuthService authMgr = (IAuthService)serviceProvider.GetService(typeof(IAuthService)); Claim[] claims = await authMgr.ValidateUser(userId); if (claims.Length > 0) { context.User.AddIdentity(new ClaimsIdentity(claims)); } } await next(context); } catch (Exception ex) { Log.Error(ex); var content = GlobalExceptionFilter.GetStatusCode <object>(ex); var res = JsonConvert.SerializeObject(content.responseModel, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); HttpResponse response = context.Response; context.Response.ContentType = "application/json"; response.StatusCode = (int)content.statusCode; await context.Response.WriteAsync(res); } }