Example #1
0
        /// <summary>
        ///     Gets the auth data set on authorization
        /// </summary>
        /// <returns>Dictionary of auth data</returns>
        public Dictionary <string, string> GetData()
        {
            var authData = new Dictionary <string, string>
            {
                { "remember", IsRemember().ToString() },
                { "token_type", TokenType },
                { "access_token", AccessToken },
                { "expires_in", AccessTokenExpiresIn.ToString() },
                { "expire_time", AccessTokenExpireTime.ToString() },
                { "refresh_token", RefreshToken },
                { "refresh_token_expires_in", RefreshTokenExpiresIn.ToString() },
                { "refresh_token_expire_time", RefreshTokenExpireTime.ToString() },
                { "scope", Scope },
                { "owner_id", OwnerId }
            };

            return(authData);
        }
Example #2
0
        Save
        (
            string clientId
        )
        {
            // Compute the expiration times for the access
            AccessTokenExpiresAt = DateTime.UtcNow.AddSeconds(AccessTokenExpiresIn);

            // Compute the expiration times for the refresh token
            RefreshTokenExpiresAt = DateTime.UtcNow.AddSeconds(RefreshTokenExpiresIn);

            // Write the refresh token to encrypted storage file
            Crypto.EncryptAndSave(
                // Client Id (Used as key)
                clientId,

                // Refresh token to store
                string.Format("{0}##{1}##{2}##{3}##{4}##{5}",
                              AccessToken, RefreshToken, AccessTokenExpiresAt.ToString("s"), RefreshTokenExpiresAt.ToString("s"),
                              AccessTokenExpiresIn.ToString(), RefreshTokenExpiresIn.ToString()),

                // File to store refresh token in
                Broker.tokenDataFile);
        }