SecurityProperty Object
Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The SecurityProperty object is used to determine the current object's caller or creator.
On This Page
Remarks
GetDirectCallerName Method
GetDirectCreatorName Method
GetOriginalCallerName Method
GetOriginalCreatorName Method
Remarks
To use the SecurityProperty object, you must set a reference to Microsoft Transaction Server Type Library (mtxas.dll).
You obtain a reference to an object's SecurityProperty object by calling Security on the object's ObjectContext. For example:
Set secObject = ctxObject.Security
The SecurityProperty object provides the following methods.
Method |
Description |
---|---|
|
|
GetDirectCallerName |
Retrieves the user name associated with the external process that called the currently executing method. |
GetDirectCreatorName |
Retrieves the user name associated with the external process that directly created the current object. |
GetOriginalCallerName |
Retrieves the user name associated with the base process that initiated the call sequence from which the current method was called. |
GetOriginalCreatorName |
Retrieves the user name associated with the base process that initiated the activity in which the current object is executing. |
See Also
Programmatic Security, Advanced Security Methods, ObjectContext Object
GetDirectCallerName Method
Retrieves the user name associated with the external process that called the currently executing method.
Applies To
SecurityProperty Object
Syntax username = securityproperty . GetDirectCallerName( )
Part
username
The user name associated with the process from which the current method was invoked.
Securityproperty
An object variable that evaluates to a SecurityProperty object.
Remarks
You use the GetDirectCallerName method to determine the user name associated with the process that called the object's currently executing method. The following scenarios illustrate the functionality of the GetDirectCallerName method.
A base process running on server A, as user A, calls into object X on server B, running as user B. Then object X calls into object Y, running on server C. If object Y calls GetDirectCallerName, the name of user B is returned.
Security can only be enforced across process boundaries. This means that the name returned by GetDirectCallerName is the name associated with the process that called into the process in which the current object is running, not necessarily the immediate caller into the object itself. If an object calls into another object within the same process, when the second object calls GetDirectCallerName, it will get the name of the most immediate caller outside its own process boundary, not the name of the object that directly called into it.
A base process, running on server A as user A, calls into object X on server B, running as user B. Then object X calls into object Y, running in the same process as object X, also on server B. When object Y calls GetDirectCallerName, the name of user A is returned , not the name of user B.
Example
See Also
Programmatic Security, Advanced Security Methods, ObjectContext Object
GetDirectCallerName Method Example
Public Function ComponentDirectCaller() As String Dim objCtx As ObjectContext Set objCtx = GetObjectContext() ComponentDirectCaller = _ objCtx.Security.GetDirectCallerName() End Function
GetDirectCreatorName Method
Retrieves the user name associated with the current object's immediate (out-of-process) creator.
Applies To
SecurityProperty Object
Syntax username = securityproperty . GetDirect Creator Name( )
Part
username
The user name associated with the process that directly created the current object.
securityproperty
An object variable that evaluates to a SecurityProperty object.
Remarks
You use the GetDirectCreatorName method to determine the user name associated with the process that created the current object. The following scenarios illustrate the functionality of the GetDirectCreatorName method.
A base process running on server A, as user A, creates object X on server B, running as user B. Then object X creates object Y, running on server C. If object Y calls GetDirectCreatorName, the name of user B is returned.
Security can only be enforced across process boundaries. This means that if an object creates another object within the same process, when the second object calls GetDirectCreatorName, it will get the name of the most immediate creator outside its own process boundary, not the user name associated with the object that actually created it.
A base client running on server A, as user A, creates object X on server B, running as user B. Then object X creates object Y, running in the same process as object X, also on server B. When object Y calls GetDirectCreatorName, the name of user A is returned, not the name of user B.
Example
See Also
Programmatic Security, Advanced Security Methods, ObjectContext Object
GetDirectCreatorName Method Example
Public Function ComponentDirectCreator() As String Dim objCtx As ObjectContext Set objCtx = GetObjectContext() ComponentDirectCreator = _ objCtx.Security.GetDirectCreatorName() End Function
GetOriginalCallerName Method
Retrieves the user name associated with the base process that initiated the sequence of calls from which the call into the current object originated.
Applies To
SecurityProperty Object
Syntax username = securityproperty . GetOriginalCallerName( )
Part
username
The user name associated with the base process that initiated the call sequence from which the current method was called.
Securityproperty
An object variable that evaluates to a SecurityProperty object.
Remarks
You use the GetOriginalCallerName method to determine the user name associated with the original process that initiated the call sequence from which the current method was called. The following scenario illustrates the functionality of the GetOriginalCallerName method.
Base process 1, running on server A as user A, creates object X on server B, running as user B. Then base process 1 passes its reference on object X to base process 2, running on server D as user D. Base process 2 uses that reference to call into object X. object X then calls into object Y, running on server C. If object Y then calls GetOriginalCallerName, the name of user D is returned.
Note: Usually, an object's original caller is the same process as its original creator. The only situation in which the original caller and the original creator would be different is one in which the original creator passes a reference to another process, and the other process initiates the call sequence (as in the preceding example).
Note: The path to the original caller is broken if any object along the chain was created by some other means than IObjectContext::CreateInstance or ITransactionContext::CreateInstance. For example, if base process 1 uses CoCreateInstance to create X, when Y calls GetOriginalCallerName, the name it gets back will be the name of user B, not user D. This is because the call sequence is traced back through the objects' context and MTS can only create a context for an object that's created with either IObjectContext::CreateInstance or ITransactionContext::CreateInstance.
Example
See Also
Programmatic Security, Advanced Security Methods, ObjectContext Object
GetOriginalCallerName Method Example
Public Function ComponentOriginalCaller() As String Dim objCtx As ObjectContext Set objCtx = GetObjectContext() ComponentOriginalCaller = _ objCtx.Security.GetOriginalCallerName() End Function
GetOriginalCreatorName Method
Retrieves the user name associated with the original base process that initiated the activity in which the current object is executing.
Applies To
SecurityProperty Object
Syntax username = securityproperty . GetOriginal Creator Name( )
Part
username
The user name associated with the base process that initiated the activity in which the current object is executing.
Securityproperty
An object variable that evaluates to a SecurityProperty object.
Remarks
You use the GetOriginalCreatorName method to determine the user name associated with the process that initiated the activity in which the current object is executing. The following scenario illustrates the functionality of the GetOriginalCreatorName method.
A base process running on server A, as user A, creates object X on server B, running as user B. Then object X creates object Y, running on server C. If object Y calls GetOriginalCreatorName, the name of user A is returned.
Note: The path to the original creator is broken if an object is created by some other means than IObjectContext::CreateInstance or ITransactionContext::CreateInstance. For example, if the base process on server A uses CoCreateInstance to create X, when Y calls GetOriginalCreatorName, the name it gets back will be the name of user B, not user A. This is because the creation sequence is traced back through the objects' context and MTS can only create a context for an object that's created with either IObjectContext::CreateInstance or ITransactionContext::CreateInstance.
Example
See Also
Programmatic Security, Advanced Security Methods, ObjectContext Object
GetOriginalCreatorName Method Example
Public Function ComponentOriginalCreator() As String Dim objCtx As ObjectContext Set objCtx = GetObjectContext() ComponentOriginalCreator = _ objCtx.Security.GetOriginalCreatorName() End Function