Example #1
0
 public GenerateAndSendSmsCodeOperation(IConfirmationCodeStore confirmationCodeStore, SmsAuthenticationOptions smsAuthenticationOptions, ITwilioClient twilioClient, IOpenIdEventSource eventSource)
 {
     _confirmationCodeStore    = confirmationCodeStore;
     _smsAuthenticationOptions = smsAuthenticationOptions;
     _twilioClient             = twilioClient;
     _eventSource = eventSource;
 }
Example #2
0
 public SmsAuthenticateResourceOwnerService(
     IResourceOwnerRepository resourceOwnerRepository,
     IConfirmationCodeStore confirmationCodeStore)
 {
     _resourceOwnerRepository = resourceOwnerRepository;
     _confirmationCodeStore   = confirmationCodeStore;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthenticateController"/> class.
        /// </summary>
        /// <param name="dataProtectionProvider">The data protection provider.</param>
        /// <param name="urlHelperFactory">The URL helper factory.</param>
        /// <param name="actionContextAccessor">The action context accessor.</param>
        /// <param name="eventPublisher">The event publisher.</param>
        /// <param name="authenticationService">The authentication service.</param>
        /// <param name="authenticationSchemeProvider">The authentication scheme provider.</param>
        /// <param name="resourceOwnerServices">The resource owner services.</param>
        /// <param name="twoFactorAuthenticationHandler">The two factor authentication handler.</param>
        /// <param name="subjectBuilder">The subject builder.</param>
        /// <param name="authorizationCodeStore">The authorization code store.</param>
        /// <param name="scopeRepository">The scope repository.</param>
        /// <param name="tokenStore">The token store.</param>
        /// <param name="consentRepository">The consent repository.</param>
        /// <param name="confirmationCodeStore">The confirmation code store.</param>
        /// <param name="clientStore">The client store.</param>
        /// <param name="resourceOwnerRepository">The resource owner repository.</param>
        /// <param name="jwksStore"></param>
        /// <param name="accountFilters">The account filters.</param>
        /// <param name="logger">The controller logger.</param>
        /// <param name="runtimeSettings">The runtime settings.</param>
        public AuthenticateController(
            IDataProtectionProvider dataProtectionProvider,
            IUrlHelperFactory urlHelperFactory,
            IActionContextAccessor actionContextAccessor,
            IEventPublisher eventPublisher,
            IAuthenticationService authenticationService,
            IAuthenticationSchemeProvider authenticationSchemeProvider,
            IEnumerable <IAuthenticateResourceOwnerService> resourceOwnerServices,
            ITwoFactorAuthenticationHandler twoFactorAuthenticationHandler,
            ISubjectBuilder subjectBuilder,
            IAuthorizationCodeStore authorizationCodeStore,
            IScopeRepository scopeRepository,
            ITokenStore tokenStore,
            IConsentRepository consentRepository,
            IConfirmationCodeStore confirmationCodeStore,
            IClientStore clientStore,
            IResourceOwnerRepository resourceOwnerRepository,
            IJwksStore jwksStore,
            IEnumerable <AccountFilter> accountFilters,
            ILogger <AuthenticateController> logger,
            RuntimeSettings runtimeSettings)
            : base(
                dataProtectionProvider,
                urlHelperFactory,
                actionContextAccessor,
                eventPublisher,
                authenticationService,
                authenticationSchemeProvider,
                twoFactorAuthenticationHandler,
                authorizationCodeStore,
                consentRepository,
                scopeRepository,
                tokenStore,
                resourceOwnerRepository,
                confirmationCodeStore,
                clientStore,
                jwksStore,
                subjectBuilder,
                accountFilters,
                logger,
                runtimeSettings)
        {
            _eventPublisher = eventPublisher;
            _logger         = logger;
            var services = resourceOwnerServices.ToArray();

            _resourceOwnerServices     = services;
            _localOpenIdAuthentication = new LocalOpenIdUserAuthenticationAction(
                authorizationCodeStore,
                services,
                consentRepository,
                tokenStore,
                scopeRepository,
                clientStore,
                jwksStore,
                eventPublisher,
                logger);
        }
 public GenerateAndSendCodeAction(
     IResourceOwnerRepository resourceOwnerRepository,
     IConfirmationCodeStore confirmationCodeStore,
     ITwoFactorAuthenticationHandler twoFactorAuthenticationHandler)
 {
     _resourceOwnerRepository        = resourceOwnerRepository;
     _confirmationCodeStore          = confirmationCodeStore;
     _twoFactorAuthenticationHandler = twoFactorAuthenticationHandler;
 }
 public SmsAuthenticationOperation(
     RuntimeSettings settings,
     ISmsClient smsClient,
     IConfirmationCodeStore confirmationCodeStore,
     IResourceOwnerRepository resourceOwnerRepository,
     ISubjectBuilder subjectBuilder,
     IAccountFilter[] accountFilters,
     IEventPublisher eventPublisher,
     ILogger logger)
 {
     _salt = settings.Salt;
     _generateAndSendSmsCodeOperation = new GenerateAndSendSmsCodeOperation(
         smsClient,
         confirmationCodeStore,
         logger);
     _resourceOwnerRepository = resourceOwnerRepository;
     _addUser        = new AddUserOperation(settings, resourceOwnerRepository, accountFilters, subjectBuilder, eventPublisher);
     _subjectBuilder = subjectBuilder;
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CodeController"/> class.
 /// </summary>
 /// <param name="settings"></param>
 /// <param name="smsClient">The SMS client.</param>
 /// <param name="confirmationCodeStore">The confirmation code store.</param>
 /// <param name="resourceOwnerRepository">The resource owner repository.</param>
 /// <param name="subjectBuilder">The subject builder.</param>
 /// <param name="accountFilters">The account filters.</param>
 /// <param name="eventPublisher">The event publisher.</param>
 /// <param name="logger">The logger</param>
 public CodeController(
     RuntimeSettings settings,
     ISmsClient smsClient,
     IConfirmationCodeStore confirmationCodeStore,
     IResourceOwnerRepository resourceOwnerRepository,
     ISubjectBuilder subjectBuilder,
     IEnumerable <IAccountFilter> accountFilters,
     IEventPublisher eventPublisher,
     ILogger <CodeController> logger)
 {
     _smsAuthenticationOperation = new SmsAuthenticationOperation(
         settings,
         smsClient,
         confirmationCodeStore,
         resourceOwnerRepository,
         subjectBuilder,
         accountFilters.ToArray(),
         eventPublisher,
         logger);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="AuthenticateController"/> class.
        /// </summary>
        /// <param name="smsClient">The SMS client.</param>
        /// <param name="dataProtectionProvider">The data protection provider.</param>
        /// <param name="urlHelperFactory">The URL helper factory.</param>
        /// <param name="actionContextAccessor">The action context accessor.</param>
        /// <param name="eventPublisher">The event publisher.</param>
        /// <param name="authorizationCodeStore">The authorization code store.</param>
        /// <param name="authenticationService">The authentication service.</param>
        /// <param name="authenticationSchemeProvider">The authentication scheme provider.</param>
        /// <param name="twoFactorAuthenticationHandler">The two factor authentication handler.</param>
        /// <param name="subjectBuilder">The subject builder.</param>
        /// <param name="consentRepository">The consent repository.</param>
        /// <param name="scopeRepository">The scope repository.</param>
        /// <param name="tokenStore">The token store.</param>
        /// <param name="resourceOwnerRepository">The resource owner repository.</param>
        /// <param name="confirmationCodeStore">The confirmation code store.</param>
        /// <param name="clientStore">The client store.</param>
        /// <param name="jwksStore">The JWKS store.</param>
        /// <param name="accountFilters">The account filters.</param>
        /// <param name="logger">The controller logger.</param>
        /// <param name="runtimeSettings">The runtime settings.</param>
        public AuthenticateController(
            ISmsClient smsClient,
            IDataProtectionProvider dataProtectionProvider,
            IUrlHelperFactory urlHelperFactory,
            IActionContextAccessor actionContextAccessor,
            IEventPublisher eventPublisher,
            IAuthorizationCodeStore authorizationCodeStore,
            IAuthenticationService authenticationService,
            IAuthenticationSchemeProvider authenticationSchemeProvider,
            ITwoFactorAuthenticationHandler twoFactorAuthenticationHandler,
            ISubjectBuilder subjectBuilder,
            IConsentRepository consentRepository,
            IScopeRepository scopeRepository,
            ITokenStore tokenStore,
            IResourceOwnerRepository resourceOwnerRepository,
            IConfirmationCodeStore confirmationCodeStore,
            IClientStore clientStore,
            IJwksStore jwksStore,
            IEnumerable <IAccountFilter> accountFilters,
            ILogger <AuthenticateController> logger,
            RuntimeSettings runtimeSettings)
            : base(
                dataProtectionProvider,
                urlHelperFactory,
                actionContextAccessor,
                eventPublisher,
                authenticationService,
                authenticationSchemeProvider,
                twoFactorAuthenticationHandler,
                authorizationCodeStore,
                consentRepository,
                scopeRepository,
                tokenStore,
                resourceOwnerRepository,
                confirmationCodeStore,
                clientStore,
                jwksStore,
                subjectBuilder,
                accountFilters,
                logger,
                runtimeSettings)
        {
            _eventPublisher        = eventPublisher;
            _confirmationCodeStore = confirmationCodeStore;
            _logger           = logger;
            _getUserOperation = new GetUserOperation(resourceOwnerRepository, logger);
            var generateSms = new GenerateAndSendSmsCodeOperation(smsClient, confirmationCodeStore, logger);

            _smsAuthenticationOperation = new SmsAuthenticationOperation(
                runtimeSettings,
                smsClient,
                confirmationCodeStore,
                resourceOwnerRepository,
                subjectBuilder,
                accountFilters.ToArray(),
                eventPublisher,
                logger);
            _validateConfirmationCode = new ValidateConfirmationCodeAction(confirmationCodeStore);
            _authenticateHelper       = new AuthenticateHelper(
                authorizationCodeStore,
                tokenStore,
                scopeRepository,
                consentRepository,
                clientStore,
                jwksStore,
                eventPublisher,
                logger);
            _generateAndSendSmsCodeOperation = generateSms;
        }
 public ValidateConfirmationCodeAction(IConfirmationCodeStore confirmationCodeStore)
 {
     _confirmationCodeStore = confirmationCodeStore;
 }
Example #9
0
 public ConfirmationCodeHelper(IConfirmationCodeStore confirmationCodeStore)
 {
     _confirmationCodeStore = confirmationCodeStore;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseAuthenticateController"/> class.
 /// </summary>
 /// <param name="dataProtectionProvider">The data protection provider.</param>
 /// <param name="urlHelperFactory">The URL helper factory.</param>
 /// <param name="actionContextAccessor">The action context accessor.</param>
 /// <param name="eventPublisher">The event publisher.</param>
 /// <param name="authenticationService">The authentication service.</param>
 /// <param name="authenticationSchemeProvider">The authentication scheme provider.</param>
 /// <param name="twoFactorAuthenticationHandler">The two factor authentication handler.</param>
 /// <param name="authorizationCodeStore">The authorization code store.</param>
 /// <param name="consentRepository">The consent repository.</param>
 /// <param name="scopeRepository">The scope repository.</param>
 /// <param name="tokenStore">The token store.</param>
 /// <param name="resourceOwnerRepository">The resource owner repository.</param>
 /// <param name="confirmationCodeStore">The confirmation code store.</param>
 /// <param name="clientStore">The client store.</param>
 /// <param name="jwksStore"></param>
 /// <param name="subjectBuilder"></param>
 /// <param name="accountFilters">The account filters.</param>
 /// <param name="logger">The controller logger.</param>
 /// <param name="runtimeSettings">The runtime settings.</param>
 protected BaseAuthenticateController(
     IDataProtectionProvider dataProtectionProvider,
     IUrlHelperFactory urlHelperFactory,
     IActionContextAccessor actionContextAccessor,
     IEventPublisher eventPublisher,
     IAuthenticationService authenticationService,
     IAuthenticationSchemeProvider authenticationSchemeProvider,
     ITwoFactorAuthenticationHandler twoFactorAuthenticationHandler,
     IAuthorizationCodeStore authorizationCodeStore,
     IConsentRepository consentRepository,
     IScopeRepository scopeRepository,
     ITokenStore tokenStore,
     IResourceOwnerRepository resourceOwnerRepository,
     IConfirmationCodeStore confirmationCodeStore,
     IClientStore clientStore,
     IJwksStore jwksStore,
     ISubjectBuilder subjectBuilder,
     IEnumerable <IAccountFilter> accountFilters,
     ILogger logger,
     RuntimeSettings runtimeSettings)
     : base(authenticationService)
 {
     _generateAndSendCode = new GenerateAndSendCodeAction(
         resourceOwnerRepository,
         confirmationCodeStore,
         twoFactorAuthenticationHandler,
         logger);
     _validateConfirmationCode = new ValidateConfirmationCodeAction(confirmationCodeStore);
     _authenticateHelper       = new AuthenticateHelper(
         authorizationCodeStore,
         tokenStore,
         scopeRepository,
         consentRepository,
         clientStore,
         jwksStore,
         eventPublisher,
         logger);
     _authenticateResourceOwnerOpenId = new AuthenticateResourceOwnerOpenIdAction(
         authorizationCodeStore,
         tokenStore,
         scopeRepository,
         consentRepository,
         clientStore,
         jwksStore,
         eventPublisher,
         logger);
     DataProtector   = dataProtectionProvider.CreateProtector("Request");
     _urlHelper      = urlHelperFactory.GetUrlHelper(actionContextAccessor.ActionContext !);
     _eventPublisher = eventPublisher;
     _authenticationSchemeProvider = authenticationSchemeProvider;
     _addUser = new AddUserOperation(
         runtimeSettings,
         resourceOwnerRepository,
         accountFilters,
         subjectBuilder,
         eventPublisher);
     _getUserOperation               = new GetUserOperation(resourceOwnerRepository, logger);
     _updateUserClaimsOperation      = new UpdateUserClaimsOperation(resourceOwnerRepository, logger);
     _runtimeSettings                = runtimeSettings;
     _twoFactorAuthenticationHandler = twoFactorAuthenticationHandler;
     _resourceOwnerRepository        = resourceOwnerRepository;
     _confirmationCodeStore          = confirmationCodeStore;
     _logger = logger;
 }
 public RemoveConfirmationCodeAction(IConfirmationCodeStore confirmationCodeStore)
 {
     _confirmationCodeStore = confirmationCodeStore;
 }