SecurityCallContext Class
Describes the chain of callers leading up to the current method call.
Assembly: System.EnterpriseServices (in System.EnterpriseServices.dll)
| Name | Description | |
|---|---|---|
![]() | Callers | Gets a SecurityCallers object that describes the caller. |
![]() ![]() | CurrentCall | Gets a SecurityCallContext object that describes the security call context. |
![]() | DirectCaller | Gets a SecurityIdentity object that describes the direct caller of this method. |
![]() | IsSecurityEnabled | Determines whether security checks are enabled in the current context. |
![]() | MinAuthenticationLevel | Gets the MinAuthenticationLevel value from the ISecurityCallContext collection in COM+. |
![]() | NumCallers | Gets the NumCallers value from the ISecurityCallContext collection in COM+. |
![]() | OriginalCaller | Gets a SecurityIdentity that describes the original caller. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType() | |
![]() | IsCallerInRole(String^) | Verifies that the direct caller is a member of the specified role. |
![]() | IsUserInRole(String^, String^) | Verifies that the specified user is in the specified role. |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
The following code example demonstrates the use of the SecurityCallContext class to interrogate the security context of calls to the methods of a ServicedComponent class.
// Accept a constructor string. [ConstructionEnabled] public ref class EmployeeInformation: public ServicedComponent { private: // The employee's user name and salary. String^ accountName; double salary; public: // Get the employee's name. All users can call this method. String^ GetName() { return (accountName); } // Set the employee's salary. Only managers can do this. void SetSalary( double ammount ) { if ( SecurityCallContext::CurrentCall->IsCallerInRole( "Manager" ) ) { salary = ammount; } else { throw gcnew UnauthorizedAccessException; } } // Get the employee's salary. Only the employee and managers can do this. double GetSalary() { if ( SecurityCallContext::CurrentCall->DirectCaller->AccountName == accountName || SecurityCallContext::CurrentCall->IsCallerInRole( "Manager" ) ) { return (salary); } else { throw gcnew UnauthorizedAccessException; } } protected: // Use the constructor string. // This method is called when the object is instantiated. virtual void Construct( String^ constructorString ) override { accountName = constructorString; } };
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


