public UserRepository(ServiceBusClient client, IConfiguration configuration, UserManager <ApplicationUser> userManager, IJwtRepository jwtRepo) { _client = client; _configuration = configuration; _userManager = userManager; _jwtRepo = jwtRepo; }
/// <summary> /// Ctor /// </summary> /// <param name="logger"></param> /// <param name="configuration"></param> /// <param name="jwtApp"></param> /// <param name="accountRepository"></param> public AuthsController(ILogger <AuthsController> logger, IConfiguration configuration, IJwtRepository jwtApp, IAccountsRepository accountRepository) { _configuration = configuration; _jwtApp = jwtApp; _accountRepository = accountRepository; _logger = logger; }
public LoginRepository(UserManager <ApplicationUser> userManager, ServiceBusClient client, IDistributedCache cache, IConfiguration configuration, IJwtRepository jwtRepo) { _userManager = userManager; _client = client; _cache = cache; _configuration = configuration; _jwtRepo = jwtRepo; }
public JwtRepositoryTests() { var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json", false) .Build(); this.JwtOptions = Options.Create(configuration.GetSection("Jwt").Get <JwtOptions>()); this.JwtRepository = new JwtRepository(this.JwtOptions, this.Logger); }
public static async Task <string> GenerateJwt(ClaimsIdentity identity, IJwtRepository jwtRepository, string userName, JwtIssuerOptions jwtOptions, JsonSerializerSettings serializerSettings) { var response = new { id = identity.Claims.Single(c => c.Type == "id").Value, auth_token = await jwtRepository.GenerateEncodedToken(userName, identity, userName.Contains("ran.ding")), expires_in = (int)jwtOptions.ValidFor.TotalSeconds }; return(JsonConvert.SerializeObject(response, serializerSettings)); }
public EmployeesControllerFixture() { var mockJwtRepo = new Mock <IJwtRepository>(); mockJwtRepo.Setup(x => x.Create(It.IsAny <IEmployeeModel>())).Returns(() => "JWT"); this.JwtRepository = mockJwtRepo.Object; var mockEmployeeRepo = new Mock <IEmployeeRepository>(); mockEmployeeRepo.Setup(x => x.FindEmployeeByEmployeeCardIdAsync(It.Is <String>(y => y == this.ValidId))).Returns <String>(async x => await Task.FromResult(new EmployeeModel())); mockEmployeeRepo.Setup(x => x.FindEmployeeByEmployeeCardIdAsync(It.Is <String>(y => y == this.InvalidId))).Returns(async() => await Task.FromResult <EmployeeModel>(null)); mockEmployeeRepo.Setup(x => x.CreateAsync(It.Is <ICreateEmployeeModel>(y => y.EmployeeCardId == this.ValidId))).Returns <ICreateEmployeeModel>(async x => await Task.FromResult(new EmployeeModel())); // TODO: Mock throw when Id already exists. mockEmployeeRepo.Setup(x => x.VerifyPinAsync(It.Is <String>(y => y == this.ValidId), It.IsAny <String>())).Returns(async() => await Task.FromResult(true)); mockEmployeeRepo.Setup(x => x.VerifyPinAsync(It.Is <String>(y => y == this.InvalidId), It.IsAny <String>())).Returns(async() => await Task.FromResult(false)); mockEmployeeRepo.Setup(x => x.UpdateEmployeeAsync(It.Is <String>(y => y == this.ValidId), It.IsAny <IUpdateEmployeeModel>())).Returns(async() => await Task.FromResult(true)); mockEmployeeRepo.Setup(x => x.UpdateEmployeeAsync(It.Is <String>(y => y == this.InvalidId), It.IsAny <IUpdateEmployeeModel>())).Returns(async() => await Task.FromResult(false)); mockEmployeeRepo.Setup(x => x.ChangePinAsync(It.Is <String>(y => y == this.ValidId), It.IsAny <String>())).Returns(async() => await Task.FromResult(true)); mockEmployeeRepo.Setup(x => x.ChangePinAsync(It.Is <String>(y => y == this.InvalidId), It.IsAny <String>())).Returns(async() => await Task.FromResult(false)); this.EmployeeRepository = mockEmployeeRepo.Object; }
public EmployeesController(IEmployeeRepository employeeRepository, IJwtRepository jwtRepository, ILogger <EmployeesController> logger) : base(logger) { this.EmployeeRepository = employeeRepository; this.JwtRepository = jwtRepository; }
public AuthController(UserManager <AppUser> userManager, IJwtRepository jwtRepository, IOptions <JwtIssuerOptions> jwtOptions) { _userManager = userManager; _jwtRepository = jwtRepository; _jwtOptions = jwtOptions.Value; }
public JwtService(IdentityDatabaseContext identityDatabaseContext, IOptions <IdentitySettings> identitySettings, IHttpContextAccessor iHttpContextAccessor) { _jwtRepository = new JwtRepository(identityDatabaseContext, identitySettings, iHttpContextAccessor); }
public ConfirmController(IConfiguration configuration, IUserRepository userRepo, IJwtRepository jwtRepo) { _configuration = configuration; _userRepo = userRepo; _jwtRepo = jwtRepo; }
public UserService(DataBaseContext context, IJwtRepository jwtRepository) { _context = context; _jwtRepository = jwtRepository; }
/// <summary> /// ctor /// </summary> /// <param name="schemes"></param> /// <param name="jwtApp"></param> public PermissionsPolicyHandler(IAuthenticationSchemeProvider schemes, IJwtRepository jwtService) { Schemes = schemes; _jwtService = jwtService; }
public UserController(IUserRepository userRepo, IJwtRepository jwtRepo, ITwoFactorCodeRepository twoFactorRepo) { _userRepo = userRepo; _jwtRepo = jwtRepo; _twoFactorRepo = twoFactorRepo; }
public UserService(PortalDbContext context, IJwtRepository jwtRepository) { _context = context; _jwtRepository = jwtRepository; }