public CustomersService(ICredentialsClient credentialsClient,
                         IPostProcessService postProcessService,
                         ICustomerProfileClient customerProfileClient,
                         ICustomerFlagsRepository customerFlagsRepository,
                         ISessionsServiceClient sessionsServiceClient,
                         string passwordSuccessfulChangeEmailTemplateId,
                         string passwordSuccessfulChangeEmailSubjectTemplateId,
                         ILogFactory logFactory,
                         int getCustomerBlockStatusBatchMaxValue,
                         IRabbitPublisher <EmailMessageEvent> emailEventPublisher,
                         string customerBlockEmailTemplateId,
                         string customerUnblockEmailTemplateId,
                         string customerBlockSubjectTemplateId,
                         string customerUnblockSubjectTemplateId,
                         string customerSupportPhoneNumber)
 {
     _credentialsClient       = credentialsClient;
     _postProcessService      = postProcessService;
     _customerProfileClient   = customerProfileClient;
     _sessionsServiceClient   = sessionsServiceClient;
     _customerFlagsRepository = customerFlagsRepository;
     _passwordSuccessfulChangeEmailTemplateId        = passwordSuccessfulChangeEmailTemplateId;
     _passwordSuccessfulChangeEmailSubjectTemplateId = passwordSuccessfulChangeEmailSubjectTemplateId;
     _getCustomerBlockStatusBatchMaxValue            = getCustomerBlockStatusBatchMaxValue;
     _emailEventPublisher              = emailEventPublisher;
     _customerBlockEmailTemplateId     = customerBlockEmailTemplateId;
     _customerUnblockEmailTemplateId   = customerUnblockEmailTemplateId;
     _customerBlockSubjectTemplateId   = customerBlockSubjectTemplateId;
     _customerUnblockSubjectTemplateId = customerUnblockSubjectTemplateId;
     _customerSupportPhoneNumber       = customerSupportPhoneNumber;
     _log = logFactory.CreateLog(this);
 }
        public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
        {
            _sessionsServiceClient = context.HttpContext.RequestServices.GetService <ISessionsServiceClient>();
            var logFactory = context.HttpContext.RequestServices.GetService <ILogFactory>();

            _log            = logFactory.CreateLog(this);
            _requestContext = context.HttpContext.RequestServices.GetService <IRequestContext>();

            try
            {
                if (string.IsNullOrEmpty(_requestContext.SessionToken))
                {
                    context.Result = new UnauthorizedObjectResult(new { Error = "Not authenticated" });
                }
                else
                {
                    var clientSession = await _sessionsServiceClient.SessionsApi.GetSessionAsync(_requestContext.SessionToken);

                    if (clientSession == null)
                    {
                        context.Result = new UnauthorizedObjectResult(new { Error = "Not authenticated" });
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex, context: _requestContext.SessionToken);
            }
        }
예제 #3
0
 public AuthController(IAuthService authService, IRequestContext requestContext,
                       ISessionsServiceClient sessionsServiceClient, ILogFactory logFactory)
 {
     _authService           = authService;
     _requestContext        = requestContext;
     _sessionsServiceClient = sessionsServiceClient;
     _log = logFactory.CreateLog(this);
 }
 public ClientResolver(
     [NotNull] ILogFactory logFactory,
     [NotNull] ISessionsServiceClient sessionsServiceClient,
     [NotNull] IMemoryCache cache)
 {
     _log = logFactory.CreateLog(this) ?? throw new ArgumentNullException(nameof(logFactory));
     _sessionsServiceClient = sessionsServiceClient ?? throw new ArgumentNullException(nameof(sessionsServiceClient));
     _cache = cache ?? throw new ArgumentNullException(nameof(cache));
 }
예제 #5
0
 public ThrottlingByCustomerMiddleware(RequestDelegate next,
                                       IThrottlingSettingsService throttlingSettingsService,
                                       ISessionsServiceClient sessionsServiceClient,
                                       IDistributedLocksServiceProvider distributedLocksServiceProvider)
 {
     _next                  = next;
     _locksService          = distributedLocksServiceProvider.Get(DistributedLockPurpose.RouteThrottling);
     _sessionsServiceClient = sessionsServiceClient;
     _config                = throttlingSettingsService.GetRouteSettings();
 }
 public AuthService(
     ISessionsServiceClient sessionsServiceClient,
     ICredentialsClient credentialsClient,
     IAdminUserService adminUserService,
     ILogFactory logFactory)
 {
     _sessionsServiceClient = sessionsServiceClient;
     _credentialsClient     = credentialsClient;
     _adminUserService      = adminUserService;
     _log = logFactory.CreateLog(this);
 }
 public AuthController(
     ISessionsServiceClient sessionsServiceClient,
     IRequestContext requestContext,
     IAdminsService adminsService,
     IMapper mapper)
 {
     _sessionsServiceClient = sessionsServiceClient;
     _requestContext        = requestContext ?? throw new ArgumentNullException(nameof(requestContext));
     _adminsService         = adminsService;
     _mapper = mapper;
 }
 public RequestContext(
     IHttpContextAccessor httpContextAccessor,
     ISessionsServiceClient sessionsServiceClient,
     IAdminManagementServiceClient adminManagementServiceClient,
     IMapper mapper)
 {
     _sessionsServiceClient        = sessionsServiceClient;
     _httpContext                  = httpContextAccessor.HttpContext;
     _adminManagementServiceClient = adminManagementServiceClient;
     _mapper = mapper;
 }
예제 #9
0
 public AuthService(
     ISessionsServiceClient sessionsServiceClient,
     ICredentialsClient credentialsClient,
     ICustomerProfileClient customerProfileClient,
     ICustomersService customersService,
     ILogFactory logFactory)
 {
     _sessionsServiceClient = sessionsServiceClient;
     _credentialsClient     = credentialsClient;
     _customerProfileClient = customerProfileClient;
     _customersService      = customersService;
     _log = logFactory.CreateLog(this);
 }
예제 #10
0
 public AuthService(
     ILogFactory logFactory,
     ICredentialsClient credentialsClient,
     ISessionsServiceClient sessionsServiceClient,
     int sessionsServiceTokenTimeToLiveInSeconds,
     int usernameLength,
     int passwordLength)
 {
     _credentialsClient     = credentialsClient;
     _sessionsServiceClient = sessionsServiceClient;
     _sessionsServiceTokenTimeToLiveInSeconds = sessionsServiceTokenTimeToLiveInSeconds;
     _usernameLength = usernameLength;
     _passwordLength = passwordLength;
     _log            = logFactory.CreateLog(this);
 }
예제 #11
0
 public AuthController(
     ISessionsServiceClient sessionsServiceClient,
     ICustomerManagementServiceClient customerManagementServiceClient,
     IRequestContext requestContext,
     IMapper mapper,
     IAuthService authService,
     ISigninThrottlingService signinThrottlingService)
 {
     _sessionsServiceClient           = sessionsServiceClient;
     _requestContext                  = requestContext ?? throw new ArgumentNullException(nameof(requestContext));
     _customerManagementServiceClient = customerManagementServiceClient;
     _mapper                  = mapper;
     _authService             = authService;
     _signinThrottlingService = signinThrottlingService;
 }
 public CustomersController(
     ICustomerService customerService,
     ICustomerManagementServiceClient customerManagementServiceClient,
     IRequestContext requestContext,
     IMapper mapper,
     IPasswordValidator passwordValidator,
     ILogFactory logFactory,
     ISessionsServiceClient sessionsServiceClient,
     ICustomerProfileClient customerProfileClient,
     ICredentialsClient credentialsClient)
 {
     _customerService = customerService;
     _customerManagementServiceClient = customerManagementServiceClient;
     _requestContext        = requestContext;
     _mapper                = mapper;
     _passwordValidator     = passwordValidator;
     _sessionsServiceClient = sessionsServiceClient;
     _customerProfileClient = customerProfileClient;
     _credentialsClient     = credentialsClient;
     _log = logFactory.CreateLog(this);
 }
예제 #13
0
 public PostProcessService(ISessionsServiceClient sessionsServiceClient, IRabbitPublisher <EmailMessageEvent> emailEventPublisher)
 {
     _sessionsServiceClient = sessionsServiceClient;
     _emailEventPublisher   = emailEventPublisher;
 }
 public RequestContext(IHttpContextAccessor httpContextAccessor,
                       ISessionsServiceClient sessionsServiceClient)
 {
     _sessionsServiceClient = sessionsServiceClient;
     _httpContext           = httpContextAccessor.HttpContext;
 }
예제 #15
0
 public LykkePrincipal(IRequestContext requestContext, ISessionsServiceClient sessionsServiceClient)
 {
     _requestContext        = requestContext;
     _sessionsServiceClient = sessionsServiceClient;
 }