コード例 #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);
        }