/// <summary>
        /// Initialize the Registry Server with a Jwt REST Client.
        /// </summary>
        private JwtRestClient GenerateParatextRegistryJwtClient(UserSecret userSecret, string registryServerUri)
        {
            string jwtToken = _jwtTokenHelper.GetJwtTokenFromUserSecret(userSecret);

            string api = registryServerUri + "/api8/";

            return(new JwtRestClient(api, _siteOptions.Value.Name, jwtToken));
        }
 public TestEnvironment()
 {
     MockJwtTokenHelper = Substitute.For <IJwtTokenHelper>();
     MockJwtTokenHelper.GetJwtTokenFromUserSecret(Arg.Any <UserSecret>()).Returns("token_1234");
     RegistryU.Implementation = new DotNetCoreRegistry();
     InternetAccess.RawStatus = InternetUse.Enabled;
     Provider = new InternetSharedRepositorySourceProvider(MockJwtTokenHelper);
 }
Esempio n. 3
0
        /// <summary>
        /// Initialize the Registry Server with a Jwt REST Client.
        /// </summary>
        private JwtRestClient GenerateParatextRegistryJwtClient(UserSecret userSecret,
                                                                string registryServerUri, string applicationProductVersion)
        {
            string jwtToken = _jwtTokenHelper.GetJwtTokenFromUserSecret(userSecret);

            string api = registryServerUri + "/api8/";

            return(new JwtRestClient(api, applicationProductVersion, jwtToken));
        }
Esempio n. 4
0
            public TestEnvironment()
            {
                MockJwtTokenHelper = Substitute.For <IJwtTokenHelper>();
                MockJwtTokenHelper.GetJwtTokenFromUserSecret(Arg.Any <UserSecret>()).Returns("token_1234");
                RegistryU.Implementation = new DotNetCoreRegistry();
                InternetAccess.RawStatus = InternetUse.Enabled;
                var siteOptions = Substitute.For <IOptions <SiteOptions> >();

                siteOptions.Value.Returns(new SiteOptions
                {
                    Name    = "xForge",
                    Origin  = new Uri("http://localhost"),
                    SiteDir = "xforge"
                });
                Provider = new InternetSharedRepositorySourceProvider(MockJwtTokenHelper, siteOptions);
            }
        /// <inheritdoc />
        public ISFRestClient Create(string baseUri, UserSecret userSecret)
        {
            string jwtToken = _jwtTokenHelper.GetJwtTokenFromUserSecret(userSecret);

            return(new JwtRestClient(baseUri, _siteOptions.Value.Name, jwtToken));
        }