Implements some simple wrapper functions to provide a const API around the Token data structure as specified in the DDS security specification. More...
#include <TokenReader.h>
Public Member Functions | |
TokenReader (const DDS::Security::Token &token_ref) | |
virtual | ~TokenReader () |
bool | is_nil () const |
const char * | get_property_value (const std::string &property_name) const |
const DDS::OctetSeq & | get_bin_property_value (const std::string &property_name) const |
CORBA::ULong | get_num_properties () const |
CORBA::ULong | get_num_bin_properties () const |
Private Attributes | |
const DDS::Security::Token & | token_ref_ |
const DDS::OctetSeq | _empty_seq_ |
Implements some simple wrapper functions to provide a const API around the Token data structure as specified in the DDS security specification.
See the DDS security specification, OMG formal/17-09-20, for a description of the interface this class is implementing.
Definition at line 40 of file TokenReader.h.
OpenDDS::Security::TokenReader::TokenReader | ( | const DDS::Security::Token & | token_ref | ) |
Definition at line 33 of file TokenReader.cpp.
00034 : token_ref_(token_ref) 00035 , _empty_seq_() 00036 { 00037 }
OpenDDS::Security::TokenReader::~TokenReader | ( | ) | [virtual] |
Definition at line 39 of file TokenReader.cpp.
const DDS::OctetSeq & OpenDDS::Security::TokenReader::get_bin_property_value | ( | const std::string & | property_name | ) | const |
Definition at line 60 of file TokenReader.cpp.
References _empty_seq_, DDS::Security::DataHolder::binary_properties, OpenDDS::DCPS::const_sequence_begin(), OpenDDS::DCPS::const_sequence_end(), and token_ref_.
Referenced by OpenDDS::Security::AuthenticationBuiltInImpl::begin_handshake_reply(), OpenDDS::Security::AuthenticationBuiltInImpl::begin_handshake_request(), OpenDDS::Security::AuthenticationBuiltInImpl::process_final_handshake(), OpenDDS::Security::AuthenticationBuiltInImpl::process_handshake_reply(), and OpenDDS::Security::AccessControlBuiltInImpl::validate_remote_permissions().
00061 { 00062 typedef ConstSequenceIterator<const DDS::BinaryPropertySeq> iter_t; 00063 typedef has_property<const DDS::BinaryProperty_t> has_property; 00064 00065 iter_t begin = const_sequence_begin(token_ref_.binary_properties), 00066 end = const_sequence_end(token_ref_.binary_properties); 00067 00068 iter_t result = std::find_if(begin, end, has_property(property_name)); 00069 00070 if (result != end) { 00071 return result->value; 00072 } 00073 00074 return _empty_seq_; 00075 }
CORBA::ULong OpenDDS::Security::TokenReader::get_num_bin_properties | ( | ) | const [inline] |
Definition at line 71 of file TokenReader.h.
References DDS::Security::DataHolder::binary_properties, and token_ref_.
00072 { 00073 return token_ref_.binary_properties.length(); 00074 }
CORBA::ULong OpenDDS::Security::TokenReader::get_num_properties | ( | ) | const [inline] |
Definition at line 66 of file TokenReader.h.
References DDS::Security::DataHolder::properties, and token_ref_.
00067 { 00068 return token_ref_.properties.length(); 00069 }
const char * OpenDDS::Security::TokenReader::get_property_value | ( | const std::string & | property_name | ) | const |
Definition at line 43 of file TokenReader.cpp.
References OpenDDS::DCPS::const_sequence_begin(), OpenDDS::DCPS::const_sequence_end(), DDS::Security::DataHolder::properties, and token_ref_.
Referenced by OpenDDS::Security::AccessControlBuiltInImpl::validate_local_permissions().
00044 { 00045 typedef ConstSequenceIterator<const DDS::PropertySeq> iter_t; 00046 typedef has_property<const DDS::Property_t> has_property; 00047 00048 iter_t begin = const_sequence_begin(token_ref_.properties), 00049 end = const_sequence_end(token_ref_.properties); 00050 00051 iter_t result = std::find_if(begin, end, has_property(property_name)); 00052 00053 if (result != end) { 00054 return result->value; 00055 } 00056 00057 return 0; 00058 }
bool OpenDDS::Security::TokenReader::is_nil | ( | void | ) | const [inline] |
Definition at line 59 of file TokenReader.h.
References DDS::Security::DataHolder::binary_properties, DDS::Security::DataHolder::class_id, DDS::Security::DataHolder::properties, and token_ref_.
Referenced by OpenDDS::Security::AuthenticationBuiltInImpl::begin_handshake_reply(), OpenDDS::Security::AuthenticationBuiltInImpl::begin_handshake_request(), OpenDDS::Security::AuthenticationBuiltInImpl::process_final_handshake(), and OpenDDS::Security::AuthenticationBuiltInImpl::process_handshake_reply().
00060 { 00061 return ((token_ref_.binary_properties.length() == 0) 00062 && (token_ref_.properties.length() == 0) 00063 && (token_ref_.class_id[0] == '\0')); 00064 }
const DDS::OctetSeq OpenDDS::Security::TokenReader::_empty_seq_ [private] |
Definition at line 56 of file TokenReader.h.
Referenced by get_bin_property_value().
const DDS::Security::Token& OpenDDS::Security::TokenReader::token_ref_ [private] |
Definition at line 55 of file TokenReader.h.
Referenced by get_bin_property_value(), get_num_bin_properties(), get_num_properties(), get_property_value(), and is_nil().