public void UpdateUserFromJWT()
        {
            var apiType = Enum.Parse <ExamplesAPIType>(this._configuration["ExamplesAPI"]);
            var scopes  = new List <string>
            {
                "signature",
                "impersonation",
            };

            if (apiType == ExamplesAPIType.Rooms)
            {
                scopes.AddRange(new List <string> {
                    "dtr.rooms.read",
                    "dtr.rooms.write",
                    "dtr.documents.read",
                    "dtr.documents.write",
                    "dtr.profile.read",
                    "dtr.profile.write",
                    "dtr.company.read",
                    "dtr.company.write",
                    "room_forms"
                });
            }

            if (apiType == ExamplesAPIType.Click)
            {
                scopes.AddRange(new List <string> {
                    "click.manage",
                    "click.send"
                });
            }

            this._authToken = _apiClient.RequestJWTUserToken(
                this._configuration["DocuSignJWT:ClientId"],
                this._configuration["DocuSignJWT:ImpersonatedUserId"],
                this._configuration["DocuSignJWT:AuthServer"],
                DSHelper.ReadFileContent(DSHelper.PrepareFullPrivateKeyFilePath(this._configuration["DocuSignJWT:PrivateKeyFile"])), 1, scopes);
            _account = GetAccountInfo(_authToken);

            this.User = new User
            {
                Name        = _account.AccountName,
                AccessToken = _authToken.access_token,
                ExpireIn    = DateTime.Now.AddSeconds(_authToken.expires_in.Value),
                AccountId   = _account.AccountId
            };

            this.Session = new Session
            {
                AccountId        = _account.AccountId,
                AccountName      = _account.AccountName,
                BasePath         = _account.BaseUri,
                RoomsApiBasePath = _configuration["DocuSign:RoomsApiEndpoint"]
            };
        }
Пример #2
0
        public void UpdateUserFromJWT()
        {
            this._authToken = _apiClient.RequestJWTUserToken(
                this._configuration["DocuSignJWT:ClientId"],
                this._configuration["DocuSignJWT:ImpersonatedUserId"],
                this._configuration["DocuSignJWT:AuthServer"],
                DSHelper.ReadFileContent(DSHelper.PrepareFullPrivateKeyFilePath(this._configuration["DocuSignJWT:PrivateKeyFile"])),
                1,
                new List <string>
            {
                "signature",
                "impersonation",
                "dtr.rooms.read",
                "dtr.rooms.write",
                "dtr.documents.read",
                "dtr.documents.write",
                "dtr.profile.read",
                "dtr.profile.write",
                "dtr.company.read",
                "dtr.company.write",
                "room_forms"
            });
            _account = GetAccountInfo(_authToken);

            this.User = new User
            {
                Name        = _account.AccountName,
                AccessToken = _authToken.access_token,
                ExpireIn    = DateTime.Now.AddSeconds(_authToken.expires_in.Value),
                AccountId   = _account.AccountId
            };

            this.Session = new Session
            {
                AccountId        = _account.AccountId,
                AccountName      = _account.AccountName,
                BasePath         = _account.BaseUri,
                RoomsApiBasePath = _configuration["DocuSign:RoomsApiEndpoint"]
            };
        }