Ejemplo n.º 1
0
        /// <summary>Gets the current authorization token.
        /// In the very first call, this method creates a new token before returning.
        /// If currently stored token is expired, this method creates a new one.
        /// </summary>
        /// <returns>Valid OAuthToken instance.</returns>
        public OAuthTokenDTO GetToken()
        {
            OAuthTokenDTO token = _storageStrategy.Get();

            if (token == null || token.IsExpired())
            {
                StoreToken(this._root.AuthenticationManager.CreateToken());
            }

            return(_storageStrategy.Get());
        }
Ejemplo n.º 2
0
        /// <summary>Gets the current authorization token.
        /// In the very first call, this method creates a new token before returning.
        /// If currently stored token is expired, this method creates a new one.
        /// </summary>
        /// <returns>Valid OAuthToken instance.</returns>
        public async Task <OAuthTokenDTO> GetToken()
        {
            OAuthTokenDTO token = _storageStrategy.Get(GetEnvKey());

            if (token == null || token.IsExpired())
            {
                StoreToken(await this._root.AuthenticationManager.CreateToken());
            }

            return(_storageStrategy.Get(GetEnvKey()));
        }
Ejemplo n.º 3
0
        /// <summary>Gets the current authorization token.
        /// In the very first call, this method creates a new token before returning.
        /// If currently stored token is expired, this method creates a new one.
        /// </summary>
        /// <returns>Valid OAuthToken instance.</returns>
        public OAuthTokenDTO GetToken()
        {
            OAuthTokenDTO token = _storageStrategy.Get(GetEnvKey());

            if (token == null || token.IsExpired())
            {
                var result = this._root.AuthenticationManager.CreateToken();
                StoreToken(result);
            }

            return(_storageStrategy.Get(GetEnvKey()));
        }