reSIProcate/DialogUsageManager  9694
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
resip::ClientAuthManager Class Reference

#include <ClientAuthManager.hxx>

Collaboration diagram for resip::ClientAuthManager:
Collaboration graph
[legend]

List of all members.

Classes

class  AuthState
class  RealmState

Public Member Functions

 ClientAuthManager ()
virtual ~ClientAuthManager ()
virtual bool handle (UserProfile &userProfile, SipMessage &origRequest, const SipMessage &response)
virtual void addAuthentication (SipMessage &origRequest)
virtual void clearAuthenticationState (const DialogSetId &dsId)

Private Types

typedef std::map< DialogSetId,
AuthState
AttemptedAuthMap

Private Member Functions

virtual void dialogSetDestroyed (const DialogSetId &dsId)

Private Attributes

AttemptedAuthMap mAttemptedAuths

Friends

class DialogSet

Detailed Description

Definition at line 19 of file ClientAuthManager.hxx.


Member Typedef Documentation

Definition at line 100 of file ClientAuthManager.hxx.


Constructor & Destructor Documentation

ClientAuthManager::ClientAuthManager ( )

Definition at line 103 of file ClientAuthManager.cxx.

{
}
virtual resip::ClientAuthManager::~ClientAuthManager ( ) [inline, virtual]

Definition at line 23 of file ClientAuthManager.hxx.

{}

Member Function Documentation

void ClientAuthManager::addAuthentication ( SipMessage origRequest) [virtual]

Definition at line 167 of file ClientAuthManager.cxx.

{
   AttemptedAuthMap::iterator it = mAttemptedAuths.find(DialogSetId(request));
   if (it != mAttemptedAuths.end())
   {
      it->second.addAuthentication(request);
   }
}
void ClientAuthManager::clearAuthenticationState ( const DialogSetId dsId) [virtual]

Definition at line 177 of file ClientAuthManager.cxx.

{
   dialogSetDestroyed(dsId);
}
void ClientAuthManager::dialogSetDestroyed ( const DialogSetId dsId) [private, virtual]

Definition at line 420 of file ClientAuthManager.cxx.

References mAttemptedAuths.

{
   if ( mAttemptedAuths.find(id) != mAttemptedAuths.end())
   {
      mAttemptedAuths.erase(id);
   }
}
bool ClientAuthManager::handle ( UserProfile userProfile,
SipMessage origRequest,
const SipMessage response 
) [virtual]

Definition at line 109 of file ClientAuthManager.cxx.

References DebugLog, ErrLog, resip::SipMessage::exists(), h_StatusLine, resip::ClientAuthManager::AuthState::handleChallenge(), resip::SipMessage::header(), resip::SipMessage::isRequest(), and resip::SipMessage::isResponse().

{
   try
   {
      assert( response.isResponse() );
      assert( origRequest.isRequest() );
      
      DialogSetId id(origRequest);

      const int& code = response.header(h_StatusLine).statusCode();
      if (code < 101 || code >= 500)
      {
         return false;
      }
      else if (! (  code == 401 || code == 407 )) // challenge success
      {
         AttemptedAuthMap::iterator it = mAttemptedAuths.find(id);     
         if (it != mAttemptedAuths.end())
         {
            DebugLog (<< "ClientAuthManager::handle: transitioning " << id << "to cached");         

            // cache the result
            it->second.authSucceeded();
         }      
         return false;
      }   

      if (!(response.exists(h_WWWAuthenticates) || response.exists(h_ProxyAuthenticates)))
      {
         DebugLog (<< "Invalid challenge for " << id  << ", nothing to respond to; fail");         
         return false;
      }
   
      AuthState& authState = mAttemptedAuths[id];

      // based on the UserProfile and the challenge, store credentials in the
      // AuthState associated with this DialogSet if the algorithm is supported
      if (authState.handleChallenge(userProfile, response))
      {
         assert(origRequest.header(h_Vias).size() == 1);
         origRequest.header(h_CSeq).sequence()++;
         DebugLog (<< "Produced response to digest challenge for " << userProfile );
         return true;
      }
      else
      {
         return false;
      }
   }
   catch(BaseException& e)
   {
      assert(0);
      ErrLog(<< "Unexpected exception in ClientAuthManager::handle " << e);
      return false;
   }      
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class DialogSet [friend]

Definition at line 36 of file ClientAuthManager.hxx.


Member Data Documentation

Definition at line 101 of file ClientAuthManager.hxx.

Referenced by dialogSetDestroyed().


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