|
reSIProcate/DialogUsageManager
9694
|

Public Member Functions | |
| RealmState () | |
| void | clear () |
| bool | handleAuth (UserProfile &userProfile, const Auth &auth, bool isProxyCredential) |
| void | authSucceeded () |
| void | addAuthentication (SipMessage &origRequest) |
Private Types | |
| enum | State { Invalid, Cached, Current, TryOnce, Failed } |
Private Member Functions | |
| void | transition (State s) |
| bool | findCredential (UserProfile &userProfile, const Auth &auth) |
Static Private Member Functions | |
| static const Data & | getStateString (State s) |
Private Attributes | |
| UserProfile::DigestCredential | mCredential |
| bool | mIsProxyCredential |
| State | mState |
| unsigned int | mNonceCount |
| Auth | mAuth |
| Auth * | mAuthPtr |
Definition at line 46 of file ClientAuthManager.hxx.
enum resip::ClientAuthManager::RealmState::State [private] |
| ClientAuthManager::RealmState::RealmState | ( | ) |
Definition at line 265 of file ClientAuthManager.cxx.
: mIsProxyCredential(false), mState(Invalid), mNonceCount(0), mAuthPtr(NULL) { }
| void ClientAuthManager::RealmState::addAuthentication | ( | SipMessage & | origRequest | ) |
Definition at line 402 of file ClientAuthManager.cxx.
References resip::SipMessage::addOutboundDecorator(), resip::Data::empty(), resip::Helper::qopOption(), and resip::Helper::updateNonceCount().
{
assert(mState != Failed);
if (mState == Failed) return;
Data nonceCountString;
Data authQop = Helper::qopOption(mAuth);
if(!authQop.empty())
{
Helper::updateNonceCount(mNonceCount, nonceCountString);
}
// Add client auth decorator so that we ensure any body hashes are calcuated after user defined outbound decorators that
// may be modifying the message body
std::auto_ptr<MessageDecorator> clientAuthDecorator(new ClientAuthDecorator(mIsProxyCredential, mAuth, mCredential, authQop, nonceCountString));
request.addOutboundDecorator(clientAuthDecorator);
}

| void ClientAuthManager::RealmState::authSucceeded | ( | ) |
Definition at line 296 of file ClientAuthManager.cxx.
| void ClientAuthManager::RealmState::clear | ( | void | ) |
Definition at line 373 of file ClientAuthManager.cxx.
{
mNonceCount = 0;
}
| bool ClientAuthManager::RealmState::findCredential | ( | UserProfile & | userProfile, |
| const Auth & | auth | ||
| ) | [private] |
dcm! -- icky, expose static empty soon...ptr instead of reference?
Definition at line 379 of file ClientAuthManager.cxx.
References resip::Helper::algorithmAndQopSupported(), DebugLog, resip::UserProfile::getDigestCredential(), resip::ClientAuthExtension::instance(), and resip::ParserCategory::param().
{
if (!(Helper::algorithmAndQopSupported(auth)
|| (ClientAuthExtension::instance().algorithmAndQopSupported(auth))))
{
DebugLog(<<"Unsupported algorithm or qop: " << auth);
return false;
}
const Data& realm = auth.param(p_realm);
mCredential = userProfile.getDigestCredential(realm);
if ( mCredential.realm.empty() )
{
DebugLog( << "Got a 401 or 407 but could not find credentials for realm: " << realm);
// DebugLog (<< auth);
// DebugLog (<< response);
return false;
}
return true;
}

Definition at line 283 of file ClientAuthManager.cxx.
References RealmStates.
{
return RealmStates[s];
}
| bool ClientAuthManager::RealmState::handleAuth | ( | UserProfile & | userProfile, |
| const Auth & | auth, | ||
| bool | isProxyCredential | ||
| ) |
Definition at line 315 of file ClientAuthManager.cxx.
References DebugLog, resip::Auth::exists(), and resip::ParserCategory::param().
{
DebugLog( << "ClientAuthManager::RealmState::handleAuth: " << this << " " << auth << " is proxy: " << isProxyCredential);
mIsProxyCredential = isProxyCredential; //this changing dynamically would
//be very bizarre..should trap w/ enum
switch(mState)
{
case Invalid:
mAuth = auth;
transition(Current);
break;
case Current:
if (auth.exists(p_stale) && auth.param(p_stale) == "true")
{
DebugLog (<< "Stale nonce:" << auth);
mAuth = auth;
clear();
}
else if(auth.exists(p_nonce) && auth.param(p_nonce) != mAuth.param(p_nonce))
{
DebugLog (<< "Different nonce, was: " << mAuth.param(p_nonce) << " now " << auth.param(p_nonce));
mAuth = auth;
clear();
transition(TryOnce);
}
else
{
DebugLog( << "Challenge response already failed for: " << auth);
transition(Failed);
return false;
}
break;
case TryOnce:
DebugLog( << "Extra chance still failed: " << auth);
transition(Failed);
return false;
case Cached: //basically 1 free chance, here for interop, may not be
//required w/ nonce check in current
mAuth = auth;
clear();
transition(Current);
break;
case Failed:
return false;
}
if (findCredential(userProfile, auth))
{
return true;
}
else
{
transition(Failed);
return false;
}
}

| void ClientAuthManager::RealmState::transition | ( | State | s | ) | [private] |
Definition at line 289 of file ClientAuthManager.cxx.
References DebugLog.
{
DebugLog(<< "ClientAuthManager::RealmState::transition from " << getStateString(mState) << " to " << getStateString(s));
mState = s;
}
Definition at line 75 of file ClientAuthManager.hxx.
Definition at line 78 of file ClientAuthManager.hxx.
Definition at line 70 of file ClientAuthManager.hxx.
bool resip::ClientAuthManager::RealmState::mIsProxyCredential [private] |
Definition at line 71 of file ClientAuthManager.hxx.
unsigned int resip::ClientAuthManager::RealmState::mNonceCount [private] |
Definition at line 74 of file ClientAuthManager.hxx.
Definition at line 73 of file ClientAuthManager.hxx.
1.7.5.1