예제 #1
0
        public async Task GetAnonApplicationTokenForP2PCallShouldReturnToken()
        {
            // Given

            // When
            IAnonymousApplicationToken token = await m_application.GetAnonApplicationTokenForP2PCallAsync(null, null, m_loggingContext).ConfigureAwait(false);

            // Then
            Assert.IsNotNull(token);
        }
예제 #2
0
        public async Task GetAnonApplicationTokenForP2PCallShouldWorkWithNullLoggingContext()
        {
            // Given
            // Setup

            // When
            IAnonymousApplicationToken token = await m_application.GetAnonApplicationTokenForP2PCallAsync("https://example.com;https://examples.com", Guid.NewGuid().ToString(), null).ConfigureAwait(false);

            // Then
            Assert.IsNotNull(token);
        }
예제 #3
0
        public async Task GetAnonApplicationTokenForMeetingShouldWorkWithNullLoggingContext()
        {
            // Given
            // Setup

            // When
            IAnonymousApplicationToken token = await m_application.GetAnonApplicationTokenForMeetingAsync("https://example.com/meetingurl", null, null, null).ConfigureAwait(false);

            // Then
            Assert.IsNotNull(token);
        }
예제 #4
0
        public async Task AnonymousApplicationsDiscoverUriShouldThrowIfInvalidUrlInResponse()
        {
            // Given
            m_restfulClient.OverrideResponse(new Uri(DataUrls.AnonToken), HttpMethod.Post, HttpStatusCode.OK, "AnonApplicationToken_MalformedDiscoverUri.json");
            m_anonToken = await m_application.GetAnonApplicationTokenForMeetingAsync("https://example.com/meetingjoinurl", "https://example.com;https://example1.com", Guid.NewGuid().ToString(), m_loggingContext).ConfigureAwait(false);

            // When
            Uri discoverUri = m_anonToken.AnonymousApplicationsDiscoverUri;

            // Then
            // Exception is thrown
        }
        static void Main(string[] args)
        {
            Dictionary <string, string> skypeAuthSettings = new Dictionary <string, string>()
            {
                { "AAD_ClientId", "" },
                { "AAD_ClientSecret", "" },
                { "ApplicationEndpointId", "" },
                { "DiscoverUri", "https://api.skypeforbusiness.com/platformservice/discover?Region=northamerica" }
            };

            var logger = new StringLogger();

            try
            {
                ClientPlatformSettings platformSettings =
                    new ClientPlatformSettings(new Uri(skypeAuthSettings["DiscoverUri"]), new Guid(skypeAuthSettings["AAD_ClientId"]), null, skypeAuthSettings["AAD_ClientSecret"], false);


                var platform = new ClientPlatform(platformSettings, logger);

                //Prepare endpoint
                var endpointSettings = new ApplicationEndpointSettings(new SipUri(skypeAuthSettings["ApplicationEndpointId"]));
                ApplicationEndpoint applicationEndpoint = new ApplicationEndpoint(platform, endpointSettings, null);

                var loggingContext = new LoggingContext(Guid.NewGuid());
                applicationEndpoint.InitializeAsync().GetAwaiter().GetResult();
                applicationEndpoint.InitializeApplicationAsync().GetAwaiter().GetResult();


                //Schedule meeting
                var input        = new AdhocMeetingCreationInput(Guid.NewGuid().ToString("N") + "testMeeting");
                var adhocMeeting = applicationEndpoint.Application.CreateAdhocMeetingAsync(input, loggingContext).Result;

                Console.WriteLine("ad hoc meeting uri : " + adhocMeeting.OnlineMeetingUri);
                Console.WriteLine("ad hoc meeting join url : " + adhocMeeting.JoinUrl);

                //Get anon join token
                IAnonymousApplicationToken anonToken = applicationEndpoint.Application.GetAnonApplicationTokenForMeetingAsync(adhocMeeting.JoinUrl, "https://contoso.com;https://litware.com;http://www.microsoftstore.com/store/msusa/en_US/home<https://urldefense.proofpoint.com/v2/url?u=https-3A__contoso.com-3Bhttps-3A_litware.com-3Bhttp-3A_www.microsoftstore.com_store_msusa_en-5FUS_home&d=DwMGaQ&c=Bi8ZWNNcZUBhi-AHLorvrkVH0ArnzxTAZ7C8kNcJoZo&r=uycUjr279qo0kuj5jNiyFqi9adZMUkMtmsdo99NlvRQ&m=7jet88f1Tbswi73IIaQYzhITPDlxR_mzF2flXNxdbwQ&s=ozm8LVnKFoAyQtSX8KWnm56u950cmjrR5fvfEpP1SfM&e=>", Guid.NewGuid().ToString(), loggingContext).Result;

                Console.WriteLine("Get anon token : " + anonToken.AuthToken);
                Console.WriteLine("Get discover url for web SDK : " + anonToken.AnonymousApplicationsDiscoverUri);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.Read();
        }
예제 #6
0
        public async void TestSetup()
        {
            TestHelper.InitializeTokenMapper();

            m_loggingContext = new LoggingContext(Guid.NewGuid());

            var data = TestHelper.CreateApplicationEndpoint();

            m_restfulClient = data.RestfulClient;

            await data.ApplicationEndpoint.InitializeAsync(m_loggingContext).ConfigureAwait(false);

            await data.ApplicationEndpoint.InitializeApplicationAsync(m_loggingContext).ConfigureAwait(false);

            m_application = data.ApplicationEndpoint.Application;

            m_anonToken = await m_application.GetAnonApplicationTokenForMeetingAsync("https://example.com/meetingjoinurl", "https://example.com;https://example1.com", Guid.NewGuid().ToString(), m_loggingContext).ConfigureAwait(false);
        }
예제 #7
0
      public async Task Run()
      {
          var logger = new SampleAppLogger();

          logger.HttpRequestResponseNeedsToBeLogged = true;  //Set to true if you want to log all http request and responses

          //Prepare platform
          ClientPlatformSettings platformSettings = new ClientPlatformSettings(QuickSamplesConfig.AAD_ClientSecret, Guid.Parse(QuickSamplesConfig.AAD_ClientId));

          var platform = new ClientPlatform(platformSettings, logger);

          //Prepare endpoint
          var eventChannel     = new FakeEventChannel();
          var endpointSettings = new ApplicationEndpointSettings(new SipUri(QuickSamplesConfig.ApplicationEndpointId));
          ApplicationEndpoint applicationEndpoint = new ApplicationEndpoint(platform, endpointSettings, eventChannel);

          var loggingContext = new LoggingContext(Guid.NewGuid());
          await applicationEndpoint.InitializeAsync(loggingContext).ConfigureAwait(false);

          await applicationEndpoint.InitializeApplicationAsync(loggingContext).ConfigureAwait(false);


          //Schedule meeting
          var input        = new AdhocMeetingCreationInput(Guid.NewGuid().ToString("N") + "testMeeting");
          var adhocMeeting = await applicationEndpoint.Application.CreateAdhocMeetingAsync(loggingContext, input).ConfigureAwait(false);

          logger.Information("ad hoc meeting uri : " + adhocMeeting.OnlineMeetingUri);
          logger.Information("ad hoc meeting join url : " + adhocMeeting.JoinUrl);

          //Get anon join token
          IAnonymousApplicationToken anonToken = await applicationEndpoint.Application.GetAnonApplicationTokenForMeetingAsync(
              loggingContext,
              adhocMeeting.JoinUrl,
              "https://contoso.com;https://litware.com;http://www.microsoftstore.com/store/msusa/en_US/home", //Fill your own web site, For allow cross domain using
              Guid.NewGuid().ToString()                                                                       //Should be unique everytime
              ).ConfigureAwait(false);

          logger.Information("Get anon token : " + anonToken.AuthToken);
          logger.Information("Get discover url for web SDK : " + anonToken.AnonymousApplicationsDiscoverUri.ToString());

          Console.ForegroundColor = ConsoleColor.Green;
          logger.Information("RemoteAdvisor sample completed successfully!");
          Console.ResetColor();
      }