|
reSIProcate/DialogUsageManager
9694
|
#include <ClientAuthManager.hxx>

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 |
Definition at line 19 of file ClientAuthManager.hxx.
typedef std::map<DialogSetId, AuthState> resip::ClientAuthManager::AttemptedAuthMap [private] |
Definition at line 100 of file ClientAuthManager.hxx.
| ClientAuthManager::ClientAuthManager | ( | ) |
Definition at line 103 of file ClientAuthManager.cxx.
{
}
| virtual resip::ClientAuthManager::~ClientAuthManager | ( | ) | [inline, virtual] |
Definition at line 23 of file ClientAuthManager.hxx.
{}
| 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;
}
}

friend class DialogSet [friend] |
Definition at line 36 of file ClientAuthManager.hxx.
Definition at line 101 of file ClientAuthManager.hxx.
Referenced by dialogSetDestroyed().
1.7.5.1