TAO::SSLIOP::Current Class Reference

Implementation of the TAO SSLIOP::Current extension. More...

#include <SSLIOP_Current.h>

Inheritance diagram for TAO::SSLIOP::Current:

Inheritance graph
[legend]
Collaboration diagram for TAO::SSLIOP::Current:

Collaboration graph
[legend]
List of all members.

Downcast and Reference Counting Methods

These are basically the same methods generated by the IDL compiler for all IDL interfaces.

virtual const char * _interface_repository_id (void) const
static Current_ptr _duplicate (Current_ptr obj)
static Current_ptr _narrow (CORBA::Object_ptr obj)
static Current_ptr _nil (void)

Public Types

typedef Current_ptr _ptr_type
typedef Current_var _var_type
typedef Current_out _out_type

Public Member Functions

 Current (TAO_ORB_Core *orb_core)
 Constructor.
virtual ::SSLIOP::ASN_1_Certget_peer_certificate ()
virtual ::SSLIOP::SSL_Certget_peer_certificate_chain ()
virtual CORBA::Boolean no_context (void)
void tss_slot (size_t slot)
 Set the TSS slot ID assigned to this object.
void setup (Current_Impl *&prev_impl, Current_Impl *new_impl, bool &setup_done)
 Setup the Current.
void teardown (Current_Impl *prev_impl, bool &setup_done)
 Teardown the Current for this request.

Protected Member Functions

 ~Current (void)
 Destructor.
int implementation (Current_Impl *impl)
 Set the TSS SSLIOP::Current implementation.
Current_Implimplementation (void)
 Return the TSS SSLIOP::Current implementation.

Private Member Functions

 Current (const Current &)
void operator= (const Current &)

Private Attributes

size_t tss_slot_
 TSS slot assigned to this object.
TAO_ORB_Core *const orb_core_

Detailed Description

Implementation of the TAO SSLIOP::Current extension.

This object can be used to obtain SSL session related information about the current execution context. For example, SSL peer certificate chains for the current request can be obtained from this object.

Definition at line 58 of file SSLIOP_Current.h.


Member Typedef Documentation

typedef Current_out TAO::SSLIOP::Current::_out_type

Reimplemented from CORBA::LocalObject.

Definition at line 65 of file SSLIOP_Current.h.

typedef Current_ptr TAO::SSLIOP::Current::_ptr_type

Reimplemented from CORBA::LocalObject.

Definition at line 63 of file SSLIOP_Current.h.

typedef Current_var TAO::SSLIOP::Current::_var_type

Reimplemented from CORBA::LocalObject.

Definition at line 64 of file SSLIOP_Current.h.


Constructor & Destructor Documentation

TAO::SSLIOP::Current::Current ( TAO_ORB_Core orb_core  ) 

Constructor.

TAO::SSLIOP::Current::~Current ( void   )  [protected]

Destructor.

Definition at line 22 of file SSLIOP_Current.cpp.

00023 {
00024 }

TAO::SSLIOP::Current::Current ( const Current  )  [private]

Prevent copying through the copy constructor and the assignment operator.


Member Function Documentation

TAO::SSLIOP::Current_ptr TAO::SSLIOP::Current::_duplicate ( Current_ptr  obj  )  [static]

Definition at line 127 of file SSLIOP_Current.cpp.

References CORBA::Object::_add_ref(), and CORBA::is_nil().

Referenced by _narrow(), and tao_TAO_SSLIOP_Current_duplicate().

00128 {
00129   if (!CORBA::is_nil (obj))
00130     obj->_add_ref ();
00131 
00132   return obj;
00133 }

const char * TAO::SSLIOP::Current::_interface_repository_id ( void   )  const [virtual]

Reimplemented from CORBA::Object.

Definition at line 136 of file SSLIOP_Current.cpp.

00137 {
00138   return "IDL:TAO/SSLIOP/Current:1.0";
00139 }

TAO::SSLIOP::Current_ptr TAO::SSLIOP::Current::_narrow ( CORBA::Object_ptr  obj  )  [static]

Reimplemented from CORBA::LocalObject.

Definition at line 120 of file SSLIOP_Current.cpp.

References _duplicate().

Referenced by ACE_RCSID(), and tao_TAO_SSLIOP_Current_narrow().

00121 {
00122   return  TAO::SSLIOP::Current::_duplicate (
00123               dynamic_cast<TAO::SSLIOP::Current *> (obj));
00124 }

static Current_ptr TAO::SSLIOP::Current::_nil ( void   )  [inline, static]

Reimplemented from CORBA::LocalObject.

Definition at line 116 of file SSLIOP_Current.h.

Referenced by tao_TAO_SSLIOP_Current_nil().

00117       {
00118         return (Current_ptr)0;
00119       }

SSLIOP::ASN_1_Cert * TAO::SSLIOP::Current::get_peer_certificate (  ) 

Return the peer certificate associated with the current request.

Implements SSLIOP::Current.

Definition at line 27 of file SSLIOP_Current.cpp.

References CORBA::SystemException::_tao_minor_code(), ACE_NEW_THROW_EX, CORBA::COMPLETED_NO, TAO::SSLIOP::Current_Impl::get_peer_certificate(), implementation(), and TAO::VMCID.

00028 {
00029   TAO::SSLIOP::Current_Impl *impl = this->implementation ();
00030 
00031   // If the implementation pointer returned from TSS is zero, then
00032   // we're not in the middle of a request or an upcall.  Throw an
00033   // exception to indicate that.
00034   if (impl == 0)
00035     throw ::SSLIOP::Current::NoContext ();
00036 
00037   // A valid value must always be returned, so instantiate a sequence
00038   // regardless of whether or not it is populated with certificates.
00039   ::SSLIOP::ASN_1_Cert *c = 0;
00040   ACE_NEW_THROW_EX (c,
00041                     ::SSLIOP::ASN_1_Cert,
00042                     CORBA::NO_MEMORY (
00043                       CORBA::SystemException::_tao_minor_code (
00044                         TAO::VMCID,
00045                         ENOMEM),
00046                       CORBA::COMPLETED_NO));
00047 
00048   ::SSLIOP::ASN_1_Cert_var certificate = c;
00049 
00050   // Populate the sequence with the DER encoded certificate.
00051   impl->get_peer_certificate (c);
00052 
00053   return certificate._retn ();
00054 }

SSLIOP::SSL_Cert * TAO::SSLIOP::Current::get_peer_certificate_chain (  ) 

Return the certificate chain associated with the current execution context. If no SSL session is being used for the request or upcall, then the NoContext exception is raised. On the client side, the chain does include the peer (server) certficate. However, the certificate chain on the server side does NOT contain the peer (client) certificate.

Implements SSLIOP::Current.

Definition at line 57 of file SSLIOP_Current.cpp.

References CORBA::SystemException::_tao_minor_code(), ACE_NEW_THROW_EX, CORBA::COMPLETED_NO, TAO::SSLIOP::Current_Impl::get_peer_certificate_chain(), implementation(), and TAO::VMCID.

00058 {
00059   TAO::SSLIOP::Current_Impl *impl = this->implementation ();
00060 
00061   // If the implementation pointer returned from TSS is zero, then
00062   // we're not in the middle of a request or an upcall.  Throw an
00063   // exception to indicate that.
00064   if (impl == 0)
00065     throw SSLIOP::Current::NoContext ();
00066 
00067   // A valid value must always be returned, so instantiate a sequence
00068   // regardless of whether or not it is populated with certificates.
00069   ::SSLIOP::SSL_Cert *c = 0;
00070   ACE_NEW_THROW_EX (c,
00071                     ::SSLIOP::SSL_Cert,
00072                     CORBA::NO_MEMORY (
00073                       CORBA::SystemException::_tao_minor_code (
00074                         TAO::VMCID,
00075                         ENOMEM),
00076                       CORBA::COMPLETED_NO));
00077 
00078   ::SSLIOP::SSL_Cert_var cert_chain = c;
00079 
00080   // Populate the sequence with the chain of DER encoded certificates.
00081   impl->get_peer_certificate_chain (c);
00082 
00083   return cert_chain._retn ();
00084 }

ACE_INLINE TAO::SSLIOP::Current_Impl * TAO::SSLIOP::Current::implementation ( void   )  [protected]

Return the TSS SSLIOP::Current implementation.

Definition at line 23 of file SSLIOP_Current.inl.

References TAO_ORB_Core::get_tss_resource(), orb_core_, and SSLIOP::TAG_SSL_SEC_TRANS.

Referenced by get_peer_certificate(), get_peer_certificate_chain(), and setup().

00024 {
00025   if (this->orb_core_ == 0)
00026     return 0;
00027 
00028   TAO::SL3::SecurityCurrent_Impl *impl =
00029     static_cast<TAO::SL3::SecurityCurrent_Impl *> (
00030       this->orb_core_->get_tss_resource (this->tss_slot_));
00031 
00032   // Make sure we've got SSL session state in TSS before allowing
00033   // further use of the SSLIOP::Current object.
00034   if (impl != 0 && impl->tag () == ::SSLIOP::TAG_SSL_SEC_TRANS)
00035     return dynamic_cast<TAO::SSLIOP::Current_Impl *> (impl);
00036 
00037   return 0;
00038 }

ACE_INLINE int TAO::SSLIOP::Current::implementation ( Current_Impl impl  )  [protected]

Set the TSS SSLIOP::Current implementation.

Definition at line 14 of file SSLIOP_Current.inl.

References orb_core_, and TAO_ORB_Core::set_tss_resource().

00015 {
00016   if (this->orb_core_ == 0)
00017     return -1;
00018 
00019   return this->orb_core_->set_tss_resource (this->tss_slot_, impl);
00020 }

CORBA::Boolean TAO::SSLIOP::Current::no_context ( void   )  [virtual]

This method is mostly useful as an inexpensive means of determining whether or not SSL session state is available.

Returns:
true if the current execution context is not within a SSL session.

Implements SSLIOP::Current.

Definition at line 87 of file SSLIOP_Current.cpp.

00088 {
00089   return (this->implementation () == 0 ? true : false);
00090 }

void TAO::SSLIOP::Current::operator= ( const Current  )  [private]

Prevent copying through the copy constructor and the assignment operator.

void TAO::SSLIOP::Current::setup ( Current_Impl *&  prev_impl,
Current_Impl new_impl,
bool &  setup_done 
)

Setup the Current.

Definition at line 93 of file SSLIOP_Current.cpp.

References implementation().

Referenced by TAO::Null_SSL_State_Guard::Null_SSL_State_Guard().

00096 {
00097   // Set the current context and remember the old one.
00098 
00099   prev_impl = this->implementation ();
00100 
00101   (void) this->implementation (new_impl);  // Check for error?
00102 
00103   // Setup is complete.
00104   setup_done = true;
00105 }

void TAO::SSLIOP::Current::teardown ( Current_Impl prev_impl,
bool &  setup_done 
)

Teardown the Current for this request.

Definition at line 108 of file SSLIOP_Current.cpp.

Referenced by TAO::Null_SSL_State_Guard::~Null_SSL_State_Guard().

00110 {
00111   if (setup_done)
00112     {
00113       // Reset the old context.
00114       (void) this->implementation (prev_impl);
00115       setup_done = false;
00116     }
00117 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void TAO::SSLIOP::Current::tss_slot ( size_t  slot  ) 

Set the TSS slot ID assigned to this object.

Definition at line 8 of file SSLIOP_Current.inl.

References tss_slot_.

Referenced by TAO::SSLIOP::Server_Invocation_Interceptor::Server_Invocation_Interceptor().

00009 {
00010   this->tss_slot_ = slot;
00011 }


Member Data Documentation

TAO_ORB_Core* const TAO::SSLIOP::Current::orb_core_ [private]

Pointer to the ORB Core corresponding to the ORB with which this object is registered.

Reimplemented from CORBA::Object.

Definition at line 151 of file SSLIOP_Current.h.

Referenced by implementation().

size_t TAO::SSLIOP::Current::tss_slot_ [private]

TSS slot assigned to this object.

Definition at line 147 of file SSLIOP_Current.h.

Referenced by tss_slot().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:48:58 2010 for TAO_SSLIOP by  doxygen 1.4.7