shibboleth-3.5.0
shibsp::Attribute Class Referenceabstract

A resolved attribute. More...

#include <shibsp/attribute/Attribute.h>

Inheritance diagram for shibsp::Attribute:
shibsp::BinaryAttribute shibsp::ExtensibleAttribute shibsp::NameIDAttribute shibsp::ScopedAttribute shibsp::SimpleAttribute shibsp::XMLAttribute

Public Types

typedef AttributeAttributeFactory(DDF &in)
 A function that unmarshalls remoted data into the proper Attribute subclass. More...
 

Public Member Functions

const char * getId () const
 Returns the Attribute identifier. More...
 
const std::vector< std::string > & getAliases () const
 Returns all of the effective names for the Attribute. More...
 
std::vector< std::string > & getAliases ()
 Returns all of the effective names for the Attribute. More...
 
void setCaseSensitive (bool caseSensitive)
 Sets whether case sensitivity should apply to basic value comparisons. More...
 
void setInternal (bool internal)
 Sets whether the attribute should be exported for CGI use. More...
 
bool isCaseSensitive () const
 Indicates whether case sensitivity should apply to basic value comparisons. More...
 
bool isInternal () const
 Indicates whether the attribute should be exported for CGI use. More...
 
virtual size_t valueCount () const
 Returns the number of values. More...
 
virtual const std::vector< std::string > & getSerializedValues () const
 Returns serialized Attribute values encoded as UTF-8 strings. More...
 
virtual void clearSerializedValues ()=0
 Informs the Attribute that values have changed and any serializations must be cleared.
 
virtual const char * getString (size_t index) const
 Gets the string equivalent of the value at the specified position (starting from zero). More...
 
virtual const char * getScope (size_t index) const
 Gets the "scope" of the value at the specified position (starting from zero). More...
 
virtual void removeValue (size_t index)
 Removes the value at the specified position (starting from zero). More...
 
virtual DDF marshall () const
 Marshalls an Attribute for remoting. More...
 

Static Public Member Functions

static Attributeunmarshall (DDF &in)
 Unmarshalls a remoted Attribute. More...
 
static void registerFactory (const char *type, AttributeFactory *factory)
 Registers an AttributeFactory function for a given attribute "type". More...
 
static void deregisterFactory (const char *type)
 Deregisters an AttributeFactory function for a given attribute "type". More...
 
static void deregisterFactories ()
 Clears the map of factories.
 

Protected Member Functions

 Attribute (const std::vector< std::string > &ids)
 Constructor. More...
 
 Attribute (DDF &in)
 Constructs based on a remoted Attribute. More...
 

Protected Attributes

std::vector< std::string > m_serialized
 Maintains a copy of serialized attribute values, when possible. More...
 

Detailed Description

A resolved attribute.

Resolved attributes are a neutral construct that represent both simple and complex attribute data structures that might be found in SAML assertions or obtained from other sources.

Attributes consist of an id/name that is locally unique (that is, unique to a configuration at any given point in time) and zero or more values. Values can be of any type or structure, but will generally be made available to applications only if a serialized string form exists. More complex values can be used with access control plugins and other components that understand them, however.

Member Typedef Documentation

◆ AttributeFactory

typedef Attribute* shibsp::Attribute::AttributeFactory(DDF &in)

A function that unmarshalls remoted data into the proper Attribute subclass.

Constructor & Destructor Documentation

◆ Attribute() [1/2]

shibsp::Attribute::Attribute ( const std::vector< std::string > &  ids)
protected

Constructor.

Parameters
idsarray with primary identifier in first position, followed by any aliases

◆ Attribute() [2/2]

shibsp::Attribute::Attribute ( DDF in)
protected

Constructs based on a remoted Attribute.

This allows Attribute objects to be recreated after marshalling. The DDF supplied must be a struct containing a single list member named with the Attribute's "id" and containing the values.

Parameters
ininput object containing marshalled Attribute

Member Function Documentation

◆ deregisterFactory()

static void shibsp::Attribute::deregisterFactory ( const char *  type)
static

Deregisters an AttributeFactory function for a given attribute "type".

Parameters
typestring used at the root of remoted Attribute structures

◆ getAliases() [1/2]

const std::vector<std::string>& shibsp::Attribute::getAliases ( ) const

Returns all of the effective names for the Attribute.

Returns
immutable array of identifiers, with the primary ID in the first position

◆ getAliases() [2/2]

std::vector<std::string>& shibsp::Attribute::getAliases ( )

Returns all of the effective names for the Attribute.

Returns
mutable array of identifiers, with the primary ID in the first position

◆ getId()

const char* shibsp::Attribute::getId ( ) const

Returns the Attribute identifier.

Returns
the Attribute identifier

◆ getScope()

virtual const char* shibsp::Attribute::getScope ( size_t  index) const
virtual

Gets the "scope" of the value at the specified position (starting from zero).

Parameters
indexposition of value
Returns
the specified value's "scope", or nullptr if attribute is unscoped

Reimplemented in shibsp::NameIDAttribute, shibsp::ScopedAttribute, and shibsp::ExtensibleAttribute.

◆ getSerializedValues()

virtual const std::vector<std::string>& shibsp::Attribute::getSerializedValues ( ) const
virtual

Returns serialized Attribute values encoded as UTF-8 strings.

Returns
an immutable vector of values

Reimplemented in shibsp::NameIDAttribute, shibsp::ScopedAttribute, shibsp::BinaryAttribute, shibsp::ExtensibleAttribute, and shibsp::XMLAttribute.

◆ getString()

virtual const char* shibsp::Attribute::getString ( size_t  index) const
virtual

Gets the string equivalent of the value at the specified position (starting from zero).

Parameters
indexposition of value
Returns
the specified value in its "string" form, or nullptr if undefined

Reimplemented in shibsp::NameIDAttribute, shibsp::ScopedAttribute, shibsp::BinaryAttribute, shibsp::XMLAttribute, and shibsp::ExtensibleAttribute.

◆ isCaseSensitive()

bool shibsp::Attribute::isCaseSensitive ( ) const

Indicates whether case sensitivity should apply to basic value comparisons.

Returns
true iff value comparisons should be case sensitive

◆ isInternal()

bool shibsp::Attribute::isInternal ( ) const

Indicates whether the attribute should be exported for CGI use.

Returns
true iff the attribute should NOT be exported

◆ marshall()

virtual DDF shibsp::Attribute::marshall ( ) const
virtual

Marshalls an Attribute for remoting.

This allows Attribute objects to be communicated across process boundaries without excess XML parsing. The DDF returned must be a struct containing a single list member named with the Attribute's "id". The name of the struct should contain the registered name of the Attribute implementation.

Reimplemented in shibsp::NameIDAttribute, shibsp::ScopedAttribute, shibsp::BinaryAttribute, shibsp::ExtensibleAttribute, shibsp::XMLAttribute, and shibsp::SimpleAttribute.

◆ registerFactory()

static void shibsp::Attribute::registerFactory ( const char *  type,
AttributeFactory factory 
)
static

Registers an AttributeFactory function for a given attribute "type".

Parameters
typestring used at the root of remoted Attribute structures
factoryfactory function

◆ removeValue()

virtual void shibsp::Attribute::removeValue ( size_t  index)
virtual

Removes the value at the specified position (starting from zero).

Parameters
indexposition of value to remove

Reimplemented in shibsp::NameIDAttribute, shibsp::ScopedAttribute, shibsp::BinaryAttribute, shibsp::ExtensibleAttribute, and shibsp::XMLAttribute.

◆ setCaseSensitive()

void shibsp::Attribute::setCaseSensitive ( bool  caseSensitive)

Sets whether case sensitivity should apply to basic value comparisons.

Parameters
caseSensitivetrue iff value comparisons should be case sensitive

◆ setInternal()

void shibsp::Attribute::setInternal ( bool  internal)

Sets whether the attribute should be exported for CGI use.

Parameters
internaltrue iff the attribute should NOT be exported

◆ unmarshall()

static Attribute* shibsp::Attribute::unmarshall ( DDF in)
static

Unmarshalls a remoted Attribute.

Parameters
inremoted Attribute data
Returns
a resolved Attribute of the proper subclass

◆ valueCount()

virtual size_t shibsp::Attribute::valueCount ( ) const
virtual

Returns the number of values.

Returns
number of values

Reimplemented in shibsp::NameIDAttribute, shibsp::ScopedAttribute, shibsp::BinaryAttribute, shibsp::XMLAttribute, and shibsp::ExtensibleAttribute.

Member Data Documentation

◆ m_serialized

std::vector<std::string> shibsp::Attribute::m_serialized
mutableprotected

Maintains a copy of serialized attribute values, when possible.

Implementations should maintain the array when values are added or removed.


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