Logic explanation

  • Thread starter Thread starter Reason101
  • Start date Start date
R

Reason101

Guest
I am new to c# trying to understand the logic, can anyone please explain the below steps in detail please ?


protected override bool CheckAccessCore(OperationContext operationContext)
{
//check that basic access is ok before checking our custom conditions
if (!base.CheckAccessCore(operationContext))
{
return false;
}

//print out inbound identities recorded by WCF
System.Diagnostics.Trace.WriteLine("Primarytity is " + operationContext.ServiceSecurityContext.PrimaryIdentity.Name);
System.Diagnostics.Trace.WriteLine("Windowstity is " + operationContext.ServiceSecurityContext.WindowsIdentity.Name);


var UserName = ServiceSecurityContext.Current.PrimaryIdentity.IsAuthenticated;


//create Windows principal object from inbound Windows identity
WindowsPrincipal p = new WindowsPrincipal(operationContext.ServiceSecurityContext.WindowsIdentity);
//check user in role
bool isAdmin = p.IsInRole(this.m_windowsgroup);
if (!isAdmin)
{
return false;
}
return true;
}




Reason101

Continue reading...
 
Back
Top