Exemple #1
0
        internal virtual void SaveAuthenticatedIdentity()
        {
            if (SessionData == null)
            {
                return;
            }

            Principal = CreatePrincipal();
            if (Context != null)
            {
                Context.User = Principal;
            }

            if (SessionData.Saved)
            {
                return;
            }

            SessionData.Saved = true;
            if (Context != null)
            {
                AuthenticationCookieManager.Save(SessionData.Username, Context);
            }

            SessionData.RoleIds         = SecurityUtility.GetRoleIds(SessionData.UserId);
            SessionData.IsAdministrator = SessionData.RoleIds != null && SessionData.RoleIds.Contains(SystemConfiguration.Instance.SecuritySettings.AdministratorRole);

            SessionObjectStorageStrategy.Save(SessionData);
        }
Exemple #2
0
 internal virtual void RemoveAuthenticatedIdentity()
 {
     SessionData = new SessionData();
     Principal   = null;
     if (Context != null)
     {
         Context.User = null;
         AuthenticationCookieManager.Remove(Context);
     }
     SessionObjectStorageStrategy.Remove();
 }