Ejemplo n.º 1
0
		public static Credential CreateInstance(string uid, Cache cache)
		{
			if (cache != null && !cache.Exists(uid))
			{
				Credential c = new Credential(uid, cache);
				cache.Insert(uid, c, null, DateTime.MaxValue, DefaultDuration);
				return c;
			}
			else
			{
				return cache[uid] as Credential;
			}
		}
Ejemplo n.º 2
0
		private void ValidateRequest()
		{
			credential = Credential.CreateInstance(NewId(clientCredential.Uid), Cache);
			if (vmode != ValidationMode.None)
			{
				if (!credential.Validate(clientCredential))
				{
					credential = Credential.CreateInstance(NewId(), Cache);
				}
				if (OnAuthenticate != null)
				{
					OnAuthenticate();
				}
				GeneratePassword();
			}
			else
			{
				credential.Validate(clientCredential, false);
				GeneratePassword(false);
			}
			credential.GeneratePid(clientCredential, vmode != ValidationMode.None);
			clientCredential.ClientPassword = credential.ServerPassword;
			clientCredential.Page = PageId;
			clientCredential.Uid = credential.ClientUid;
			Cookie(KeyClientCacheJson, HttpUtility.UrlEncode(clientCredential.ToJson()));
			Cookie(KeyClientCache, HttpUtility.UrlEncode(clientCredential.ToXml()));
		}