Esempio n. 1
0
        public void SetUp()
        {
            service = ServiceBuilder <ChallengeDbContext, UserEntity> .GetService <UserDbService>();

            Handler = new InsertarUsuarioHandler(Logger, service, Mapper);
            user    = UserMock.UserModelMock();
        }
Esempio n. 2
0
        public AuthService(IAuthDbService authDbService, IUserDbService <TUserModel> userService, JwtGenerator jwtGenerator, IMapper mapper)
        {
            _authDbService = authDbService ?? throw new ProjectArgumentException(
                                       GetType(),
                                       nameof(AuthService <TUserModel>),
                                       nameof(authDbService),
                                       null);

            _userDbService = userService ?? throw new ProjectArgumentException(
                                       GetType(),
                                       nameof(AuthService <TUserModel>),
                                       nameof(userService),
                                       null);

            _jwtGenerator = jwtGenerator ?? throw new ProjectArgumentException(
                                      GetType(),
                                      nameof(AuthService <TUserModel>),
                                      nameof(jwtGenerator),
                                      null);

            _mapper = mapper ?? throw new ProjectArgumentException(
                                GetType(),
                                nameof(AuthService <TUserModel>),
                                nameof(mapper),
                                null);
        }
Esempio n. 3
0
        public void attachUserToContext(HttpContext context, IUserDbService service, string token)
        {
            try
            {
                var tokenHandler = new JwtSecurityTokenHandler();
                var key          = Encoding.ASCII.GetBytes(_jwtSettings.secretKey);
                tokenHandler.ValidateToken(token, new TokenValidationParameters
                {
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey         = new SymmetricSecurityKey(key),
                    ValidateIssuer           = false,
                    ValidateAudience         = false,
                    ClockSkew = TimeSpan.Zero
                },
                                           out SecurityToken validatedToken
                                           );

                var jwtToken = (JwtSecurityToken)validatedToken;
                var IdUser   = int.Parse(jwtToken.Claims.First(x => x.Type == "IdUser").Value);

                context.Items["User"] = service.GetUser(IdUser);
            }
            catch
            {
            }
        }
Esempio n. 4
0
 public AdminController(ICustomerService customerService,
                        IDepartmentService departmentService,
                        IUserDbService userDbService)
 {
     _customerService   = customerService;
     _departmentService = departmentService;
     _userDbService     = userDbService;
 }
Esempio n. 5
0
 public MocksController(IDepartmentService departmentService,
                        UserManager <User> userManager,
                        RoleManager <IdentityRole> roleManager,
                        IUserDbService userService)
 {
     _departmentService = departmentService;
     _userManager       = userManager;
     _roleManager       = roleManager;
     _userService       = userService;
 }
Esempio n. 6
0
 public BaseController()
 {
     userService       = new UserDbService();
     brandsService     = new BrandsDbService();
     siteService       = new SitePageDbService();
     siteSettings      = new SiteSettingsDbService();
     categoryDbService = new CategoryDbService();
     ImageSlider       = new ImageSlider();
     productService    = new ProductsDbService();
 }
Esempio n. 7
0
        public async Task Invoke(HttpContext context, IUserDbService service)
        {
            var token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(' ').Last(); //token z headera

            if (token != null)
            {
                attachUserToContext(context, service, token);
            }

            await _next(context);
        }
Esempio n. 8
0
 public UsersInfoController(IUserDbService userDbService,
                            IDepartmentService departmentService,
                            ICustomerService customerService,
                            UserManager <User> userManager
                            )
 {
     _userDbService     = userDbService;
     _departmentService = departmentService;
     _customerService   = customerService;
     _userManager       = userManager;
 }
Esempio n. 9
0
 public AccountController(IUserDbService userDbService,
                          IDepartmentService departmentService,
                          SignInManager <User> signInManager,
                          ILogger <AccountController> logger,
                          UserManager <User> userManager)
 {
     _userDbService     = userDbService;
     _departmentService = departmentService;
     _signInManager     = signInManager;
     _logger            = logger;
     _userManager       = userManager;
 }
 public UserOperationService(IUserDbService userDbService)
 {
     this._userDbService = userDbService;
 }
Esempio n. 11
0
 public UsersController(IUserDbService userDBService, IHttpMessageConfiguerer httpResponseMessageConfiguerer)
 {
     _userDBService = userDBService;
     _httpResponseMessageConfiguerer = httpResponseMessageConfiguerer;
 }
Esempio n. 12
0
 public UserService()
 {
     userDb = new UserDbService();
 }
Esempio n. 13
0
 public PodCastController(MediaDbContext context, UserManager <MediaWebUser> userManager, IUserDbService dbService)
 {
     _mediaDbContext = context;
     _userManager    = userManager;
     _userDbService  = dbService;
 }
Esempio n. 14
0
 public AuthorizationService()
 {
     _userDbService = UnityConfig.GetConfiguredContainer().Resolve <IUserDbService>();
 }
 public ActualizarUsuarioHandler(ILogger <ActualizarUsuarioHandler> logger, IUserDbService service, IMapper mapper)
 {
     this.logger  = logger;
     this.service = service;
     this.mapper  = mapper;
 }
Esempio n. 16
0
 public UserController(IUserDbService services)
 {
     _services = services;
 }
 public UserAppService(IUserDbService userDb, IUserSubscriptionDbService subscriptionDbService)
 {
     this._UserDb = userDb;
     this._SubscriptionDbService = subscriptionDbService;
 }
Esempio n. 18
0
 public UserController(IUserDbService dbService, IConfiguration configuration)
 {
     _dbService    = dbService;
     Configuration = configuration;
 }
 public ObtenerUsuariosHandler(ILogger <ObtenerUsuariosHandler> logger, IUserDbService service, IMapper mapper)
 {
     this.logger  = logger;
     this.service = service;
     this.mapper  = mapper;
 }
Esempio n. 20
0
 public AuthenticationHandler(IOptionsMonitor <AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, IUserDbService userService)
     : base(options, logger, encoder, clock)
 {
     _userContext = userService;
 }
Esempio n. 21
0
 public UserDbIntegration(IUserDbService userIDbService)
 {
     _userIDbService = userIDbService;
 }
 public AuthenticationService(IUserDbService userService)
 {
     _userService = userService;
 }
 public EliminarUsuarioHandler(ILogger <EliminarUsuarioHandler> logger, IUserDbService service, IMapper mapper)
 {
     this.logger  = logger;
     this.service = service;
     this.mapper  = mapper;
 }
        public void SetUp()
        {
            service = ServiceBuilder <ChallengeDbContext, UserEntity> .GetService <UserDbService>();

            Handler = new EliminarUsuarioHandler(Logger, service, Mapper);
        }