コード例 #1
0
 public ServiceInterfacePrincipal(TokenObject tokenObject, string host, Uri urlReferrer, IIdentity identity, string callGuid, string bearerToken)
     : base(identity, null)
 {
     this.TokenObject = tokenObject;
     this.Host        = host;
     this.UrlReferrer = urlReferrer;
     this.Cono        = tokenObject.Cono;
     this.CallGuid    = callGuid;
     this.BearerToken = bearerToken;
 }
コード例 #2
0
 public static bool TokenToObject(string token, string encryptKey, string encryptIv, out TokenObject tokenObject)
 {
     tokenObject = new TokenObject();
     try
     {
         if (string.IsNullOrEmpty(token))
         {
             return(false);
         }
         token       = StringProtector.Unprotect(token, encryptKey, encryptIv);
         tokenObject = JsonConvert.DeserializeObject <TokenObject>(token);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #3
0
        public static string ObjectToToken(TokenObject tokenObject, string encryptKey, string encryptIv)
        {
            var token = JsonConvert.SerializeObject(tokenObject);

            return(StringProtector.Protect(token, encryptKey, encryptIv));
        }