コード例 #1
0
        /// <inheritdoc />
        /// <summary>
        /// Initializes a new <see cref="T:Platibus.SQL.SQLMessageQueue" /> with the specified values
        /// </summary>
        /// <param name="queueName">The name of the queue</param>
        /// <param name="listener">The object that will be notified when messages are
        ///     added to the queue</param>
        /// <param name="options">(Optional) Settings that influence how the queue behaves</param>
        /// <param name="diagnosticService">(Optional) The service through which diagnostic events
        ///     are reported and processed</param>
        /// <param name="connectionProvider">The database connection provider</param>
        /// <param name="commandBuilders">A collection of factories capable of
        ///     generating database commands for manipulating queued messages that conform to the SQL
        ///     syntax required by the underlying connection provider</param>
        /// <param name="securityTokenService">(Optional) The message security token
        ///     service to use to issue and validate security tokens for persisted messages.</param>
        /// <param name="messageEncryptionService"></param>
        /// <exception cref="T:System.ArgumentNullException">Thrown if <paramref name="connectionProvider" />,
        /// <paramref name="commandBuilders" />, <paramref name="queueName" />, or <paramref name="listener" />
        /// are <c>null</c></exception>
        public SQLMessageQueue(QueueName queueName,
                               IQueueListener listener,
                               QueueOptions options, IDiagnosticService diagnosticService, IDbConnectionProvider connectionProvider,
                               IMessageQueueingCommandBuilders commandBuilders, ISecurityTokenService securityTokenService,
                               IMessageEncryptionService messageEncryptionService)
            : base(queueName, listener, options, diagnosticService)
        {
            if (queueName == null)
            {
                throw new ArgumentNullException(nameof(queueName));
            }
            if (listener == null)
            {
                throw new ArgumentNullException(nameof(listener));
            }

            ConnectionProvider       = connectionProvider ?? throw new ArgumentNullException(nameof(connectionProvider));
            CommandBuilders          = commandBuilders ?? throw new ArgumentNullException(nameof(commandBuilders));
            MessageEncryptionService = messageEncryptionService;
            SecurityTokenService     = securityTokenService ?? throw new ArgumentNullException(nameof(securityTokenService));

            MessageEnqueued         += OnMessageEnqueued;
            MessageAcknowledged     += OnMessageAcknowledged;
            AcknowledgementFailure  += OnAcknowledgementFailure;
            MaximumAttemptsExceeded += OnMaximumAttemptsExceeded;
        }
コード例 #2
0
 public EmailRequestController(ISecurityTokenService securityTokenService, IGroupUserService groupUserService, ISupportService supportService, IGroupInvitationService groupInvitationService)
 {
     this.securityTokenService = securityTokenService;
     this.groupUserService = groupUserService;
     this.supportService = supportService;
     this.groupInvitationService = groupInvitationService;
 }
コード例 #3
0
        public WorkflowTypeController
        (
            ISiteService siteService,
            ISession session,
            IActivityLibrary activityLibrary,
            IWorkflowManager workflowManager,
            IWorkflowTypeStore workflowTypeStore,
            IWorkflowTypeIdGenerator workflowTypeIdGenerator,
            IAuthorizationService authorizationService,
            IActivityDisplayManager activityDisplayManager,
            IShapeFactory shapeFactory,
            INotifier notifier,
            ISecurityTokenService securityTokenService,
            IStringLocalizer <WorkflowTypeController> s,
            IHtmlLocalizer <WorkflowTypeController> h
        )
        {
            _siteService             = siteService;
            _session                 = session;
            _activityLibrary         = activityLibrary;
            _workflowManager         = workflowManager;
            _workflowTypeStore       = workflowTypeStore;
            _workflowTypeIdGenerator = workflowTypeIdGenerator;
            _authorizationService    = authorizationService;
            _activityDisplayManager  = activityDisplayManager;
            _notifier                = notifier;
            _securityTokenService    = securityTokenService;

            New = shapeFactory;
            S   = s;
            H   = h;
        }
コード例 #4
0
 private void ConfigureAuthentication(IServiceCollection services)
 {
     services.AddAuthentication(x =>
     {
         x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
         x.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
     })
     .AddJwtBearer(x =>
     {
         x.RequireHttpsMetadata      = false;
         x.SaveToken                 = true;
         x.TokenValidationParameters = new TokenValidationParameters
         {
             ValidateIssuerSigningKey = true,
             ValidateIssuer           = false,
             ValidateAudience         = false,
             IssuerSigningKeyResolver = (string token, SecurityToken securityToken, string kid, TokenValidationParameters validationParameters) =>
             {
                 ISecurityTokenService tokenService = services.BuildServiceProvider().GetService <ISecurityTokenService>();
                 long tenantId      = Convert.ToInt64(kid);
                 byte[] securityKey = tokenService.GetTenantSecurityKey(tenantId);
                 return(new List <SecurityKey> {
                     new SymmetricSecurityKey(securityKey)
                 });
             }
         };
     });
 }
コード例 #5
0
 public EmailRequestController(ISecurityTokenService securityTokenService, IGroupUserService groupUserService, ISupportService supportService, IGroupInvitationService groupInvitationService)
 {
     this.securityTokenService   = securityTokenService;
     this.groupUserService       = groupUserService;
     this.supportService         = supportService;
     this.groupInvitationService = groupInvitationService;
 }
コード例 #6
0
        /// <inheritdoc />
        /// <summary>
        /// Initializes a new <see cref="T:Platibus.MongoDB.MongoDBMessageQueue" /> with the specified values
        /// </summary>
        /// <param name="queueName">The name of the queue</param>
        /// <param name="listener">The object that will be notified when messages are
        ///     added to the queue</param>
        /// <param name="options">(Optional) Settings that influence how the queue behaves</param>
        /// <param name="diagnosticService"></param>
        /// <param name="database">The MongoDB database</param>
        /// <param name="collectionName">(Optional) The name of the collection in which the
        ///     queued messages should be stored.  If omitted, the queue name will be used.</param>
        /// <param name="securityTokenService"></param>
        /// <param name="messageEncryptionService">(Optional) The message encryption service used
        /// to encrypt persistent messages at rest</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// Thrown if <paramref name="database" />, <paramref name="queueName" />, or
        /// <paramref name="listener" /> are <c>null</c>
        /// </exception>
        public MongoDBMessageQueue(QueueName queueName, IQueueListener listener, QueueOptions options,
                                   IDiagnosticService diagnosticService, IMongoDatabase database, string collectionName,
                                   ISecurityTokenService securityTokenService, IMessageEncryptionService messageEncryptionService)
            : base(queueName, listener, options, diagnosticService)
        {
            if (database == null)
            {
                throw new ArgumentNullException(nameof(database));
            }
            if (queueName == null)
            {
                throw new ArgumentNullException(nameof(queueName));
            }
            if (listener == null)
            {
                throw new ArgumentNullException(nameof(listener));
            }

            _securityTokenService     = securityTokenService ?? throw new ArgumentNullException(nameof(securityTokenService));
            _messageEncryptionService = messageEncryptionService;

            var myCollectionName = string.IsNullOrWhiteSpace(collectionName)
                ? MapToCollectionName(queueName)
                : collectionName;

            _queuedMessages          = database.GetCollection <QueuedMessageDocument>(myCollectionName);
            MessageEnqueued         += OnMessageEnqueued;
            MessageAcknowledged     += OnMessageAcknowledged;
            AcknowledgementFailure  += OnAcknowledgementFailure;
            MaximumAttemptsExceeded += OnMaximumAttemptsExceeded;
        }
コード例 #7
0
        public void SetUp()
        {
            userRepository          = new Mock <IUserRepository>();
            userProfileRepository   = new Mock <IUserProfileRepository>();
            followRequestRepository = new Mock <IFollowRequestRepository>();
            followUserRepository    = new Mock <IFollowUserRepository>();
            securityTokenRepository = new Mock <ISecurityTokenRepository>();


            unitOfWork = new Mock <IUnitOfWork>();

            userService          = new UserService(userRepository.Object, unitOfWork.Object, userProfileRepository.Object);
            userProfileService   = new UserProfileService(userProfileRepository.Object, unitOfWork.Object);
            followRequestService = new FollowRequestService(followRequestRepository.Object, unitOfWork.Object);
            followUserService    = new FollowUserService(followUserRepository.Object, unitOfWork.Object);
            securityTokenService = new SecurityTokenService(securityTokenRepository.Object, unitOfWork.Object);

            controllerContext = new Mock <ControllerContext>();
            contextBase       = new Mock <HttpContextBase>();
            httpRequest       = new Mock <HttpRequestBase>();
            httpResponse      = new Mock <HttpResponseBase>();
            genericPrincipal  = new Mock <GenericPrincipal>();
            httpSession       = new Mock <HttpSessionStateBase>();
            authentication    = new Mock <IFormsAuthentication>();


            identity          = new Mock <IIdentity>();
            principal         = new Mock <IPrincipal>();
            tempData          = new Mock <TempDataDictionary>();
            file              = new Mock <HttpPostedFileBase>();
            stream            = new Mock <Stream>();
            accountController = new Mock <AccountController>();
        }
コード例 #8
0
 public MongoDBMessageQueueInspector(QueueName queueName, QueueOptions options, IMongoDatabase database,
                                     string collectionName, ISecurityTokenService securityTokenService,
                                     IMessageEncryptionService messageEncryptionService)
     : base(queueName, new NoopQueueListener(), options, null, database, collectionName,
            securityTokenService, messageEncryptionService)
 {
 }
コード例 #9
0
        public void SetUp()
        {
            userRepository = new Mock<IUserRepository>();
            userProfileRepository = new Mock<IUserProfileRepository>();
            followRequestRepository = new Mock<IFollowRequestRepository>();
            followUserRepository = new Mock<IFollowUserRepository>();
            securityTokenRepository = new Mock<ISecurityTokenRepository>();


            unitOfWork = new Mock<IUnitOfWork>();

            userService = new UserService(userRepository.Object, unitOfWork.Object, userProfileRepository.Object);
            userProfileService = new UserProfileService(userProfileRepository.Object, unitOfWork.Object);
            followRequestService = new FollowRequestService(followRequestRepository.Object, unitOfWork.Object);
            followUserService = new FollowUserService(followUserRepository.Object, unitOfWork.Object);
            securityTokenService = new SecurityTokenService(securityTokenRepository.Object, unitOfWork.Object);

            controllerContext = new Mock<ControllerContext>();
            contextBase = new Mock<HttpContextBase>();
            httpRequest = new Mock<HttpRequestBase>();
            httpResponse = new Mock<HttpResponseBase>();
            genericPrincipal = new Mock<GenericPrincipal>();
            httpSession = new Mock<HttpSessionStateBase>();
            authentication = new Mock<IFormsAuthentication>();


            identity = new Mock<IIdentity>();
            principal = new Mock<IPrincipal>();
            tempData = new Mock<TempDataDictionary>();
            file = new Mock<HttpPostedFileBase>();
            stream = new Mock<Stream>();
            accountController = new Mock<AccountController>();

        }
コード例 #10
0
 public ForgotPasswordCommandHandler(IUserManager userManager, ISecurityTokenService securityToken,
                                     IMediator mediator)
 {
     _userManager   = userManager;
     _securityToken = securityToken;
     _mediator      = mediator;
 }
コード例 #11
0
 protected MessageQueueingServiceTests(IDiagnosticService diagnosticService, TMessageQueueingService messageQueueingService)
 {
     DiagnosticService      = diagnosticService ?? Platibus.Diagnostics.DiagnosticService.DefaultInstance;
     MessageQueueingService = messageQueueingService;
     SecurityTokenService   = new JwtSecurityTokenService();
     DiagnosticService.AddSink(VerificationSink);
 }
コード例 #12
0
 public HandlersTests(DatabaseFixture databaseFixture)
 {
     this.databaseFixture = databaseFixture;
     securityTokenService = Substitute.For <ISecurityTokenService>();
     securityTokenService
     .SaveDataWithTokenAsync(
         new List <string>
     {
         databaseFixture.PictureIdA.ToString(),
         databaseFixture.PictureIdB.ToString()
     },
         Arg.Any <Guid>())
     .Returns(string.Empty);
     securityTokenService
     .GetSavedData(
         Arg.Any <Guid>(),
         string.Empty)
     .Returns(new List <string>
     {
         databaseFixture.PictureIdA.ToString(),
         databaseFixture.PictureIdB.ToString()
     });
     mockWriter = Substitute.For <IWriter <PicturesMessageBusDto> >();
     mockWriter.Save(Arg.Any <PicturesMessageBusDto>()).Returns(Task.CompletedTask);
 }
コード例 #13
0
ファイル: TokenController.cs プロジェクト: xxxx-git/bab
 public TokenController(ISecurityTokenService tokenService,
                        IJsonCovnertService jsonService, ITokenHttpSettings tokenHttpSettings)
 {
     _tokenService      = tokenService;
     _jsonService       = jsonService;
     _tokenHttpSettings = tokenHttpSettings;
 }
コード例 #14
0
        public void SetUp()
        {
            securityTokenRepository = new Mock<ISecurityTokenRepository>();
            supportRepository = new Mock<ISupportRepository>();
            groupInvitationRepository = new Mock<IGroupInvitationRepository>();
            groupUserRepository = new Mock<IGroupUserRepository>();
            userRepository = new Mock<IUserRepository>();
            followUserRepository = new Mock<IFollowUserRepository>();
            //userProfileRepository=new Mock<UserProfileRepository>();

            unitOfWork = new Mock<IUnitOfWork>();

            tempData = new Mock<TempDataDictionary>();
            controllerContext = new Mock<ControllerContext>();
            contextBase = new Mock<HttpContextBase>();
            principal = new Mock<IPrincipal>();
            identity = new Mock<IIdentity>();
            httpRequest = new Mock<HttpRequestBase>();
            httpResponse = new Mock<HttpResponseBase>();
            genericPrincipal = new Mock<GenericPrincipal>();

            securityTokenService = new SecurityTokenService(securityTokenRepository.Object, unitOfWork.Object);
            groupInvitationService = new GroupInvitationService(groupInvitationRepository.Object, unitOfWork.Object);
            groupUserService = new GroupUserService(groupUserRepository.Object, userRepository.Object, unitOfWork.Object);
            supportService = new SupportService(supportRepository.Object, followUserRepository.Object, unitOfWork.Object);
            // userService = new UserService(userRepository.Object, unitOfWork.Object, userProfileRepository.Object);
        }
コード例 #15
0
        public void SetUp()
        {
            securityTokenRepository   = new Mock <ISecurityTokenRepository>();
            supportRepository         = new Mock <ISupportRepository>();
            groupInvitationRepository = new Mock <IGroupInvitationRepository>();
            groupUserRepository       = new Mock <IGroupUserRepository>();
            userRepository            = new Mock <IUserRepository>();
            followUserRepository      = new Mock <IFollowUserRepository>();
            //userProfileRepository=new Mock<UserProfileRepository>();

            unitOfWork = new Mock <IUnitOfWork>();

            tempData          = new Mock <TempDataDictionary>();
            controllerContext = new Mock <ControllerContext>();
            contextBase       = new Mock <HttpContextBase>();
            principal         = new Mock <IPrincipal>();
            identity          = new Mock <IIdentity>();
            httpRequest       = new Mock <HttpRequestBase>();
            httpResponse      = new Mock <HttpResponseBase>();
            genericPrincipal  = new Mock <GenericPrincipal>();

            securityTokenService   = new SecurityTokenService(securityTokenRepository.Object, unitOfWork.Object);
            groupInvitationService = new GroupInvitationService(groupInvitationRepository.Object, unitOfWork.Object);
            groupUserService       = new GroupUserService(groupUserRepository.Object, userRepository.Object, unitOfWork.Object);
            supportService         = new SupportService(supportRepository.Object, followUserRepository.Object, unitOfWork.Object);
            // userService = new UserService(userRepository.Object, unitOfWork.Object, userProfileRepository.Object);
        }
コード例 #16
0
 /// <summary>
 /// Validates the specified <paramref name="token"/>, returning <c>null</c> if the token is
 /// null or whitespace
 /// </summary>
 /// <param name="service">The message security token service used to validate the token</param>
 /// <param name="token">The token to validate</param>
 /// <returns>Returns the validated <see cref="IPrincipal"/> if <paramref name="token"/> is
 /// not <c>null</c> or whitespace; returns <c>null</c> otherwise</returns>
 public static async Task <IPrincipal> NullSafeValidate(this ISecurityTokenService service, string token)
 {
     if (string.IsNullOrWhiteSpace(token))
     {
         return(null);
     }
     return(await service.Validate(token));
 }
コード例 #17
0
 /// <inheritdoc />
 /// <summary>
 /// Initializes a new <see cref="T:Platibus.SQLite.SQLiteMessageQueue" />
 /// </summary>
 /// <param name="queueName">The name of the queue</param>
 /// <param name="listener">The object that will process messages off of the queue</param>
 /// <param name="options">(Optional) Options for concurrency and retry limits</param>
 /// <param name="diagnosticService">(Optional) The service through which diagnostic events
 ///     are reported and processed</param>
 /// <param name="baseDirectory">The directory in which the SQLite database will be created</param>
 /// <param name="securityTokenService">(Optional) A service for issuing security tokens
 ///     that can be stored with queued messages to preserve the security context in which
 ///     they were enqueued</param>
 /// <param name="messageEncryptionService"></param>
 public SQLiteMessageQueue(QueueName queueName,
                           IQueueListener listener,
                           QueueOptions options, IDiagnosticService diagnosticService, DirectoryInfo baseDirectory,
                           ISecurityTokenService securityTokenService, IMessageEncryptionService messageEncryptionService)
     : base(queueName, listener, options, diagnosticService, InitConnectionProvider(baseDirectory, queueName, diagnosticService),
            new SQLiteMessageQueueingCommandBuilders(), securityTokenService, messageEncryptionService)
 {
     _cancellationTokenSource = new CancellationTokenSource();
 }
コード例 #18
0
 public UserController(IUserService userService,
                       ICompanyService companyService,
                       ISecurityTokenService securityTokenService,
                       UserManager <ApplicationUser> userManager)
 {
     this.userService    = userService;
     this.companyService = companyService;
     this.userManager    = userManager;
 }
コード例 #19
0
ファイル: Facade.cs プロジェクト: Cognite-Soft/ARB_2016_V2
 public Facade(IDatabase database, IConfiguration configuration, IPasswordManager passwordManager,
     ISecurityTokenService securityTokenService, IMailNotifier mailNotifier, IDocumentStore documentStore)
 {
     _database = database;
     _configuration = configuration;
     _passwordManager = passwordManager;
     _securityTokenService = securityTokenService;
     _mailNotifier = mailNotifier;
     _documentStore = documentStore;
 }
コード例 #20
0
 public FilesystemMessageQueueingService(DirectoryInfo baseDirectory = null,
                                         ISecurityTokenService securityTokenService = null, IDiagnosticService diagnosticService = null)
     : this(new FilesystemMessageQueueingOptions
 {
     DiagnosticService = diagnosticService,
     BaseDirectory = baseDirectory,
     SecurityTokenService = securityTokenService
 })
 {
 }
コード例 #21
0
 public MongoDBMessageQueueingService(ConnectionStringSettings connectionStringSettings,
                                      ISecurityTokenService securityTokenService = null,
                                      string databaseName = null, QueueCollectionNameFactory collectionNameFactory = null)
     : this(new MongoDBMessageQueueingOptions(MongoDBHelper.Connect(connectionStringSettings, databaseName))
 {
     SecurityTokenService = securityTokenService,
     CollectionNameFactory = collectionNameFactory
 })
 {
 }
コード例 #22
0
 public SaveChosenPicturesCommandHandler(
     IMapper mapper,
     GeneratorContext context,
     IWriter <PicturesMessageBusDto> writer,
     ISecurityTokenService securityTokenService)
 {
     this.mapper  = mapper;
     this.context = context;
     this.writer  = writer;
     this.securityTokenService = securityTokenService;
 }
コード例 #23
0
 public SQLMessageQueueingService(IDbConnectionProvider connectionProvider,
                                  IMessageQueueingCommandBuilders commandBuilders,
                                  ISecurityTokenService securityTokenService = null,
                                  IDiagnosticService diagnosticService       = null)
     : this(new SQLMessageQueueingOptions(connectionProvider, commandBuilders)
 {
     DiagnosticService = diagnosticService,
     SecurityTokenService = securityTokenService
 })
 {
 }
コード例 #24
0
 public AccountController(IUserService userService, IUserProfileService userProfileService, IGoalService goalService, IUpdateService updateService, ICommentService commentService, IFollowRequestService followRequestService, IFollowUserService followUserService, ISecurityTokenService securityTokenService, UserManager<ApplicationUser> userManager)
 {
     this.userService = userService;
     this.userProfileService = userProfileService;
     this.goalService = goalService;
     this.updateService = updateService;
     this.commentService = commentService;
     this.followRequestService = followRequestService;
     this.followUserService = followUserService;
     this.securityTokenService = securityTokenService;
     this.UserManager = userManager;
 }
コード例 #25
0
 /// <summary>
 ///     Initializes a new <see cref="MongoDBMessageQueueingService"/>
 /// </summary>
 /// <param name="options">Options governing the behavior of the service</param>
 /// <exception cref="ArgumentNullException">
 ///     Thrown if  <paramref name="options"/> is <c>null</c>
 /// </exception>
 public MongoDBMessageQueueingService(MongoDBMessageQueueingOptions options)
 {
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     _diagnosticService        = options.DiagnosticService ?? DiagnosticService.DefaultInstance;
     _database                 = options.Database;
     _collectionNameFactory    = options.CollectionNameFactory ?? (_ => DefaultCollectionName);
     _securityTokenService     = options.SecurityTokenService ?? new JwtSecurityTokenService();
     _messageEncryptionService = options.MessageEncryptionService;
 }
コード例 #26
0
 public SQLMessageQueueingService(ConnectionStringSettings connectionStringSettings,
                                  IMessageQueueingCommandBuilders commandBuilders = null,
                                  ISecurityTokenService securityTokenService      = null,
                                  IDiagnosticService diagnosticService            = null)
     : this(new SQLMessageQueueingOptions(new DefaultConnectionProvider(connectionStringSettings),
                                          commandBuilders)
 {
     DiagnosticService = diagnosticService,
     SecurityTokenService = securityTokenService
 })
 {
 }
コード例 #27
0
 public UserAppService(IUserCommandHandler userCommandHandler,
                       IUserQueryHandler userQueryHandler,
                       ISecurityTokenService securityTokenService,
                       ICacheService cacheService,
                       CacheConfiguration cacheConfiguration)
 {
     _userCommandHandler   = userCommandHandler ?? throw new ArgumentNullException(nameof(userCommandHandler));
     _userQueryHandler     = userQueryHandler ?? throw new ArgumentNullException(nameof(userQueryHandler));
     _securityTokenService = securityTokenService ?? throw new ArgumentNullException(nameof(securityTokenService));
     _cacheService         = cacheService ?? throw new ArgumentNullException(nameof(cacheService));
     _cacheConfiguration   = cacheConfiguration ?? throw new ArgumentNullException(nameof(cacheConfiguration));
 }
コード例 #28
0
ファイル: AccountController.cs プロジェクト: debin168/mvcbase
 public AccountController(IUserService userService,
                          ICompanyService companyService,
                          //IUserProfileService userProfileService,
                          ISecurityTokenService securityTokenService,
                          UserManager <ApplicationUser> userManager)
 {
     this.userService    = userService;
     this.companyService = companyService;
     //this.userProfileService = userProfileService;
     this.securityTokenService = securityTokenService;
     this.UserManager          = userManager;
 }
コード例 #29
0
 /// <summary>
 /// Initializes a new <see cref="SQLMessageQueueingService"/> with the specified connection
 /// string settings and dialect
 /// </summary>
 /// <param name="options">Options influencing the behavior of this service</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="options"/>
 /// is <c>null</c></exception>
 /// <remarks>
 /// <para>If a SQL dialect is not specified, then one will be selected based on the
 /// supplied connection string settings</para>
 /// <para>If a security token service is not specified then a default implementation
 /// based on unsigned JWTs will be used.</para>
 /// </remarks>
 /// <seealso cref="Platibus.Config.Extensibility.IMessageQueueingCommandBuildersProvider"/>
 public SQLMessageQueueingService(SQLMessageQueueingOptions options)
 {
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     DiagnosticService         = options.DiagnosticService ?? Diagnostics.DiagnosticService.DefaultInstance;
     ConnectionProvider        = options.ConnectionProvider;
     CommandBuilders           = options.CommandBuilders;
     _securityTokenService     = options.SecurityTokenService ?? new JwtSecurityTokenService();
     _messageEncryptionService = options.MessageEncryptionService;
 }
コード例 #30
0
 public AccountController(IUserService userService, IUserProfileService userProfileService, IGoalService goalService, IUpdateService updateService, ICommentService commentService, IFollowRequestService followRequestService, IFollowUserService followUserService, ISecurityTokenService securityTokenService, UserManager <ApplicationUser> userManager)
 {
     this.userService          = userService;
     this.userProfileService   = userProfileService;
     this.goalService          = goalService;
     this.updateService        = updateService;
     this.commentService       = commentService;
     this.followRequestService = followRequestService;
     this.followUserService    = followUserService;
     this.securityTokenService = securityTokenService;
     this.UserManager          = userManager;
 }
コード例 #31
0
 public RabbitMQMessageQueueingService(Uri uri, QueueOptions defaultQueueOptions  = null,
                                       IConnectionManager connectionManager       = null, Encoding encoding = null,
                                       ISecurityTokenService securityTokenService = null,
                                       IDiagnosticService diagnosticService       = null)
     : this(new RabbitMQMessageQueueingOptions(uri)
 {
     DiagnosticService = diagnosticService,
     ConnectionManager = connectionManager,
     Encoding = encoding,
     DefaultQueueOptions = defaultQueueOptions,
     SecurityTokenService = securityTokenService
 })
 {
 }
コード例 #32
0
 public SignalMethodProvider(WorkflowExecutionContext workflowContext, ISecurityTokenService signalService)
 {
     _signalUrlMethod = new GlobalMethod
     {
         Name   = "signalUrl",
         Method = serviceProvider => (Func <string, string>)((signal) =>
         {
             var payload   = !String.IsNullOrWhiteSpace(workflowContext.CorrelationId) ? SignalPayload.ForCorrelation(signal, workflowContext.CorrelationId) : SignalPayload.ForWorkflow(signal, workflowContext.WorkflowId);
             var token     = signalService.CreateToken(payload, TimeSpan.FromDays(7));
             var urlHelper = serviceProvider.GetRequiredService <IUrlHelper>();
             return(urlHelper.Action("Trigger", "HttpWorkflow", new { area = "OrchardCore.Workflows", token }));
         })
     };
 }
コード例 #33
0
        /// <summary>
        /// Initializes a new <see cref="SQLiteMessageQueueingService"/>
        /// </summary>
        /// <param name="options">(Optional) Options that influence the behavior of this service</param>
        /// <remarks>
        /// <para>If a base directory is not specified then the base directory will default to a
        /// directory named <c>platibus\queues</c> beneath the current app domain base
        /// directory.  If the base directory does not exist it will be created.</para>
        /// <para>If a security token service is not specified then a default implementation based
        /// on unsigned JWTs will be used.</para>
        /// </remarks>
        public SQLiteMessageQueueingService(SQLiteMessageQueueingOptions options)
        {
            DiagnosticService = options?.DiagnosticService ?? Diagnostics.DiagnosticService.DefaultInstance;
            var baseDirectory = options?.BaseDirectory;

            if (baseDirectory == null)
            {
                var appdomainDirectory = AppDomain.CurrentDomain.BaseDirectory;
                baseDirectory = new DirectoryInfo(Path.Combine(appdomainDirectory, "platibus", "queues"));
            }
            _baseDirectory            = baseDirectory;
            _securityTokenService     = options?.SecurityTokenService ?? new JwtSecurityTokenService();
            _messageEncryptionService = options?.MessageEncryptionService;
        }
コード例 #34
0
 public AuthenticationController(IIdentityService authService,
                                 ISecurityTokenService tokenService,
                                 IConfiguration configuration,
                                 IMapper mapper)
 {
     this._identityService = authService ??
                             throw new ArgumentNullException(nameof(authService));
     this._tokenService = tokenService ??
                          throw new ArgumentNullException(nameof(tokenService));
     _configuration = configuration ??
                      throw new ArgumentNullException(nameof(configuration));
     _mapper = mapper ??
               throw new ArgumentNullException(nameof(mapper));
 }
コード例 #35
0
ファイル: GoalController.cs プロジェクト: ckaeser/SocialGoal
 public GoalController(IGoalService goalService, IMetricService metricService, IFocusService focusService, ISupportService supportService, IUpdateService updateService, ICommentService commentService, IUserService userService, ISecurityTokenService securityTokenService, ISupportInvitationService supportInvitationService, IGoalStatusService goalStatusService, ICommentUserService commentUserService, IUpdateSupportService updateSupportService)
 {
     this.goalService = goalService;
     this.supportInvitationService = supportInvitationService;
     this.metricService            = metricService;
     this.focusService             = focusService;
     this.supportService           = supportService;
     this.updateService            = updateService;
     this.commentService           = commentService;
     this.userService          = userService;
     this.securityTokenService = securityTokenService;
     this.goalStatusService    = goalStatusService;
     this.commentUserService   = commentUserService;
     this.updateSupportService = updateSupportService;
 }
コード例 #36
0
 public GoalController(IGoalService goalService, IMetricService metricService, IFocusService focusService, ISupportService supportService, IUpdateService updateService, ICommentService commentService, IUserService userService, ISecurityTokenService securityTokenService, ISupportInvitationService supportInvitationService, IGoalStatusService goalStatusService, ICommentUserService commentUserService, IUpdateSupportService updateSupportService)
 {
     this.goalService = goalService;
     this.supportInvitationService = supportInvitationService;
     this.metricService = metricService;
     this.focusService = focusService;
     this.supportService = supportService;
     this.updateService = updateService;
     this.commentService = commentService;
     this.userService = userService;
     this.securityTokenService = securityTokenService;
     this.goalStatusService = goalStatusService;
     this.commentUserService = commentUserService;
     this.updateSupportService = updateSupportService;
 }
コード例 #37
0
 public GroupController(IGroupService groupService, IGroupUserService groupUserService, IUserService userService, IMetricService metricService, IFocusService focusService, IGroupGoalService groupgoalService, IGroupInvitationService groupInvitationService, ISecurityTokenService securityTokenService, IGroupUpdateService groupUpdateService, IGroupCommentService groupCommentService, IGoalStatusService goalStatusService, IGroupRequestService groupRequestService, IFollowUserService followUserService, IGroupCommentUserService groupCommentUserService, IGroupUpdateSupportService groupUpdateSupportService, IGroupUpdateUserService groupUpdateUserService)
 {
     this.groupService = groupService;
     this.groupInvitationService = groupInvitationService;
     this.userService = userService;
     this.groupUserService = groupUserService;
     this.metricService = metricService;
     this.focusService = focusService;
     this.groupGoalService = groupgoalService; ;
     this.securityTokenService = securityTokenService;
     this.groupUpdateService = groupUpdateService;
     this.groupCommentService = groupCommentService;
     this.goalStatusService = goalStatusService;
     this.groupRequestService = groupRequestService;
     this.followUserService = followUserService;
     this.groupCommentUserService = groupCommentUserService;
     this.groupUpdateSupportService = groupUpdateSupportService;
     this.groupUpdateUserService = groupUpdateUserService;
 }
コード例 #38
0
        public void SetUp()
        {
            goalRepository = new Mock<IGoalRepository>();
            followuserRepository = new Mock<IFollowUserRepository>();
            supportRepository = new Mock<ISupportRepository>();
            goalStatusRepository = new Mock<IGoalStatusRepository>();
            focusRepository = new Mock<IFocusRepository>();
            metricRepository = new Mock<IMetricRepository>();
            updateRepository = new Mock<IUpdateRepository>();
            userRepository = new Mock<IUserRepository>();
            supportrepository = new Mock<ISupportRepository>();
            supportInvitationrepository = new Mock<ISupportInvitationRepository>();
            commentRepository = new Mock<ICommentRepository>();
            commentUserRepository = new Mock<ICommentUserRepository>();
            securityTokenrepository = new Mock<ISecurityTokenRepository>();
            userProfileRepository = new Mock<IUserProfileRepository>();
            updateSupportRepository = new Mock<IUpdateSupportRepository>();

            userMailer = new Mock<IUserMailer>();
            userMailerMock = new Mock<UserMailer>();
            mailerBase = new Mock<MailerBase>();
            unitOfWork = new Mock<IUnitOfWork>();

            goalService = new GoalService(goalRepository.Object, followuserRepository.Object, unitOfWork.Object);
            supportService = new SupportService(supportRepository.Object, followuserRepository.Object, unitOfWork.Object);
            goalStatusService = new GoalStatusService(goalStatusRepository.Object, unitOfWork.Object);
            focusService = new FocusService(focusRepository.Object, unitOfWork.Object);
            metricService = new MetricService(metricRepository.Object, unitOfWork.Object);
            updateService = new UpdateService(updateRepository.Object, goalRepository.Object, unitOfWork.Object, followuserRepository.Object);
            userService = new UserService(userRepository.Object, unitOfWork.Object, userProfileRepository.Object);
            supportService = new SupportService(supportrepository.Object, followuserRepository.Object, unitOfWork.Object);
            supportInvitationService = new SupportInvitationService(supportInvitationrepository.Object, unitOfWork.Object);
            commentService = new CommentService(commentRepository.Object, commentUserRepository.Object, unitOfWork.Object, followuserRepository.Object);
            commentUserService = new CommentUserService(commentUserRepository.Object, userRepository.Object, unitOfWork.Object);
            securityTokenService = new SecurityTokenService(securityTokenrepository.Object, unitOfWork.Object);
            userProfileService = new UserProfileService(userProfileRepository.Object, unitOfWork.Object);
            updateSupportService = new UpdateSupportService(updateSupportRepository.Object, unitOfWork.Object);

            MailerBase.IsTestModeEnabled = true;
            userMailerMock.CallBase = true;

            controllerContext = new Mock<ControllerContext>();
            contextBase = new Mock<HttpContextBase>();
            httpRequest = new Mock<HttpRequestBase>();
            httpResponse = new Mock<HttpResponseBase>();
            genericPrincipal = new Mock<GenericPrincipal>();

            identity = new Mock<IIdentity>();
            principal = new Mock<IPrincipal>();
        }