![]() |
Overview Returns a Principal object identifying, in a server, the client of a remote request. Original class CORBA module: BOA Class Exceptions CORBA::SystemException
Intended Usage
This method is intended to be used by implementations of IDL interfaces, residing in a server process, to find the identity of the calling client. This might be used, for example, to implement security authorization checks.
This method is part of the CORBA specification.
IDL Syntax
virtual CORBA::Principal_ptr get_principal ( CORBA::Object_ptr obj, CORBA::Environment_ptr env);
Input parameters
- obj
- The target of a remote invocation in a server. Typically, it is the "this" pointer in C++ for the method calling CORBA::BOA:get_principal. Currently this parameter is not used and NULL can be passed.
- env
- Currently unused (NULL can be passed).
Return values
- CORBA::Principal_ptr
- A Principal object identifying the client that initiated the remote request. If CORBA::BOA::get_principal is called outside the context of any remote request, NULL is returned. The caller does not assume ownership of the returned Principal object and should not delete it.
Example
#include "corba.h" /* Assume previously initialized using CORBA::ORB::BOA_init () */ extern CORBA::BOA_ptr srvboa; ... ::CORBA::Boolean tmpBoolean; ::CORBA::Principal_ptr prncpl_ptr; /* Assume the following is called from within an implementation of some IDL operation */ prncpl_ptr = srvboa->get_principal(this, CORBA::Environment::_nil()); tmpBoolean = ::CORBA::is_nil(prncpl_ptr); /* Error checking */ ...