Esempio n. 1
0
        public virtual void Authenticate(IRestClient client, IRestRequest request)
        {
            var tokenProxy = new TokenProxy();
            var token      = tokenProxy.RetrieveToken(this.ClientId, this.ClientSecret);

            request.AddAuthorization(string.Format(CultureInfo.CurrentCulture, "{0} {1}", token.TokenType, token.Token));

            request.AddAccountId(this.PublisherId);
        }
Esempio n. 2
0
        private static TokenProxy CreateTokenProxy(JwtSecurityToken jwtToken)
        {
            var tokenProxy = new TokenProxy
            {
                Token          = $"Bearer {new JwtSecurityTokenHandler().WriteToken(jwtToken)}",
                ExpirationDate = jwtToken.ValidTo
            };

            return(tokenProxy);
        }
Esempio n. 3
0
 static TokenProxy()
 {
     Instance = new TokenProxy();
 }