public override void Receive(AuthenticationTokenReceiveContext context)
        {
            string token = context.Token;

            if (tokens.ContainsKey(token))
            {
                string value = tokens[token];
                tokens.Remove(token);
                context.DeserializeTicket(value);
            }
            else
            {
                context.SetCustomError("刷新票据已经失效");
            }
        }
Exemple #2
0
 public override Task ReceiveAsync(AuthenticationTokenReceiveContext context)
 {
     return(Task.Factory.StartNew(() =>
     {
         string code = context.Token;
         if (codes.ContainsKey(code))
         {
             string value = codes[code];
             codes.Remove(code);
             context.DeserializeTicket(value);
         }
         else
         {
             context.SetCustomError("code已经失效");
         }
     }));
 }