OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Private Attributes | List of all members
OpenDDS::Security::TokenReader Class Reference

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>

Collaboration diagram for OpenDDS::Security::TokenReader:
Collaboration graph
[legend]

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::OctetSeqget_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::Tokentoken_ref_
 
const DDS::OctetSeq _empty_seq_
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ TokenReader()

OpenDDS::Security::TokenReader::TokenReader ( const DDS::Security::Token token_ref)
explicit

Definition at line 32 of file TokenReader.cpp.

33 : token_ref_(token_ref)
34 , _empty_seq_()
35 {
36 }
const DDS::Security::Token & token_ref_
Definition: TokenReader.h:54
const DDS::OctetSeq _empty_seq_
Definition: TokenReader.h:55

◆ ~TokenReader()

OpenDDS::Security::TokenReader::~TokenReader ( )
virtual

Definition at line 38 of file TokenReader.cpp.

39 {
40 }

Member Function Documentation

◆ get_bin_property_value()

const DDS::OctetSeq & OpenDDS::Security::TokenReader::get_bin_property_value ( const std::string &  property_name) const

Definition at line 59 of file TokenReader.cpp.

References _empty_seq_, DDS::Security::DataHolder::binary_properties, OpenDDS::DCPS::const_sequence_begin(), OpenDDS::DCPS::const_sequence_end(), OPENDDS_END_VERSIONED_NAMESPACE_DECL, 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().

60 {
62  typedef has_property<const DDS::BinaryProperty_t> has_property;
63 
66 
67  iter_t result = std::find_if(begin, end, has_property(property_name));
68 
69  if (result != end) {
70  return result->value;
71  }
72 
73  return _empty_seq_;
74 }
const DDS::Security::Token & token_ref_
Definition: TokenReader.h:54
const DDS::OctetSeq _empty_seq_
Definition: TokenReader.h:55
ConstSequenceIterator< Sequence > const_sequence_begin(Sequence &seq)
ConstSequenceIterator< Sequence > const_sequence_end(Sequence &seq)
BinaryPropertySeq binary_properties

◆ get_num_bin_properties()

CORBA::ULong OpenDDS::Security::TokenReader::get_num_bin_properties ( ) const
inline

Definition at line 70 of file TokenReader.h.

References OPENDDS_END_VERSIONED_NAMESPACE_DECL.

71 {
72  return token_ref_.binary_properties.length();
73 }
const DDS::Security::Token & token_ref_
Definition: TokenReader.h:54
BinaryPropertySeq binary_properties

◆ get_num_properties()

CORBA::ULong OpenDDS::Security::TokenReader::get_num_properties ( ) const
inline

Definition at line 65 of file TokenReader.h.

66 {
67  return token_ref_.properties.length();
68 }
const DDS::Security::Token & token_ref_
Definition: TokenReader.h:54

◆ get_property_value()

const char * OpenDDS::Security::TokenReader::get_property_value ( const std::string &  property_name) const

Definition at line 42 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::LocalAuthCredentialData::load_access_permissions(), and OpenDDS::Security::AccessControlBuiltInImpl::validate_local_permissions().

43 {
45  typedef has_property<const DDS::Property_t> has_property;
46 
49 
50  iter_t result = std::find_if(begin, end, has_property(property_name));
51 
52  if (result != end) {
53  return result->value;
54  }
55 
56  return 0;
57 }
const DDS::Security::Token & token_ref_
Definition: TokenReader.h:54
ConstSequenceIterator< Sequence > const_sequence_begin(Sequence &seq)
ConstSequenceIterator< Sequence > const_sequence_end(Sequence &seq)

◆ is_nil()

bool OpenDDS::Security::TokenReader::is_nil ( void  ) const
inline

Member Data Documentation

◆ _empty_seq_

const DDS::OctetSeq OpenDDS::Security::TokenReader::_empty_seq_
private

Definition at line 55 of file TokenReader.h.

Referenced by get_bin_property_value().

◆ token_ref_

const DDS::Security::Token& OpenDDS::Security::TokenReader::token_ref_
private

Definition at line 54 of file TokenReader.h.

Referenced by get_bin_property_value(), and get_property_value().


The documentation for this class was generated from the following files: