Ejemplo n.º 1
0
 public OrdersController(
     IRequestContext requestContext,
     ILykkePrincipal lykkePrincipal,
     IClientSessionsClient clientSessionsClient,
     IPersonalDataService personalDataService,
     IKycStatusService kycStatusService,
     IClientAccountClient clientAccountClient,
     IAssetsServiceWithCache assetsServiceWithCache,
     IMatchingEngineClient matchingEngineClient,
     ILimitOrdersRepositoryClient limitOrdersRepository,
     FeeSettings feeSettings,
     IOperationsClient operationsClient,
     BaseSettings baseSettings,
     IcoSettings icoSettings,
     GlobalSettings globalSettings)
 {
     _requestContext         = requestContext;
     _lykkePrincipal         = lykkePrincipal;
     _clientSessionsClient   = clientSessionsClient;
     _personalDataService    = personalDataService;
     _kycStatusService       = kycStatusService;
     _clientAccountClient    = clientAccountClient;
     _assetsServiceWithCache = assetsServiceWithCache;
     _matchingEngineClient   = matchingEngineClient;
     _limitOrdersRepository  = limitOrdersRepository;
     _feeSettings            = feeSettings;
     _operationsClient       = operationsClient;
     _baseSettings           = baseSettings;
     _icoSettings            = icoSettings;
     _globalSettings         = globalSettings;
 }
 public CheckSessionMiddleware(
     RequestDelegate next,
     SessionCheckSettings sessionCheckSettings,
     IClientSessionsClient clientSessionsClient,
     ILykkePrincipal lykkePrincipal,
     ILog log
     )
 {
     _next = next;
     _sessionCheckSettings = sessionCheckSettings;
     _clientSessionsClient = clientSessionsClient;
     _lykkePrincipal       = lykkePrincipal;
     _log          = log;
     _checkMethods = new[] { "POST", "PUT", "DELETE" };
 }
        public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
        {
            var logFactory = context.HttpContext.RequestServices.GetService <ILogFactory>();

            _log            = logFactory.CreateLog(this);
            _lykkePrincipal = context.HttpContext.RequestServices.GetService <ILykkePrincipal>();

            try
            {
                var principal = await _lykkePrincipal.GetCurrentAsync();

                if (principal == null)
                {
                    context.Result = new UnauthorizedObjectResult(new { Error = "Not authenticated" });
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex, context: _lykkePrincipal.GetToken());
            }
        }
Ejemplo n.º 4
0
 public ClientController(
     ILog log,
     ILykkePrincipal lykkePrincipal,
     IClientSessionsClient clientSessionsClient,
     ILykkeRegistrationClient lykkeRegistrationClient,
     ClientAccountLogic clientAccountLogic,
     IRequestContext requestContext,
     IPersonalDataService personalDataService,
     IKycStatusService kycStatusService,
     IClientAccountClient clientAccountService, BaseSettings baseSettings)
 {
     _log = log ?? throw new ArgumentNullException(nameof(log));
     _lykkeRegistrationClient = lykkeRegistrationClient ?? throw new ArgumentNullException(nameof(lykkeRegistrationClient));
     _lykkePrincipal          = lykkePrincipal;
     _clientSessionsClient    = clientSessionsClient;
     _clientAccountLogic      = clientAccountLogic;
     _kycStatusService        = kycStatusService;
     _requestContext          = requestContext ?? throw new ArgumentNullException(nameof(requestContext));
     _personalDataService     = personalDataService ?? throw new ArgumentNullException(nameof(personalDataService));
     _clientAccountService    = clientAccountService;
     _baseSettings            = baseSettings;
 }
Ejemplo n.º 5
0
 public LykkeAuthHandler(IOptionsMonitor <OAuth2IntrospectionOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, ILykkePrincipal lykkePrincipal)
     : base(options, encoder, clock, logger, GetInMemoryCache())
 {
     _lykkePrincipal = lykkePrincipal;
 }
 public LykkeAuthHandler(IOptionsMonitor <LykkeAuthOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, ILykkePrincipal lykkePrincipal) : base(options, logger, encoder, clock)
 {
     _lykkePrincipal = lykkePrincipal;
 }