public GetUserQuery(
     IReadOnlyUserRepository userRepository,
     IMapper mapper)
 {
     _readOnlyUserRepository = userRepository;
     _mapper = mapper;
 }
 public UserGetAllOperation(IReadOnlyUserRepository repository,
                            ILogger <UserGetAllOperation> logger,
                            IMapper <Domain.Common.User, User> mapper)
 {
     _repository = repository ?? throw new ArgumentNullException(nameof(repository));
     _mapper     = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _logger     = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public UserCollection(IReadOnlyUserRepository repository,
                       int skip, int take,
                       IMapper <Domain.Common.User, User> mapper)
 {
     _repository = repository ?? throw new ArgumentNullException(nameof(repository));
     _take       = take;
     _skip       = skip;
     _mapper     = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
Exemple #4
0
 public UserCreateOperation(IUserAggregateStore store,
                            IReadOnlyUserRepository repository,
                            ILogger <UserCreateOperation> logger,
                            IMapper <Domain.Common.User, User> mapper)
 {
     _store      = store ?? throw new ArgumentNullException(nameof(store));
     _repository = repository ?? throw new ArgumentNullException(nameof(repository));
     _logger     = logger ?? throw new ArgumentNullException(nameof(logger));
     _mapper     = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
        public UserGetAllOperationTest()
        {
            _fixture = new Fixture();

            _fixture.Behaviors.Remove(new ThrowingRecursionBehavior());
            _fixture.Behaviors.Add(new OmitOnRecursionBehavior());

            _repository = Substitute.For <IReadOnlyUserRepository>();
            _logger     = Substitute.For <ILogger <UserGetAllOperation> >();
            _mapper     = Substitute.For <IMapper <Domain.Common.User, User> >();
            _operation  = new UserGetAllOperation(_repository, _logger, _mapper);
        }
        public UserCreateOperationTest()
        {
            _fixture = new Fixture();
            _fixture.Behaviors.Remove(new ThrowingRecursionBehavior());
            _fixture.Behaviors.Add(new OmitOnRecursionBehavior());

            _store      = Substitute.For <IUserAggregateStore>();
            _logger     = Substitute.For <ILogger <UserCreateOperation> >();
            _mapper     = Substitute.For <IMapper <Domain.Common.User, User> >();
            _repository = Substitute.For <IUserRepository>();
            _operation  = new UserCreateOperation(_store, _repository, _logger, _mapper);
        }
Exemple #7
0
        /// <summary>
        /// Sets up the service with all known authentication providers.
        /// </summary>
        /// <param name="loggerFactory">Fasctory to create loggers from.</param>
        /// <param name="passwordHashingService">Provides password hashing functionalities.</param>
        /// <param name="userRepository">Provides users.</param>
        /// <param name="configuration">App configuration for JWT signing information.</param>
        public AuthService(ILoggerFactory loggerFactory, PasswordHashingService passwordHashingService, IReadOnlyUserRepository userRepository, IConfiguration configuration)
        {
            Logger = loggerFactory.CreateLogger <AuthService>();
            PasswordHashingService = passwordHashingService;
            UserRepository         = userRepository;

            // JWT-related configuration
            SymmetricSecurityKey securityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(configuration.GetValue <string>("Jwt:Secret")));

            SigningCredentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256);
            JwtLifetime        = TimeSpan.FromMinutes(configuration.GetValue <int>("Jwt:LifetimeInMinutes"));
            JwtIssuer          = configuration.GetValue <string>("Jwt:Issuer");
        }
Exemple #8
0
 public QueryUserController(IReadOnlyUserRepository userRepository)
 {
     _userRepository = userRepository;
 }
 /// <summary>
 /// Sets up this provider for user login authentication.
 /// </summary>
 /// <param name="passwordHashingService">Provides hashing functionality.</param>
 /// <param name="userRepository">User repository for access to user data.</param>
 public UserLoginAuthenticationProvider(PasswordHashingService passwordHashingService, IReadOnlyUserRepository userRepository)
 {
     PasswordHashingService = passwordHashingService;
     UserRepository         = userRepository;
 }