Ejemplo n.º 1
0
        public SignInManager(AuthenticationWrapper authWrapper)
        {
            this.authenticationWrapper = authWrapper;

            this.authenticationWrapper.InitializeIssueTokenAction(issueTokenAction);
            this.authenticationWrapper.InitializeRevokeTokenAction(revokeTokenAction);
        }
Ejemplo n.º 2
0
 /// <inheritdoc />
 public TaskControllerImpl(ProcessEngineWrapper processEngine,
                           IProcessEngine engine,
                           TaskResourceAssembler taskResourceAssembler,
                           AuthenticationWrapper authenticationWrapper,
                           TaskConverter taskConverter)
 {
     this.engine                = engine;
     this.taskService           = engine.TaskService;
     this.authenticationWrapper = authenticationWrapper;
     this.processEngine         = processEngine;
     this.taskResourceAssembler = taskResourceAssembler;
     this.taskConverter         = taskConverter;
 }
Ejemplo n.º 3
0
 /// <inheritdoc />
 public TaskControllerImpl(ProcessEngineWrapper processEngine,
                           IProcessEngine engine,
                           TaskResourceAssembler taskResourceAssembler,
                           AuthenticationWrapper authenticationWrapper,
                           TaskConverter taskConverter,
                           ILoggerFactory loggerFactory)
 {
     this.engine                = engine;
     this.taskService           = engine.TaskService;
     this.authenticationWrapper = authenticationWrapper;
     this.processEngine         = processEngine;
     this.taskResourceAssembler = taskResourceAssembler;
     this.taskConverter         = taskConverter;
     this.logger                = loggerFactory.CreateLogger <TaskControllerImpl>();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="Bot" /> class.
        /// </summary>
        /// <param name="options">The bot options.</param>
        /// <param name="graphLogger">The graph logger.</param>
        public Bot(BotOptions options, IGraphLogger graphLogger)
        {
            this.botBaseUri  = options.BotBaseUrl;
            this.GraphLogger = graphLogger;
            var name = this.GetType().Assembly.GetName().Name;

            this.AuthenticationProvider = new AuthenticationProvider(name, options.AppId, options.AppSecret, graphLogger);
            this.Serializer             = new CommsSerializer();

            var authenticationWrapper = new AuthenticationWrapper(this.AuthenticationProvider);

            this.NotificationProcessor = new NotificationProcessor(authenticationWrapper, this.Serializer);
            this.NotificationProcessor.OnNotificationReceived += this.NotificationProcessor_OnNotificationReceived;
            this.RequestBuilder = new GraphServiceClient(options.PlaceCallEndpointUrl.AbsoluteUri, authenticationWrapper);

            // Add the default headers used by the graph client.
            // This will include SdkVersion.
            var defaultProperties = new List <IGraphProperty <IEnumerable <string> > >();

            using (HttpClient tempClient = GraphClientFactory.Create(authenticationWrapper))
            {
                defaultProperties.AddRange(tempClient.DefaultRequestHeaders.Select(header => GraphProperty.RequestProperty(header.Key, header.Value)));
            }

            // graph client
            var productInfo = new ProductInfoHeaderValue(
                typeof(Bot).Assembly.GetName().Name,
                typeof(Bot).Assembly.GetName().Version.ToString());

            this.GraphApiClient = new GraphAuthClient(
                this.GraphLogger,
                this.Serializer.JsonSerializerSettings,
                new HttpClient(),
                this.AuthenticationProvider,
                productInfo,
                defaultProperties);

            // setup media prompt
            this.MediaMap[BotIncomingPromptName] = new MediaPrompt
            {
                MediaInfo = new MediaInfo
                {
                    Uri        = new Uri(options.BotBaseUrl, "audio/speech.wav").ToString(),
                    ResourceId = Guid.NewGuid().ToString(),
                },
            };
        }