Exemplo n.º 1
0
        /// <summary>
        /// Output all properties
        /// </summary>
        /// <returns>A string</returns>
        public override string ToString()
        {
            var toString = new StringBuilder();

            toString.Append("AccessTokenValue: ").AppendLine(AccessToken);
            toString.Append("TokenType: ").AppendLine(TokenType);
            toString.Append("ExpiresIn: ").AppendLine(ExpiresIn.ToString(CultureInfo.InvariantCulture));
            toString.Append("ExpiresIn: ").AppendLine(Store.ToString());
            return(toString.ToString());
        }
Exemplo n.º 2
0
        protected new void ToString(List <string> toStringOutput)
        {
            toStringOutput.Add($"AccessToken = {(AccessToken == null ? "null" : AccessToken == string.Empty ? "" : AccessToken)}");
            toStringOutput.Add($"TokenType = {(TokenType == null ? "null" : TokenType == string.Empty ? "" : TokenType)}");
            toStringOutput.Add($"ExpiresIn = {(ExpiresIn == null ? "null" : ExpiresIn.ToString())}");
            toStringOutput.Add($"Scope = {(Scope == null ? "null" : Scope == string.Empty ? "" : Scope)}");
            toStringOutput.Add($"Expiry = {(Expiry == null ? "null" : Expiry.ToString())}");

            base.ToString(toStringOutput);
        }
Exemplo n.º 3
0
        private string CalculateSignature(string key)
        {
            string content = Timestamp + Application + ExpiresIn.ToString();

            byte[] contentBytes = Encoding.ASCII.GetBytes(content);

            byte[] keyBytes = Encoding.ASCII.GetBytes(key);
            System.Security.Cryptography.HMACSHA256 hmac = new System.Security.Cryptography.HMACSHA256(keyBytes);
            byte[] signatureBytes = hmac.ComputeHash(contentBytes);
            return(Convert.ToBase64String(signatureBytes));
        }