public NotificationController(DatabaseContext context, INotificationService notificationService, IUserService userService, IJWTService jWTService) { _context = context; _notificationService = notificationService; _userService = userService; _jWTService = jWTService; }
public MenuService( IUnitOfWork unitOfWork, IOptions <AppSettings> appSettingOptions, IJWTService jwtService) : base(unitOfWork, appSettingOptions, jwtService) { }
public BridgeUserFacebookPhoneImplementation(IUnitOfWork unitOfWork, IJWTService jwtService, IFacebookService facebookService, ISMSService smsService) { _unitOfWork = unitOfWork; _jwtService = jwtService; _facebookService = facebookService; _smsService = smsService; }
public AccountController(IUnitOfWork unitOfWork, IAccountService accountService, IMapper mapper, IJWTService jWTService) { _unitOfWork = unitOfWork; _accountService = accountService; _mapper = mapper; _jWTService = jWTService; }
public async Task <JwtWithRefreshToken> Refresh(string token, string refreshToken) { IJWTService jwtService = SecurityServiceFactory.GetService(typeof(IJWTService)) as IJWTService; IIdentityUserService identityUserService = SecurityServiceFactory.GetService(typeof(IIdentityUserService)) as IIdentityUserService; var principal = jwtService.GetPrincipalFromExpiredToken(token); var username = principal.Identity.Name; var identityUserId = principal.Claims.Single(x => x.Type == "nameidentifier").Value; var applicationUser = await identityUserService.GetApplicationUserAsync(identityUserId); var savedRefreshToken = GetRefreshToken(identityUserId); //retrieve the refresh token from a data store if (savedRefreshToken != refreshToken) { throw new SecurityTokenException("Invalid refresh token"); } var newJwtToken = jwtService.GenerateJwtToken(applicationUser); var newRefreshToken = GenerateRefreshToken(); DeleteRefreshToken(username, refreshToken); SaveRefreshToken(username, newRefreshToken); return(new JwtWithRefreshToken { AccessToken = newJwtToken.AccessToken, Expires = newJwtToken.Expires, Issued = newJwtToken.Issued, RefreshToken = newRefreshToken, }); }
public AccountController(UserManager <AppUser> userManager, SignInManager <AppUser> signInManager, IJWTService jwtService, IMapper mapper) { _jwtService = jwtService; _signInManager = signInManager; _userManager = userManager; _mapper = mapper; }
public LoginUserHandler(IRead <UserDirectory> userDirectoryReader, ITokenGenerator tokenGenerator, IJWTService jwtService, PasswordService passwordService) { _userDirectoryReader = userDirectoryReader; _passwordService = passwordService; _tokenGenerator = tokenGenerator; _jwtService = jwtService; }
public AuthorController(DBRouteValueDictionary _routeDict, MyConfig myConfig, IJWTService iJWTService) { routeDict = _routeDict; this.myConfig = myConfig; this.iJWTService = iJWTService; }
public AvatarController(DatabaseContext context, IAvatarService avatarService, IUserService userService, IJWTService jWTService) { _context = context; _avatarService = avatarService; _userService = userService; _jWTService = jWTService; }
public BridgeUserFacebookEmailImplementation(IUnitOfWork unitOfWork, IJWTService jwtService, IFacebookService facebookService, UserManager <ApplicationUser> userManager) { _unitOfWork = unitOfWork; _jwtService = jwtService; _facebookService = facebookService; _userManager = userManager; }
private static void GetServices() { serviceProvider = ConfigureServices(); //do the actual work here jwt = serviceProvider.GetService <IJWTService>(); }
public AuthService(UserManager <User> userManager, IJWTService jWTService, IRepository <RefreshToken> refreshTokens, IConfiguration configuration) { _userManager = userManager; _jWTService = jWTService; _refreshTokens = refreshTokens; _configuration = configuration; }
public AuthenticationService(HeroesDbContext context, IHashingManager hashingManager, IOptions <AppSettings> appSettings, IJWTService jwtService) { _context = context; _hashingManager = hashingManager; _appSettings = appSettings.Value; _jwtService = jwtService; }
public HitMutation(IHitService hitService, IJWTService jWTService, IHeroService heroService, IValidatorService validatorService) { Name = "Mutation"; Field <StringGraphType>( "createHit", arguments: new QueryArguments { new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "token" }, new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "dragonId" } }, resolve: context => { var token = context.GetArgument <string>("token"); var dragonId = context.GetArgument <int>("dragonId"); validatorService.ValidateToken(token); var heroName = jWTService.GetHeroNameFromToken(token); var hero = heroService.GetHeroByName(heroName); hitService.CreateHit(hero, dragonId); return(null); }); }
public AuthInterface(ILoggerService logger, ICacheService cacheWCF, IAuthorizationConfigurationRepository configurationRepository, IJWTService jwtService) { this._logger = logger; this._cacheWCF = cacheWCF; this._configurationRepository = configurationRepository; this._jwtService = jwtService; }
public void Authenticate_WhenValidCredentialsGiven_ReturnsJsonWebToken() { IUserRepository userRepositoryMock = Substitute.For <IUserRepository>(); userRepositoryMock.GetUsers().Returns(new List <User>() { new User() { Email = "Admin", Password = "******" } }); IPasswordHasher <User> passwordHasherMock = Substitute.For <IPasswordHasher <User> >(); IJWTService jwtServiceMock = Substitute.For <IJWTService>(); jwtServiceMock.Generate(Arg.Any <string>()).Returns(new JsonWebToken()); jwtServiceMock.RefreshTokens.Returns(new List <RefreshToken>()); AuthService authService = new AuthService(userRepositoryMock, passwordHasherMock, jwtServiceMock); LoginViewModel model = new LoginViewModel(); model.Email = "Admin"; model.Password = "******"; JsonWebToken result = authService.Authenticate(model); Assert.IsTrue(result != null); }
public AuthorizeController(ILogger <AuthorizeController> logger, IJWTService service) { this._iJWTService = service; this._Logger = logger; _Logger.LogInformation($"{nameof(AuthorizeController)} 被构造。。。。 "); }
public void TryChangePassword_WhenInvalidCredentialsGiven_ReturnsFalse() { IUserRepository userRepositoryMock = Substitute.For <IUserRepository>(); userRepositoryMock.GetUsers().Returns(new List <User>() { new User() { Email = "GoodEmail", Password = "******" } }); IPasswordHasher <User> passwordHasherMock = Substitute.For <IPasswordHasher <User> >(); IJWTService jwtServiceMock = Substitute.For <IJWTService>(); AuthService authService = new AuthService(userRepositoryMock, passwordHasherMock, jwtServiceMock); ChangePasswordRequest model = new ChangePasswordRequest { OldPassword = "******", NewPassword = "******", }; Assert.IsFalse(authService.TryChangePassword("BadEmail", model)); }
public LoginsController(IConfiguration config, IJWTService jwtservice, OnlineDBContext context, IMailService mailService) { _config = config; _jwtService = jwtservice; _context = context; _mailService = mailService; }
public SessionManager() { _signatureService = new SignatureService(Environment.GetEnvironmentVariable("AppLaunchSecretKey", EnvironmentVariableTarget.Machine)); _userService = new UserService(); _jwtService = new JWTService(); _userClaimService = new UserClaimsService(); }
public UserInfo CheckAuthorized(HttpRequest request, IJWTService jwtService, bool withError = false) { try { var userInfo = GetUserInfoFromRequest(request, jwtService); if (userInfo == null || userInfo.UserId < 1) { //_errorService.AddError(_errorContainer.TryGetError("not_authorized")); if (withError) { throw new NotAuthException(); } return(null); } return(userInfo); } catch (Exception e) { if (withError) { throw new NotAuthException("jwt_service_error", e); } } return(null); }
public SessionManager(string secretKey) { _signatureService = new SignatureService(secretKey); _userService = new UserService(); _jwtService = new JWTService(); _userClaimService = new UserClaimsService(); }
public UsersController(DatabaseContext context, IUserService userService, IPartnerService partnerService, IJWTService jWTService) { _context = context; _userService = userService; _partnerService = partnerService; _jWTService = jWTService; }
public UserService(IConfiguration config, UserContext context, IMapper mapper, IJWTService jWtService) { _config = config; _context = context; _mapper = mapper; _jwtService = jWtService; }
public HomeController(IJWTService jWTService, IHomeService homeService, UserManager <IdentityUser> userManager, SignInManager <IdentityUser> signInManager) { _homeService = homeService; _jWTService = jWTService; _userManager = userManager; _signInManager = signInManager; }
public BridgeUserEmailImplementation(IUnitOfWork unitOfWork, IJWTService jwtService, UserManager <ApplicationUser> userManager, IAccountService accountService) { _unitOfWork = unitOfWork; _jwtService = jwtService; _userManager = userManager; _accountService = accountService; }
public JWTController(ILogger <JWTController> logger, IJWTService jWTService, IOptions <AppSettings> appSettings, IUserService userService) { _logger = logger; _jWTService = jWTService; _appSettings = appSettings.Value; _userService = userService; }
public async Task <Jwt> LoginWithoutEmailConfirmation(LoginModel model) { Jwt jwt = null; IJWTService jwtService = SecurityServiceFactory.GetService(typeof(IJWTService)) as IJWTService; ApplicationUser user = await UserManager.FindByEmailAsync(model.Email); if (user == null) { throw new InvalidOperationException("Incorrect email or password"); } bool isPasswordCorrect = await UserManager.CheckPasswordAsync(user, model.Password); if (!isPasswordCorrect) { throw new InvalidOperationException("Incorrect email or password"); } if (model.RememberMe) { jwt = await jwtService.GenerateJWtWithRefreshTokenAsync(user); } else { jwt = jwtService.GenerateJwtToken(user); } return(jwt); }
public AuthController(IAuthService authServiceParam, IJWTService jwtServiceParam, IUserRepository userRepositoryParam) { authService = authServiceParam; jwtService = jwtServiceParam; userRepository = userRepositoryParam; }
public UserController(IJWTService jwtService, IUserService userService, IClientService clientService, IMapper mapper) { _jwtService = jwtService; _userService = userService; _clientService = clientService; _mapper = mapper; }