Exemplo n.º 1
0
 public VacationTypeService(UrlopikDbContext urlopikDbContext, IMapper mapper,
                            IHttpContextAccessor httpContextAccessor)
 {
     _urlopikDbContext = urlopikDbContext;
     _mapper           = mapper;
     _httpContext      = httpContextAccessor.HttpContext;
 }
Exemplo n.º 2
0
 public VacationService(UrlopikDbContext urlopikDbContext, IMapper mapper,
                        IHttpContextAccessor httpContextAccessor, IVacationsQueryBuilder queryBuilder)
 {
     _urlopikDbContext = urlopikDbContext;
     _mapper           = mapper;
     _httpContext      = httpContextAccessor.HttpContext;
     _queryBuilder     = queryBuilder;
 }
Exemplo n.º 3
0
        public static User GetUserUsingClaimsOrThrow(this HttpContext httpContext, UrlopikDbContext urlopikDbContext)
        {
            var emailFromClaims = httpContext.User.FindFirst("email").Value;
            var user            = urlopikDbContext.Users.SingleOrDefault(x => x.Email.Equals(emailFromClaims));

            if (user is null)
            {
                throw new UnauthorizedAccessException();
            }

            return(user);
        }
Exemplo n.º 4
0
 public UserService(UrlopikDbContext urlopikDbContext, IMapper mapper)
 {
     _urlopikDbContext = urlopikDbContext;
     _mapper           = mapper;
 }
Exemplo n.º 5
0
 public TokenService(UrlopikDbContext dbContext, IOptions <AuthOptions> authOptions)
 {
     _urlopikDbContext = dbContext;
     _authOptions      = authOptions;
 }