using System;
using System.Collections.Generic;
using System.Text;

namespace DFS.Core.Mvc.Jwt.Impl
{
    /// <summary>
    /// web token 管理对象接口
    /// </summary>
    public interface ITokenManager
    {
        /// <summary>
        /// 生成token
        /// </summary>
        /// <param name="payload">非敏感信息</param>
        /// <param name="secret">密钥</param>
        /// <returns></returns>
        string BuildToken(object payload, string secret);

        /// <summary>
        /// 解码token获取json信息
        /// </summary>
        /// <param name="token">token</param>
        /// <param name="secret">密钥</param>
        /// <param name="verify">是否验证签名后再返回解码信息</param>
        /// <returns></returns>
        string DecodeToken(string token, string secret, bool verify = true);

        /// <summary>
        /// 解码token获取json信息
        /// </summary>
        /// <param name="token">token</param>
        /// <param name="secret">密钥</param>
        /// <param name="verify">是否验证签名后再返回解码信息</param>
        /// <returns></returns>
        T DecodeToken<T>(string token, string secret, bool verify = true);
    }
}
