CertificateInstance ToCertificateInstance(AppAuthorizerModel aa) { var c = aa.ToCertificate(); var key = c.SecretKey + c.IssueDate.ToFileTime(); return(new CertificateInstance() { AppName = aa.AppName, certificate = c, token = myJwt.Encoder(c, key), tokenKey = key, ExpiryDate = DateTime.Now.AddSeconds(Config.CertificateInstanceExpiryDate) }); }
/// <summary> /// 更新凭证实例内容 /// </summary> /// <param nickname="ci"></param> /// <param nickname="aa"></param> /// <returns></returns> CertificateInstance UpateCertificateInstance(CertificateInstance ci, AppAuthorizerModel aa) { if (aa != null) { if (aa.IsValid() == CertificateStatue.凭证有效) { return(ToCertificateInstance(aa)); } else { return(null); } } else { return(null); } }