コード例 #1
0
ファイル: JwtTokenSvc.cs プロジェクト: Memoyu/mbill_service
 public JwtTokenSvc(ILogger <JwtTokenSvc> logger, IUserRepo userRepo, IUserIdentitySvc userIdentityService, IJsonWebTokenService jsonWebTokenService)
 {
     _logger              = logger;
     _userRepo            = userRepo;
     _userIdentityService = userIdentityService;
     _jsonWebTokenService = jsonWebTokenService;
 }
コード例 #2
0
 public LinCmsTest(ITestOutputHelper testOut)
 {
     _testOutputHelper    = testOut;
     freeSql              = GetService <IFreeSql>();
     jsonWebTokenService  = GetService <IJsonWebTokenService>();
     _cryptographyService = GetService <ICryptographyService>();
 }
コード例 #3
0
        public UserServiceTest()
        {
            _passwordHash                  = A.Fake <IPasswordHashService>();
            _userRepositoryService         = A.Fake <IUserRepositoryService>();
            _jwtService                    = A.Fake <IJsonWebTokenService>();
            _httpRequestParser             = A.Fake <IHttpRequestParser>();
            _emailService                  = A.Fake <IEmailService>();
            _factorAuthenticatorManager    = A.Fake <ITwoFactorAuthenticatorManager>();
            _loginAttemptRepoService       = A.Fake <ILoginAttemptsRepositoryService>();
            _refreshTokenRepositoryService = A.Fake <IRefreshTokenRepositoryService>();
            _whiteListRepostirotyService   = A.Fake <IWhitelistedIpRepositoryService>();

            _userService = new UserService
                           (
                _userRepositoryService,
                _passwordHash,
                _jwtService,
                _httpRequestParser,
                _emailService,
                _factorAuthenticatorManager,
                _whiteListRepostirotyService,
                _loginAttemptRepoService,
                _refreshTokenRepositoryService
                           );
        }
コード例 #4
0
 public JwtTokenService(IUserRepository userRepository, ILogger <JwtTokenService> logger, IUserIdentityService userIdentityService, IJsonWebTokenService jsonWebTokenService)
 {
     _userRepository      = userRepository;
     _logger              = logger;
     _userIdentityService = userIdentityService;
     _jsonWebTokenService = jsonWebTokenService;
 }
コード例 #5
0
 public RestAuthenticationMiddleware(
     RequestDelegate next,
     IJsonWebTokenService jsonWebTokenService)
 {
     _next = next;
     _jsonWebTokenService = jsonWebTokenService;
 }
コード例 #6
0
        public AppointmentsAPI(HttpClient httpClient, IJsonWebTokenService jsonWebTokenService)
        {
            var token = jsonWebTokenService.Create();

            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
            client = RestService.For <IAppointmentsAPI>(httpClient);
        }
コード例 #7
0
        public LoginUserRequestHandler(IJsonWebTokenService jsonWebTokenService, IAsyncDocumentSession session)
        {
            Guard.NotNull(jsonWebTokenService, nameof(jsonWebTokenService));
            Guard.NotNull(session, nameof(session));

            this._jsonWebTokenService = jsonWebTokenService;
            this._session             = session;
        }
コード例 #8
0
 public SignInUserCommand(AppDbContext dbContext,
                          IJsonWebTokenService jsonWebTokenService,
                          JsonWebTokenSettings jsonWebTokenSettings)
 {
     _dbContext            = dbContext;
     _jsonWebTokenService  = jsonWebTokenService;
     _jsonWebTokenSettings = jsonWebTokenSettings;
 }
コード例 #9
0
 public JwtTokenService(IUserRepository userRepository, ILogger <JwtTokenService> logger, IUserIdentityService userIdentityService, IJsonWebTokenService jsonWebTokenService, IServiceProvider serviceProvider)
 {
     _userRepository      = userRepository;
     _logger              = logger;
     _userIdentityService = userIdentityService;
     _jsonWebTokenService = jsonWebTokenService;
     this.serviceProvider = serviceProvider;
 }
コード例 #10
0
 public Oauth2Controller(IUserIdentityService userCommunityService, ILogger <Oauth2Controller> logger, IUserRepository userRepository, IJsonWebTokenService jsonWebTokenService, IComponentContext componentContext)
 {
     _userCommunityService = userCommunityService;
     _logger              = logger;
     _userRepository      = userRepository;
     _jsonWebTokenService = jsonWebTokenService;
     _componentContext    = componentContext;
 }
コード例 #11
0
 public Oauth2Controller(IHttpContextAccessor contextAccessor, IUserIdentityService userCommunityService, ILogger <Oauth2Controller> logger, IUserRepository userRepository, IJsonWebTokenService jsonWebTokenService)
 {
     _contextAccessor      = contextAccessor;
     _userCommunityService = userCommunityService;
     _logger              = logger;
     _userRepository      = userRepository;
     _jsonWebTokenService = jsonWebTokenService;
 }
コード例 #12
0
        public AuthorizationRequestPreProcessor(IRequestContext context, IJsonWebTokenService jsonWebTokenService)
        {
            Guard.NotNull(context, nameof(context));
            Guard.NotNull(jsonWebTokenService, nameof(jsonWebTokenService));

            this._context             = context;
            this._jsonWebTokenService = jsonWebTokenService;
        }
コード例 #13
0
 public JwtTokenService(
     IFreeSqlRepository <User> userRepository,
     IJsonWebTokenService jsonWebTokenService,
     ILogger <JwtTokenService> logger)
 {
     _userRepository      = userRepository;
     _jsonWebTokenService = jsonWebTokenService;
     _logger = logger;
 }
コード例 #14
0
 public SignInService
 (
     IHashService hashService,
     IJsonWebTokenService jsonWebTokenService
 )
 {
     _hashService         = hashService;
     _jsonWebTokenService = jsonWebTokenService;
 }
コード例 #15
0
 public CookieValidationService(IClockProvider clockProvider, ApplicationSettings applicationSettings,
                                IEncryptionProvider encryptionProvider,
                                IJsonWebTokenService jsonWebTokenService, IAccountService accountService)
 {
     _clockProvider       = clockProvider;
     _cryptographySwitch  = Switch.Create(applicationSettings.EncryptionKeys);
     _encryptionProvider  = encryptionProvider;
     _jsonWebTokenService = jsonWebTokenService;
     _accountService      = accountService;
 }
コード例 #16
0
 public AccountController(IConfiguration configuration, ILogger <AccountController> logger, IUserService userSevice, IMapper mapper, IHttpClientFactory httpClientFactory, IJsonWebTokenService jsonWebTokenService, IUserRepository userRepository, IUserIdentityService userIdentityService)
 {
     _configuration       = configuration;
     _logger              = logger;
     _userSevice          = userSevice;
     _mapper              = mapper;
     _httpClientFactory   = httpClientFactory;
     _jsonWebTokenService = jsonWebTokenService;
     this._userRepository = userRepository;
     _userIdentityService = userIdentityService;
 }
コード例 #17
0
 public AuthApplicationService
 (
     IAuthRepository authRepository,
     IHashService hashService,
     IJsonWebTokenService jsonWebTokenService
 )
 {
     _authRepository      = authRepository;
     _hashService         = hashService;
     _jsonWebTokenService = jsonWebTokenService;
 }
コード例 #18
0
 public SignInService(
     ISettingManager settingManager,
     ILocalStorageService localStorageService,
     IJsonWebTokenService jsonWebTokenService,
     ILogger <SignInService> logger
     )
 {
     this._localStorageService = localStorageService;
     this._jsonWebTokenService = jsonWebTokenService;
     this._logger        = logger;
     this._systemSetting = settingManager.GetSystemSetting();
 }
コード例 #19
0
 public NetworkMarketingFactory(IServiceService serviceService,
                                ICustomerService customerService,
                                IServiceTransactionService serviceTransactionService,
                                IJsonWebTokenService jsonWebTokenService,
                                IDataProtectionProvider dataProtectionProvider)
 {
     this._serviceService            = serviceService;
     this._customerService           = customerService;
     this._serviceTransactionService = serviceTransactionService;
     this._jsonWebTokenService       = jsonWebTokenService;
     this._dataProtector             = dataProtectionProvider.CreateProtector("Amount Protector");
 }
コード例 #20
0
 public TwoFactorAuthenticationController
 (
     IUserService userService,
     ITokenValidationService tokenValidationService,
     ITwoFactorAuthenticatorManager twoFactorAuthenticatorManager,
     IJsonWebTokenService jsonWebTokenService
 )
 {
     _userService                   = userService;
     _tokenValidationService        = tokenValidationService;
     _twoFactorAuthenticatorManager = twoFactorAuthenticatorManager;
     _jsonWebTokenService           = jsonWebTokenService;
 }
コード例 #21
0
    public SecurityTests()
    {
        var services = new ServiceCollection();

        services.AddSingleton <ICryptographyService>(_ => new CryptographyService(Guid.NewGuid().ToString()));
        _cryptographyService = services.BuildServiceProvider().GetService <ICryptographyService>();

        services.AddSingleton <IHashService, HashService>();
        _hashService = services.BuildServiceProvider().GetService <IHashService>();

        var jsonWebTokenSettings = new JsonWebTokenSettings(Guid.NewGuid().ToString(), TimeSpan.FromHours(12));

        services.AddSingleton <IJsonWebTokenService>(_ => new JsonWebTokenService(jsonWebTokenSettings));
        _jsonWebTokenService = services.BuildServiceProvider().GetService <IJsonWebTokenService>();
    }
コード例 #22
0
        public AccountController
        (
            IUserService userService,
            IConfiguration configuration,
            IEmailService emailService,
            ITokenValidationService tokenValidationService,
            ITwoFactorAuthenticatorManager twoFactorAuthenticatorManager,
            IJsonWebTokenService jsonWebTokenService
        )
        {
            _userService                   = userService;
            _emailService                  = emailService;
            _tokenValidationService        = tokenValidationService;
            _twoFactorAuthenticatorManager = twoFactorAuthenticatorManager;
            _jsonWebTokenService           = jsonWebTokenService;

            var host   = configuration["Hosting:Domain"];
            var scheme = configuration["Hosting:Scheme"];
            var port   = int.Parse(configuration["Hosting:Port"]);

            _baseUrl = $"{scheme}://{host}:{port}";
        }
コード例 #23
0
 public UserService
 (
     IUserRepositoryService userRepositoryService,
     IPasswordHashService passwordHashService,
     IJsonWebTokenService jwtService,
     IHttpRequestParser httpRequestParser,
     IEmailService emailService,
     ITwoFactorAuthenticatorManager factorAuthenticatorManager,
     IWhitelistedIpRepositoryService whitelistedIpRepositoryService,
     ILoginAttemptsRepositoryService loginAttemptsRepositoryService,
     IRefreshTokenRepositoryService refreshTokenRepositoryService
 )
 {
     _userRepositoryService          = userRepositoryService;
     _passwordHashService            = passwordHashService;
     _jwtService                     = jwtService;
     _httpRequestParser              = httpRequestParser;
     _emailService                   = emailService;
     _factorAuthenticatorManager     = factorAuthenticatorManager;
     _whitelistedIpRepositoryService = whitelistedIpRepositoryService;
     _loginAttemptsRepositoryService = loginAttemptsRepositoryService;
     _refreshTokenRepositoryService  = refreshTokenRepositoryService;
 }
コード例 #24
0
 public LinCmsTest(ITestOutputHelper testOut)
 {
     testOutputHelper    = testOut;
     freeSql             = GetService <IFreeSql>();
     jsonWebTokenService = GetService <IJsonWebTokenService>();
 }
コード例 #25
0
 public WxSvc(ILogger <WxSvc> logger, IHttpClientFactory httpClient, IUserRepo userRepo, IUserIdentityRepo userIdentityRepo, IJsonWebTokenService jsonWebTokenService)
 {
     _logger     = logger;
     _httpClient = httpClient;
 }
コード例 #26
0
 public JsonWebTokenController(IJsonWebTokenService jsonWebTokenService)
 {
     _jsonWebTokenService = jsonWebTokenService;
 }
コード例 #27
0
 public EmailService(IEmailSenderService emailSenderService, IJsonWebTokenService jsonWebTokenService)
 {
     _emailSenderService  = emailSenderService;
     _jsonWebTokenService = jsonWebTokenService;
 }
コード例 #28
0
 public UserController(IHubContext <MessageHub, IChatClient> messageHub, IJsonWebTokenService jsonWebTokenService)
 {
     _messageHub          = messageHub ?? throw new ArgumentNullException(nameof(messageHub));
     _jsonWebTokenService = jsonWebTokenService;
 }
コード例 #29
0
 public TokenValidationService(IJsonWebTokenService jwtService, IHashService hashService, IUserService userService)
 {
     _jwtService  = jwtService;
     _hashService = hashService;
     _userService = userService;
 }
コード例 #30
0
 public AuthenticateOnRestServiceQueryHandler(IAuthenticationService authenticationService, IJsonWebTokenService jsonWebTokenService)
 {
     _authenticationService = authenticationService;
     _jsonWebTokenService   = jsonWebTokenService;
 }