public GetUserExternalLoginsQueryHandler(
     IExternalLoginService externalLoginService,
     IUserExternalLoginService userExternalLoginService)
 {
     _externalLoginService     = externalLoginService;
     _userExternalLoginService = userExternalLoginService;
 }
Exemple #2
0
        public BackOfficeUserStore(IUserService userService, IMemberTypeService memberTypeService, IEntityService entityService, IExternalLoginService externalLoginService, IGlobalSettings globalSettings, MembershipProviderBase usersMembershipProvider)
        {
            _userService          = userService;
            _memberTypeService    = memberTypeService;
            _entityService        = entityService;
            _externalLoginService = externalLoginService;
            _globalSettings       = globalSettings;
            if (userService == null)
            {
                throw new ArgumentNullException("userService");
            }
            if (usersMembershipProvider == null)
            {
                throw new ArgumentNullException("usersMembershipProvider");
            }
            if (externalLoginService == null)
            {
                throw new ArgumentNullException("externalLoginService");
            }

            _userService          = userService;
            _externalLoginService = externalLoginService;

            if (usersMembershipProvider.PasswordFormat != MembershipPasswordFormat.Hashed)
            {
                throw new InvalidOperationException("Cannot use ASP.Net Identity with UmbracoMembersUserStore when the password format is not Hashed");
            }
        }
 public LoginExternalCommandHandler(
     IExternalLoginService externalLoginService,
     IUserExternalLoginService userExternalLoginService)
 {
     _externalLoginService     = externalLoginService;
     _userExternalLoginService = userExternalLoginService;
 }
        /// <summary>
        /// Creates a BackOfficeUserManager instance with all default options and the default BackOfficeUserManager
        /// </summary>
        /// <param name="options"></param>
        /// <param name="userService"></param>
        /// <param name="entityService"></param>
        /// <param name="externalLoginService"></param>
        /// <param name="membershipProvider"></param>
        /// <param name="contentSectionConfig"></param>
        /// <returns></returns>
        public static BackOfficeUserManager Create(
            IdentityFactoryOptions <BackOfficeUserManager> options,
            IUserService userService,
            IEntityService entityService,
            IExternalLoginService externalLoginService,
            MembershipProviderBase membershipProvider,
            IContentSection contentSectionConfig)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            if (userService == null)
            {
                throw new ArgumentNullException("userService");
            }
            if (externalLoginService == null)
            {
                throw new ArgumentNullException("externalLoginService");
            }

            var manager = new BackOfficeUserManager(
                new BackOfficeUserStore(userService, entityService, externalLoginService, membershipProvider));

            manager.InitUserManager(manager, membershipProvider, contentSectionConfig, options);
            return(manager);
        }
Exemple #5
0
        /// <summary>
        /// Creates a partial service context with only some services (for tests).
        /// </summary>
        /// <remarks>
        /// <para>Using a true constructor for this confuses DI containers.</para>
        /// </remarks>
        public static ServiceContext CreatePartial(
            IContentService contentService         = null,
            IMediaService mediaService             = null,
            IContentTypeService contentTypeService = null,
            IMediaTypeService mediaTypeService     = null,
            IDataTypeService dataTypeService       = null,
            IFileService fileService = null,
            ILocalizationService localizationService = null,
            IPackagingService packagingService       = null,
            IEntityService entityService             = null,
            IRelationService relationService         = null,
            IMemberGroupService memberGroupService   = null,
            IMemberTypeService memberTypeService     = null,
            IMemberService memberService             = null,
            IUserService userService            = null,
            ISectionService sectionService      = null,
            IApplicationTreeService treeService = null,
            ITagService tagService = null,
            INotificationService notificationService   = null,
            ILocalizedTextService localizedTextService = null,
            IAuditService auditService                           = null,
            IDomainService domainService                         = null,
            IMacroService macroService                           = null,
            IPublicAccessService publicAccessService             = null,
            IExternalLoginService externalLoginService           = null,
            IServerRegistrationService serverRegistrationService = null,
            IRedirectUrlService redirectUrlService               = null,
            IConsentService consentService                       = null)
        {
            Lazy <T> Lazy <T>(T service) => service == null ? null : new Lazy <T>(() => service);

            return(new ServiceContext(
                       Lazy(publicAccessService),
                       Lazy(domainService),
                       Lazy(auditService),
                       Lazy(localizedTextService),
                       Lazy(tagService),
                       Lazy(contentService),
                       Lazy(userService),
                       Lazy(memberService),
                       Lazy(mediaService),
                       Lazy(contentTypeService),
                       Lazy(mediaTypeService),
                       Lazy(dataTypeService),
                       Lazy(fileService),
                       Lazy(localizationService),
                       Lazy(packagingService),
                       Lazy(serverRegistrationService),
                       Lazy(entityService),
                       Lazy(relationService),
                       Lazy(treeService),
                       Lazy(sectionService),
                       Lazy(macroService),
                       Lazy(memberTypeService),
                       Lazy(memberGroupService),
                       Lazy(notificationService),
                       Lazy(externalLoginService),
                       Lazy(redirectUrlService),
                       Lazy(consentService)));
        }
        /// <summary>
        /// Creates a BackOfficeUserManager instance with all default options and the default BackOfficeUserManager
        /// </summary>
        /// <param name="options"></param>
        /// <param name="userService"></param>
        /// <param name="externalLoginService"></param>
        /// <param name="membershipProvider"></param>
        /// <returns></returns>
        public static FortressBackOfficeUserManager Create(
            IdentityFactoryOptions <FortressBackOfficeUserManager> options,
            IUserService userService,
            IExternalLoginService externalLoginService,
            MembershipProviderBase membershipProvider)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            if (userService == null)
            {
                throw new ArgumentNullException("userService");
            }
            if (externalLoginService == null)
            {
                throw new ArgumentNullException("externalLoginService");
            }

            var manager = new FortressBackOfficeUserManager(new FortressBackOfficeUserStore(userService, externalLoginService, membershipProvider));

            manager.InitUserManager(manager, membershipProvider, options.DataProtectionProvider);


            //Here you can specify the 2FA providers that you want to implement,
            //in this demo we are using the custom AcceptAnyCodeProvider - which literally accepts any code - do not actually use this!

            var dataProtectionProvider = options.DataProtectionProvider;

            manager.RegisterTwoFactorProvider("SMS", new SMSCodeProvider(dataProtectionProvider.Create("SMS")));
            manager.RegisterTwoFactorProvider("GoogleAuthenticator", new GoogleAuthenticatorProvider(dataProtectionProvider.Create("GoogleAuthenticator")));

            return(manager);
        }
Exemple #7
0
 public Handler(IExternalLoginService externalLogin, UserManager <AppUser> userManager,
                IJwtGenerator jwtGenerator, IMapper mapper)
 {
     _externalLogin = externalLogin;
     _userManager   = userManager;
     _jwtGenerator  = jwtGenerator;
     _mapper        = mapper;
 }
Exemple #8
0
        //private readonly IUnitOfWork database;

        public ExternalAuthController(IJwtTokenService jwtService,
                                      IMailSender sender, IExternalLoginService <AppUser> logService, IMapper mapper)
        {
            this.jwtService   = jwtService;
            emailService      = sender;
            this.loginService = logService;
            this.mapper       = mapper;
        }
 public ExternalLoginController(IAuthenticationManager authenticationManager,
                                IExternalLoginService externalLoginService, IUniquePageService uniquePageService, IStringResourceProvider stringResourceProvider)
 {
     _authenticationManager  = authenticationManager;
     _externalLoginService   = externalLoginService;
     _uniquePageService      = uniquePageService;
     _stringResourceProvider = stringResourceProvider;
 }
Exemple #10
0
 public MemberUserStore(
     IMemberService memberService,
     IUmbracoMapper mapper,
     IScopeProvider scopeProvider,
     IdentityErrorDescriber describer,
     IPublishedSnapshotAccessor publishedSnapshotAccessor,
     IExternalLoginService externalLoginService)
     : this(memberService, mapper, scopeProvider, describer, publishedSnapshotAccessor, StaticServiceProvider.Instance.GetRequiredService <IExternalLoginWithKeyService>(), StaticServiceProvider.Instance.GetRequiredService <ITwoFactorLoginService>())
 {
 }
 public static BackOfficeUserManager Create(
     IdentityFactoryOptions <BackOfficeUserManager> options,
     IUserService userService,
     IExternalLoginService externalLoginService,
     MembershipProviderBase membershipProvider)
 {
     return(Create(options, userService,
                   ApplicationContext.Current.Services.EntityService,
                   externalLoginService, membershipProvider,
                   UmbracoConfig.For.UmbracoSettings().Content));
 }
Exemple #12
0
 public ExternalLoginModel(
     IIdentityService identityService,
     IExternalLoginService externalLoginService,
     ILogger <ExternalLoginModel> logger,
     IEmailSender emailSender)
 {
     _identityService      = identityService;
     _externalLoginService = externalLoginService;
     _logger      = logger;
     _emailSender = emailSender;
 }
 public ExternalLoginController(IAuthenticationManager authenticationManager,
                                IExternalLoginService externalLoginService, IUniquePageService uniquePageService, IStringResourceProvider stringResourceProvider,
                                IGetVerifiedUserResult getVerifiedUserResult,
                                ILogUserIn logUserIn, ISetVerifiedUserData setVerifiedUserData)
 {
     _authenticationManager  = authenticationManager;
     _externalLoginService   = externalLoginService;
     _uniquePageService      = uniquePageService;
     _stringResourceProvider = stringResourceProvider;
     _getVerifiedUserResult  = getVerifiedUserResult;
     _logUserIn           = logUserIn;
     _setVerifiedUserData = setVerifiedUserData;
 }
 public AccountController(
     IAccountViewService accountViewService,
     IIdentityServerInteractionService interactionService,
     IExternalLoginService externalLoginService,
     ILocalLoginService localLoginService,
     IEventService eventsService)
 {
     this.interactionService   = interactionService;
     this.externalLoginService = externalLoginService;
     this.localLoginService    = localLoginService;
     this.accountViewService   = accountViewService;
     this.eventsService        = eventsService;
 }
        public UserStore(IMapper mapper,
                         IUserService userService,
                         IExternalLoginService externalLoginService,
                         IRoleService roleService)
        {
            Debug.Assert(mapper != null);
            Debug.Assert(userService != null);
            Debug.Assert(externalLoginService != null);
            Debug.Assert(roleService != null);

            _mapper               = mapper;
            _userService          = userService;
            _externalLoginService = externalLoginService;
            _roleService          = roleService;
        }
Exemple #16
0
        public AccountController(ILoginService loginService, IEmailConfirmationService emailConfirmationService,
            IAddUserService addUserService, ICredentialsService credentialsService, IAccountDataService accountDataService,
            ITwoFactorAuthService twoFactorAuthService, IExternalLoginService externalLoginService,
            IOptionsSnapshot<IdentityUIEndpoints> identityUIEndpoints)
        {
            _loginService = loginService;
            _emailConfirmationService = emailConfirmationService;
            _addUserService = addUserService;
            _credentialsService = credentialsService;
            _accountDataService = accountDataService;
            _twoFactorAuthService = twoFactorAuthService;
            _externalLoginService = externalLoginService;

            _identityUIEndpoints = identityUIEndpoints.Value;
        }
Exemple #17
0
 public BackOfficeUserStore(
     IScopeProvider scopeProvider,
     IUserService userService,
     IEntityService entityService,
     IExternalLoginService externalLoginService,
     IOptions <GlobalSettings> globalSettings,
     IUmbracoMapper mapper,
     BackOfficeErrorDescriber describer,
     AppCaches appCaches)
     : this(
         scopeProvider,
         userService,
         entityService,
         StaticServiceProvider.Instance.GetRequiredService <IExternalLoginWithKeyService>(),
         globalSettings,
         mapper,
         describer,
         appCaches)
 {
 }
 public UsersController(
     IUserService userService,
     ITempUserService userTempService,
     IMapper mapper,
     IOptions <AppSettings> appSettings,
     IVerificationCodeService vcodeService,
     IHttpClientFactory clientFactory,
     IExternalLoginService externalLoginService,
     IHttpContextAccessor httpContextAccessor,
     INewsService newsService)
 {
     _userService          = userService;
     _userTempService      = userTempService;
     _mapper               = mapper;
     _appSettings          = appSettings.Value;
     _vcodeService         = vcodeService;
     _clientFactory        = clientFactory;
     _externalLoginService = externalLoginService;
     _httpContextAccessor  = httpContextAccessor;
     _newsService          = newsService;
 }
Exemple #19
0
 public TwoFactorEventHandler(
     IUmbracoContextAccessor umbracoContextAccessor,
     IRuntimeState runtimeState,
     IUserService userService,
     IGlobalSettings globalSettings,
     ISecuritySection securitySection,
     IEntityService entityService,
     IExternalLoginService externalLoginService,
     IMemberTypeService memberTypeService,
     UmbracoMapper umbracoMapper)
 {
     this.umbracoContextAccessor = umbracoContextAccessor;
     this.runtimeState           = runtimeState;
     this.userService            = userService;
     this.globalSettings         = globalSettings;
     this.securitySection        = securitySection;
     this.entityService          = entityService;
     this.externalLoginService   = externalLoginService;
     this.memberTypeService      = memberTypeService;
     this.umbracoMapper          = umbracoMapper;
 }
Exemple #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BackOfficeUserStore"/> class.
 /// </summary>
 public BackOfficeUserStore(
     IScopeProvider scopeProvider,
     IUserService userService,
     IEntityService entityService,
     IExternalLoginService externalLoginService,
     IOptions <GlobalSettings> globalSettings,
     IUmbracoMapper mapper,
     BackOfficeErrorDescriber describer,
     AppCaches appCaches)
     : base(describer)
 {
     _scopeProvider        = scopeProvider;
     _userService          = userService ?? throw new ArgumentNullException(nameof(userService));
     _entityService        = entityService;
     _externalLoginService = externalLoginService ?? throw new ArgumentNullException(nameof(externalLoginService));
     _globalSettings       = globalSettings.Value;
     _mapper               = mapper;
     _appCaches            = appCaches;
     _userService          = userService;
     _externalLoginService = externalLoginService;
 }
        /// <summary>
        /// Creates a BackOfficeUserManager instance with all default options and the default BackOfficeUserManager
        /// </summary>
        /// <param name="options"></param>
        /// <param name="userService"></param>
        /// <param name="entityService"></param>
        /// <param name="externalLoginService"></param>
        /// <param name="membershipProvider"></param>
        /// <returns></returns>
        public static TwoFactorBackOfficeUserManager Create(
            IdentityFactoryOptions <TwoFactorBackOfficeUserManager> options,
            IUserService userService,
            IEntityService entityService,
            IExternalLoginService externalLoginService,
            MembershipProviderBase membershipProvider)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            if (userService == null)
            {
                throw new ArgumentNullException("userService");
            }
            if (entityService == null)
            {
                throw new ArgumentNullException("entityService");
            }
            if (externalLoginService == null)
            {
                throw new ArgumentNullException("externalLoginService");
            }

            var manager = new TwoFactorBackOfficeUserManager(new TwoFactorBackOfficeUserStore(userService, externalLoginService, entityService, membershipProvider));

            manager.InitUserManager(manager, membershipProvider, options.DataProtectionProvider, UmbracoConfig.For.UmbracoSettings().Content);

            //Here you can specify the 2FA providers that you want to implement
            var dataProtectionProvider = options.DataProtectionProvider;

            manager.RegisterTwoFactorProvider(Constants.YubiKeyProviderName,
                                              new TwoFactorValidationProvider(dataProtectionProvider.Create(Constants.YubiKeyProviderName)));
            manager.RegisterTwoFactorProvider(Constants.GoogleAuthenticatorProviderName,
                                              new TwoFactorValidationProvider(dataProtectionProvider.Create(Constants.GoogleAuthenticatorProviderName)));

            return(manager);
        }
 public FacebookLoginHandler(IMemoryCache cache, IExternalLoginService externalLoginService)
 {
     _cache = cache;
     _externalLoginService = externalLoginService;
 }
Exemple #23
0
 public LoginController(ILoginService loginService, IExternalLoginService externalLoginService)
 {
     _loginService         = loginService;
     _externalLoginService = externalLoginService;
 }
 public FortressBackOfficeUserStore(IUserService userService, IExternalLoginService externalLoginService, MembershipProviderBase usersMembershipProvider)
     : base(userService, externalLoginService, usersMembershipProvider)
 {
 }
Exemple #25
0
 public TwoFactorBackOfficeUserStore(IUserService userService, IMemberTypeService memberService, IExternalLoginService externalLoginService,
                                     IEntityService entityService, MembershipProviderBase usersMembershipProvider, IGlobalSettings globalSettings, UmbracoMapper umbracoMapper)
     : base(userService, memberService, entityService, externalLoginService, globalSettings, usersMembershipProvider, umbracoMapper)
 {
 }
Exemple #26
0
 /// <summary>
 /// public ctor - will generally just be used for unit testing all items are optional and if not specified, the defaults will be used
 /// </summary>
 /// <param name="contentService"></param>
 /// <param name="mediaService"></param>
 /// <param name="contentTypeService"></param>
 /// <param name="dataTypeService"></param>
 /// <param name="fileService"></param>
 /// <param name="localizationService"></param>
 /// <param name="packagingService"></param>
 /// <param name="entityService"></param>
 /// <param name="relationService"></param>
 /// <param name="memberGroupService"></param>
 /// <param name="memberTypeService"></param>
 /// <param name="memberService"></param>
 /// <param name="userService"></param>
 /// <param name="sectionService"></param>
 /// <param name="treeService"></param>
 /// <param name="tagService"></param>
 /// <param name="notificationService"></param>
 /// <param name="localizedTextService"></param>
 /// <param name="auditService"></param>
 /// <param name="domainService"></param>
 /// <param name="taskService"></param>
 /// <param name="macroService"></param>
 /// <param name="publicAccessService"></param>
 /// <param name="externalLoginService"></param>
 /// <param name="migrationEntryService"></param>
 public ServiceContext(
     IContentService contentService         = null,
     IMediaService mediaService             = null,
     IContentTypeService contentTypeService = null,
     IDataTypeService dataTypeService       = null,
     IFileService fileService = null,
     ILocalizationService localizationService = null,
     IPackagingService packagingService       = null,
     IEntityService entityService             = null,
     IRelationService relationService         = null,
     IMemberGroupService memberGroupService   = null,
     IMemberTypeService memberTypeService     = null,
     IMemberService memberService             = null,
     IUserService userService            = null,
     ISectionService sectionService      = null,
     IApplicationTreeService treeService = null,
     ITagService tagService = null,
     INotificationService notificationService   = null,
     ILocalizedTextService localizedTextService = null,
     IAuditService auditService                   = null,
     IDomainService domainService                 = null,
     ITaskService taskService                     = null,
     IMacroService macroService                   = null,
     IPublicAccessService publicAccessService     = null,
     IExternalLoginService externalLoginService   = null,
     IMigrationEntryService migrationEntryService = null)
 {
     if (migrationEntryService != null)
     {
         _migrationEntryService = new Lazy <IMigrationEntryService>(() => migrationEntryService);
     }
     if (externalLoginService != null)
     {
         _externalLoginService = new Lazy <IExternalLoginService>(() => externalLoginService);
     }
     if (auditService != null)
     {
         _auditService = new Lazy <IAuditService>(() => auditService);
     }
     if (localizedTextService != null)
     {
         _localizedTextService = new Lazy <ILocalizedTextService>(() => localizedTextService);
     }
     if (tagService != null)
     {
         _tagService = new Lazy <ITagService>(() => tagService);
     }
     if (contentService != null)
     {
         _contentService = new Lazy <IContentService>(() => contentService);
     }
     if (mediaService != null)
     {
         _mediaService = new Lazy <IMediaService>(() => mediaService);
     }
     if (contentTypeService != null)
     {
         _contentTypeService = new Lazy <IContentTypeService>(() => contentTypeService);
     }
     if (dataTypeService != null)
     {
         _dataTypeService = new Lazy <IDataTypeService>(() => dataTypeService);
     }
     if (fileService != null)
     {
         _fileService = new Lazy <IFileService>(() => fileService);
     }
     if (localizationService != null)
     {
         _localizationService = new Lazy <ILocalizationService>(() => localizationService);
     }
     if (packagingService != null)
     {
         _packagingService = new Lazy <IPackagingService>(() => packagingService);
     }
     if (entityService != null)
     {
         _entityService = new Lazy <IEntityService>(() => entityService);
     }
     if (relationService != null)
     {
         _relationService = new Lazy <IRelationService>(() => relationService);
     }
     if (sectionService != null)
     {
         _sectionService = new Lazy <ISectionService>(() => sectionService);
     }
     if (memberGroupService != null)
     {
         _memberGroupService = new Lazy <IMemberGroupService>(() => memberGroupService);
     }
     if (memberTypeService != null)
     {
         _memberTypeService = new Lazy <IMemberTypeService>(() => memberTypeService);
     }
     if (treeService != null)
     {
         _treeService = new Lazy <IApplicationTreeService>(() => treeService);
     }
     if (memberService != null)
     {
         _memberService = new Lazy <IMemberService>(() => memberService);
     }
     if (userService != null)
     {
         _userService = new Lazy <IUserService>(() => userService);
     }
     if (notificationService != null)
     {
         _notificationService = new Lazy <INotificationService>(() => notificationService);
     }
     if (domainService != null)
     {
         _domainService = new Lazy <IDomainService>(() => domainService);
     }
     if (taskService != null)
     {
         _taskService = new Lazy <ITaskService>(() => taskService);
     }
     if (macroService != null)
     {
         _macroService = new Lazy <IMacroService>(() => macroService);
     }
     if (publicAccessService != null)
     {
         _publicAccessService = new Lazy <IPublicAccessService>(() => publicAccessService);
     }
 }
Exemple #27
0
 public TwoFactorBackOfficeUserStore(IUserService userService, IExternalLoginService externalLoginService,
                                     IEntityService entityService, MembershipProviderBase usersMembershipProvider)
     : base(userService, entityService, externalLoginService, usersMembershipProvider)
 {
 }
 public BackOfficeUserStore(IUserService userService, IMemberTypeService memberTypeService, IEntityService entityService, IExternalLoginService externalLoginService, IGlobalSettings globalSettings, MembershipProviderBase usersMembershipProvider, UmbracoMapper mapper)
     : this(userService, memberTypeService, entityService, externalLoginService, globalSettings, usersMembershipProvider, mapper, Current.AppCaches)
 {
 }
Exemple #29
0
 public GetExternalLoginsQueryHandler(IExternalLoginService externalLoginService)
 {
     _externalLoginService = externalLoginService;
 }
Exemple #30
0
 public LinksModel(IExternalLoginService externalLoginService, ICurrentUserService currentUserService, ILogger <LinksModel> logger)
 {
     _logger               = logger;
     _currentUserService   = currentUserService;
     _externalLoginService = externalLoginService;
 }