public AuthenticationInfo GetAuthenticationInfo(string authenticationCookie, string userData) { if (string.IsNullOrEmpty(authenticationCookie)) { throw new ArgumentException("authenticationCookie"); } AuthenticationInfo ai = EncryptionServices.Decode(authenticationCookie); return(ai); }
public string AuthenticateUser(string userName, string password, string userData, TimeSpan lifeTime, string impersonatedUser) { if (!ValidateUser(userName, password, null)) { LoggingAgent.Login(userName, false); //throw new Exception("User name or password is incorrect"); return(string.Empty); } AuthenticationInfo ai = new AuthenticationInfo() { UserName = userName, ExpirationTime = DateTime.UtcNow + lifeTime, PermissionsToken = PermissionsTable.Instance.ToToken(GetUserPermissions(userName)), ImpersonatedUserName = impersonatedUser }; LoggingAgent.Login(userName, true); return(EncryptionServices.Encode(ai)); }