Esempio n. 1
0
        internal void AppendCall()
        {
            SecurityCallFrame call = new SecurityCallFrame();

            m_StackFrames.Add(call);
            StackFrame frame = new StackFrame(3);

            call.CallerType = frame.GetMethod().DeclaringType.ToString();
            call.Operation  = frame.GetMethod().Name + "()";

            if (Count == 1)
            {
                call.Address        = Environment.MachineName;
                call.Authentication = Thread.CurrentPrincipal.Identity.AuthenticationType;
                call.ActivityId     = Guid.NewGuid();
                call.IdentityName   = Thread.CurrentPrincipal.Identity.Name;
                if (call.IdentityName == String.Empty)
                {
                    call.IdentityName = WindowsIdentity.GetCurrent().Name;
                }
                call.Operation = frame.GetMethod().Name + "()";
            }
            else //Must be in a service already
            {
                //Add local information for this service
                call.Address        = OperationContext.Current.Channel.LocalAddress.Uri.ToString();
                call.Authentication = ServiceSecurityContext.Current.PrimaryIdentity.AuthenticationType;
                call.IdentityName   = Thread.CurrentPrincipal.Identity.Name;
                call.ActivityId     = m_StackFrames[Count - 2].ActivityId;
            }
        }
Esempio n. 2
0
      internal void AppendCall(int index)
      {
         SecurityCallFrame call = new SecurityCallFrame();

         m_StackFrames.Add(call);
         StackFrame frame = new StackFrame(index);
         call.CallerType = frame.GetMethod().DeclaringType.ToString();
         call.Operation = frame.GetMethod().Name + "()";

         if(Count == 1)
         {
            call.Address = Environment.MachineName;
            call.Authentication = Thread.CurrentPrincipal.Identity.AuthenticationType;
            call.ActivityId = Guid.NewGuid();
            call.IdentityName = Thread.CurrentPrincipal.Identity.Name;
            if(call.IdentityName == String.Empty)
            {
               call.IdentityName =WindowsIdentity.GetCurrent().Name;
            }
            call.Operation = frame.GetMethod().Name + "()";
         }
         else //Must be in a service already
         {
            //Add local information for this service
            call.Address = OperationContext.Current.Channel.LocalAddress.Uri.ToString();
            call.Authentication = ServiceSecurityContext.Current.PrimaryIdentity.AuthenticationType;
            call.IdentityName = Thread.CurrentPrincipal.Identity.Name;
            call.ActivityId = m_StackFrames[Count-2].ActivityId;
         }
      }