/// <summary> /// Constructs a new instance of <see cref="AccountService{TAccount}"/>. /// </summary> /// <param name="claimsPrincipalService"></param> /// <param name="httpContextAccessor"></param> /// <param name="optionsAccessor"></param> /// <param name="accountRepository"></param> /// <param name="emailService"></param> /// <param name="serviceProvider"></param> /// <param name="passwordService"></param> /// <param name="timeService"></param> public AccountService(IClaimsPrincipalService <TAccount> claimsPrincipalService, IHttpContextAccessor httpContextAccessor, IOptions <AccountServiceOptions> optionsAccessor, IAccountRepository <TAccount> accountRepository, IEmailService emailService, IServiceProvider serviceProvider, IPasswordService passwordService) { _emailService = emailService; _claimsPrincipalService = claimsPrincipalService; _httpContext = httpContextAccessor?.HttpContext; _cancellationToken = _httpContext?.RequestAborted ?? CancellationToken.None; _options = optionsAccessor?.Value; _accountRepository = accountRepository; _passwordService = passwordService; if (serviceProvider != null) { foreach (string tokenServiceName in _options.TokenServiceOptions.TokenServiceMap.Keys) { ITokenService <TAccount> tokenService = (ITokenService <TAccount>)serviceProvider. GetRequiredService(_options.TokenServiceOptions.TokenServiceMap[tokenServiceName]); RegisterTokenProvider(tokenServiceName, tokenService); } } }
public LoggedOutInteractor(ILogoutService logoutService, IPersistedGrantRepository persistedGrantRepository, IClaimsPrincipalService claimsPrincipalService, ISignOutService signOutService, ISchemeService schemeService) { _logoutService = logoutService; _persistedGrantRepository = persistedGrantRepository; _claimsPrincipalService = claimsPrincipalService; _signOutService = signOutService; _schemeService = schemeService; }
/// <summary> /// Constructs an instance of <see cref="CookieSecurityStampValidator{TAccount}"/> . /// </summary> /// <param name="claimsOptionsAccessor"></param> /// <param name="accountRepository"></param> /// <param name="claimsPrincipalService"></param> /// <param name="cookieOptionsAccessor"></param> public CookieSecurityStampValidator(IOptions <ClaimsOptions> claimsOptionsAccessor, IOptions <CookieAuthOptions> cookieOptionsAccessor, IAccountRepository <TAccount> accountRepository, IClaimsPrincipalService <TAccount> claimsPrincipalService) { _accountRepository = accountRepository; _claimsOptions = claimsOptionsAccessor.Value; _claimsPrincipalService = claimsPrincipalService; _cookieOptions = cookieOptionsAccessor.Value; }
public AuthorizerFacade( IRequestValidationService requestValidationService, ITokenConfigService tokenConfigService, ITokenValidationService tokenValidationService, IClaimsPrincipalService claimsPrincipalService, IPolicyBuilder policyBuilder) { _requestValidationService = requestValidationService; _tokenConfigService = tokenConfigService; _tokenValidationService = tokenValidationService; _claimsPrincipalService = claimsPrincipalService; _policyBuilder = policyBuilder; }
public LoginManager(IAuthenticationService authenticationService, ICryptographyService cryptographyService, IEmailService emailService, ILoginAttemptsService loginAttemptsService, IUserAccountService userAccountService, IUserAccountCodeService userAccountCodeService, IUserProfileService userProfileService, IMapperService mapperService, IClaimsPrincipalService claimsPrincipalService) { _authenticationService = authenticationService; _cryptographyService = cryptographyService; _emailService = emailService; _loginAttemptService = loginAttemptsService; _userAccountService = userAccountService; _userAccountCodeService = userAccountCodeService; _userProfileService = userProfileService; _mapperService = mapperService; _claimsPrincipalService = claimsPrincipalService; }
public RegistrationManager(IEmailService emailService, IUserAccountService userAccountService, IUserProfileService userProfileService, IValidationService validationService, ICryptographyService cryptographyService, ILogService logger, IClaimsPrincipalService claimsPrincipalService, IAssignmentPolicyService assignmentPolicyService, IPublicUserProfileService publicUserProfileService, IAccountSettingsService accountSettingsService) { _emailService = emailService; _userAccountService = userAccountService; _userProfileService = userProfileService; _validationService = validationService; _cryptographyService = cryptographyService; _logger = logger; _claimsPrincipalService = claimsPrincipalService; _assignmentPolicyService = assignmentPolicyService; _publicUserProfileService = publicUserProfileService; _accountSettingsService = accountSettingsService; }
public async void HomeController_EditWithNullId_ReturnsBadRequest( ITodoStorage todoStorage, IClaimsPrincipalService claimsPrincipalService, IFeatureFlagManager featureFlagManager) { // Arrange long?todoId = null; // Act var homeController = new HomeController(todoStorage, claimsPrincipalService, featureFlagManager); var actual = await homeController.Edit(todoId); // Assert Assert.IsType <System.Web.Mvc.HttpStatusCodeResult>(actual); Assert.Equal((int)System.Net.HttpStatusCode.BadRequest, ((System.Web.Mvc.HttpStatusCodeResult)actual).StatusCode); }
public async void HomeController_DetailsUnknownId_ReturnsHtppNotFound( ITodoStorage todoStorage, IClaimsPrincipalService claimsPrincipalService, IFeatureFlagManager featureFlagManager, long unknownTodoId) { // Arrange A.CallTo(() => todoStorage.RetrieveAsync(A <string> .Ignored, A <long> .Ignored)) .Returns <TodoItem>(null); // Act var homeController = new HomeController(todoStorage, claimsPrincipalService, featureFlagManager); var actual = await homeController.Details(unknownTodoId); // Assert Assert.IsType <System.Web.Mvc.HttpNotFoundResult>(actual); }
public async void HomeController_Index_RendersCorrectData( ITodoStorage todoStorage, IClaimsPrincipalService claimsPrincipalService, IFeatureFlagManager featureFlagManager, List <TodoItem> todos) { // Arrange A.CallTo(() => todoStorage.RetrieveAsync(A <string> .Ignored)) .Returns(todos); // Act var homeController = new HomeController(todoStorage, claimsPrincipalService, featureFlagManager); var actual = await homeController.Index(); // Assert Assert.IsType <System.Web.Mvc.ViewResult>(actual); Assert.Equal(todos, ((System.Web.Mvc.ViewResult)actual).Model); }
public async void HomeController_Details_RendersCorrectData( ITodoStorage todoStorage, IClaimsPrincipalService claimsPrincipalService, IFeatureFlagManager featureFlagManager, TodoItem todoItem) { // Arrange A.CallTo(() => claimsPrincipalService.UserId) .Returns(todoItem.UserId); A.CallTo(() => todoStorage.RetrieveAsync(todoItem.UserId, todoItem.Id)) .Returns(todoItem); // Act var homeController = new HomeController(todoStorage, claimsPrincipalService, featureFlagManager); var actual = await homeController.Details(todoItem.Id); // Assert Assert.IsType <System.Web.Mvc.ViewResult>(actual); Assert.Equal(todoItem, ((System.Web.Mvc.ViewResult)actual).Model); }
public LogoutInteractor(ILogoutService logoutService, IClaimsPrincipalService claimsPrincipalService) { _logoutService = logoutService; _claimsPrincipalService = claimsPrincipalService; }
public FeatureFlagManager(IAadClient aadClient, IClaimsPrincipalService claimsPrincipalService) { this.aadClient = aadClient; this.claimsPrincipalService = claimsPrincipalService; }
public AadClient(IClaimsPrincipalService claimsPrincipalService) { this.claimsPrincipalService = claimsPrincipalService; }
public HomeController(ITodoStorage todoStorage, IClaimsPrincipalService claimsPrincipalService, IFeatureFlagManager featureFlagManager) { this.todoStorage = todoStorage; this.claimsPrincipalService = claimsPrincipalService; this.featureFlagManager = featureFlagManager; }
public ClaimsPrincipalServiceTest() { _httpContextAccessorMock = new Mock <IHttpContextAccessor>(); _service = new ClaimsPrincipalService(_httpContextAccessorMock.Object); }