Back to index

nordugrid-arc-nox  1.1.0~rc6
Classes | Public Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes
Arc::DelegationContainerSOAP Class Reference

Manages multiple delegated credentials. More...

#include <DelegationInterface.h>

Collaboration diagram for Arc::DelegationContainerSOAP:
Collaboration graph
[legend]

List of all members.

Classes

class  Consumer

Public Member Functions

 DelegationContainerSOAP (void)
 ~DelegationContainerSOAP (void)
bool DelegateCredentialsInit (const SOAPEnvelope &in, SOAPEnvelope &out)
 See DelegationConsumerSOAP::DelegateCredentialsInit.
bool UpdateCredentials (std::string &credentials, const SOAPEnvelope &in, SOAPEnvelope &out)
 See DelegationConsumerSOAP::UpdateCredentials.
bool UpdateCredentials (std::string &credentials, std::string &identity, const SOAPEnvelope &in, SOAPEnvelope &out)
bool DelegatedToken (std::string &credentials, XMLNode token)
 See DelegationConsumerSOAP::DelegatedToken.
bool DelegatedToken (std::string &credentials, std::string &identity, XMLNode token)

Protected Attributes

Glib::Mutex lock_
int max_size_
 Max.
int max_duration_
 Lifetime of unused delegation consumer.
int max_usage_
 Max.
bool context_lock_
 If true delegation consumer is deleted when connection context is destroyed.
bool restricted_
 If true all delegation phases must be performed by same identity.

Private Types

typedef std::map< std::string,
Consumer
ConsumerMap
typedef ConsumerMap::iterator ConsumerIterator

Private Member Functions

void AddConsumer (const std::string &id, DelegationConsumerSOAP *consumer)
void TouchConsumer (ConsumerIterator i)
ConsumerIterator RemoveConsumer (ConsumerIterator i)
void CheckConsumers (void)

Private Attributes

ConsumerMap consumers_
ConsumerIterator consumers_first_
ConsumerIterator consumers_last_

Detailed Description

Manages multiple delegated credentials.

Delegation consumers are created automatically with DelegateCredentialsInit method up to max_size_ and assigned unique identifier. It's methods are similar to those of DelegationConsumerSOAP with identifier included in SOAP message used to route execution to one of managed DelegationConsumerSOAP instances.

Definition at line 160 of file DelegationInterface.h.


Member Typedef Documentation

typedef ConsumerMap::iterator Arc::DelegationContainerSOAP::ConsumerIterator [private]

Definition at line 164 of file DelegationInterface.h.

typedef std::map<std::string,Consumer> Arc::DelegationContainerSOAP::ConsumerMap [private]

Definition at line 162 of file DelegationInterface.h.


Constructor & Destructor Documentation

Definition at line 962 of file DelegationInterface.cpp.

                                                     {
  max_size_=0;         // unlimited size of container
  max_duration_=30;    // 30 seconds for delegation
  max_usage_=2;        // allow 1 failure
  context_lock_=false;
  restricted_=true;
  consumers_first_=consumers_.end();
  consumers_last_=consumers_.end();
}

Definition at line 972 of file DelegationInterface.cpp.

                                                      {
  lock_.lock();
  ConsumerIterator i = consumers_.begin();
  for(;i!=consumers_.end();++i) {
    if(i->second.deleg) delete i->second.deleg;
  };
  lock_.unlock();
}

Member Function Documentation

void Arc::DelegationContainerSOAP::AddConsumer ( const std::string &  id,
DelegationConsumerSOAP consumer 
) [private]

Definition at line 981 of file DelegationInterface.cpp.

                                                                                              {
  Consumer c;
  c.deleg=consumer; 
  c.previous=consumers_.end();
  c.next=consumers_first_;
  ConsumerIterator i = consumers_.insert(consumers_.begin(),make_pair(id,c)); 
  if(consumers_first_ != consumers_.end()) consumers_first_->second.previous=i;
  consumers_first_=i;
  if(consumers_last_ == consumers_.end()) consumers_last_=i;
}

Here is the caller graph for this function:

Definition at line 1017 of file DelegationInterface.cpp.

                                                 {
  if(max_size_ > 0) {
    while(consumers_.size() > max_size_) {
      RemoveConsumer(consumers_last_);
    };
  };
  if(max_duration_ > 0) {
    time_t t = time(NULL);
    for(ConsumerIterator i = consumers_last_;i!=consumers_.end();) {
      if(((unsigned int)(t - i->second.last_used)) > max_duration_) {
        i=RemoveConsumer(i);
      } else {
        break;
      };
    };
  };
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool Arc::DelegationContainerSOAP::DelegateCredentialsInit ( const SOAPEnvelope &  in,
SOAPEnvelope &  out 
)

See DelegationConsumerSOAP::DelegateCredentialsInit.

Definition at line 1035 of file DelegationInterface.cpp.

                                                                                              {
  lock_.lock();
  std::string id;
  for(int tries = 0;tries<1000;++tries) {
    GUID(id);
    ConsumerIterator i = consumers_.find(id);
    if(i == consumers_.end()) break;
    id.resize(0);
  };
  if(id.empty()) { lock_.unlock(); return false; };
  DelegationConsumerSOAP* consumer = new DelegationConsumerSOAP();
  if(!(consumer->DelegateCredentialsInit(id,in,out))) { lock_.unlock(); delete consumer; return false; };
  AddConsumer(id,consumer);
  CheckConsumers();
  lock_.unlock();
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool Arc::DelegationContainerSOAP::DelegatedToken ( std::string &  credentials,
XMLNode  token 
)

See DelegationConsumerSOAP::DelegatedToken.

Definition at line 1078 of file DelegationInterface.cpp.

                                                                                 {
  std::string identity;
  return DelegatedToken(credentials,identity,token);
}

Here is the caller graph for this function:

bool Arc::DelegationContainerSOAP::DelegatedToken ( std::string &  credentials,
std::string &  identity,
XMLNode  token 
)

Definition at line 1083 of file DelegationInterface.cpp.

                                                                                                     {
  lock_.lock();
  std::string id = (std::string)(token["Id"]);
  ConsumerIterator i = consumers_.find(id);
  if(i == consumers_.end()) { lock_.unlock(); return false; };
  if(!(i->second.deleg)) { lock_.unlock(); return false; };
  bool r = i->second.deleg->DelegatedToken(credentials,identity,token);
  if(((++(i->second.usage_count)) > max_usage_) && (max_usage_ > 0)) {
    RemoveConsumer(i);
  } else {
    TouchConsumer(i);
  };
  lock_.unlock();
  return r;
}

Here is the call graph for this function:

Definition at line 1005 of file DelegationInterface.cpp.

                                                                                                  {
  ConsumerIterator previous = i->second.previous;
  ConsumerIterator next = i->second.next;
  if(previous != consumers_.end()) previous->second.next=next;
  if(next != consumers_.end()) next->second.previous=previous;
  if(consumers_first_ == i) consumers_first_=next; 
  if(consumers_last_ == i) consumers_last_=previous; 
  if(i->second.deleg) delete i->second.deleg;
  consumers_.erase(i);
  return next;
}

Here is the caller graph for this function:

Definition at line 992 of file DelegationInterface.cpp.

                                                              {
  i->second.last_used=time(NULL);
  if(i == consumers_first_) return;
  ConsumerIterator previous = i->second.previous;
  ConsumerIterator next = i->second.next;
  if(previous != consumers_.end()) previous->second.next=next;
  if(next != consumers_.end()) next->second.previous=previous;
  i->second.previous=consumers_.end();
  i->second.next=consumers_first_;
  if(consumers_first_ != consumers_.end()) consumers_first_->second.previous=i;
  consumers_first_=i;
}

Here is the caller graph for this function:

bool Arc::DelegationContainerSOAP::UpdateCredentials ( std::string &  credentials,
const SOAPEnvelope &  in,
SOAPEnvelope &  out 
)

See DelegationConsumerSOAP::UpdateCredentials.

Definition at line 1053 of file DelegationInterface.cpp.

                                                                                                               {
  std::string identity;
  return UpdateCredentials(credentials,identity,in,out);
}

Here is the caller graph for this function:

bool Arc::DelegationContainerSOAP::UpdateCredentials ( std::string &  credentials,
std::string &  identity,
const SOAPEnvelope &  in,
SOAPEnvelope &  out 
)

Definition at line 1058 of file DelegationInterface.cpp.

                                                                                                                                    {
  lock_.lock();
  std::string id = (std::string)(const_cast<SOAPEnvelope&>(in)["UpdateCredentials"]["DelegatedToken"]["Id"]);
  ConsumerIterator i = consumers_.find(id);
  if(i == consumers_.end()) { lock_.unlock(); return false; };
  if(!(i->second.deleg)) { lock_.unlock(); return false; };
  if(restricted_) {


  };
  bool r = i->second.deleg->UpdateCredentials(credentials,identity,in,out);
  if(((++(i->second.usage_count)) > max_usage_) && (max_usage_ > 0)) {
    RemoveConsumer(i);
  } else {
    TouchConsumer(i);
  };
  lock_.unlock();
  return r;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 165 of file DelegationInterface.h.

Definition at line 166 of file DelegationInterface.h.

Definition at line 167 of file DelegationInterface.h.

If true delegation consumer is deleted when connection context is destroyed.

Definition at line 181 of file DelegationInterface.h.

Glib::Mutex Arc::DelegationContainerSOAP::lock_ [protected]

Definition at line 173 of file DelegationInterface.h.

Lifetime of unused delegation consumer.

Definition at line 177 of file DelegationInterface.h.

Max.

number of delegation consumers

Definition at line 175 of file DelegationInterface.h.

Max.

times same delegation consumer may accept credentials

Definition at line 179 of file DelegationInterface.h.

If true all delegation phases must be performed by same identity.

Definition at line 183 of file DelegationInterface.h.


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