public IInternetSharedRepositorySource GetSource(UserSecret userSecret, string sendReceiveServerUri,
                                                         string registryServerUri)
        {
            if (userSecret == null || string.IsNullOrEmpty(sendReceiveServerUri) ||
                string.IsNullOrEmpty(registryServerUri))
            {
                throw new ArgumentException();
            }

            string        ptUsername = _jwtTokenHelper.GetParatextUsername(userSecret);
            var           ptUser     = new SFParatextUser(ptUsername);
            JwtRestClient jwtClient  = GenerateParatextRegistryJwtClient(userSecret, registryServerUri);
            IInternetSharedRepositorySource source =
                new JwtInternetSharedRepositorySource(userSecret.ParatextTokens.AccessToken,
                                                      jwtClient, ptUser, sendReceiveServerUri);

            source.RefreshToken(userSecret.ParatextTokens.AccessToken);
            return(source);
        }
示例#2
0
 /// <summary> Get the Paratext username from the UserSecret. </summary>
 public string GetParatextUsername(UserSecret userSecret)
 {
     return(_jwtTokenHelper.GetParatextUsername(userSecret));
 }