MCPcopy Create free account
hub / github.com/PHZ76/RtspServer / HandleAuthentication

Method HandleAuthentication

src/xop/RtspConnection.cpp:412–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412bool RtspConnection::HandleAuthentication()
413{
414 if (auth_info_ != nullptr && !has_auth_) {
415 std::string cmd = rtsp_request_->MethodToString[rtsp_request_->GetMethod()];
416 std::string url = rtsp_request_->GetRtspUrl();
417
418 if (_nonce.size() > 0 && (auth_info_->GetResponse(_nonce, cmd, url) == rtsp_request_->GetAuthResponse())) {
419 _nonce.clear();
420 has_auth_ = true;
421 }
422 else {
423 std::shared_ptr<char> res(new char[4096], std::default_delete<char[]>());
424 _nonce = auth_info_->GetNonce();
425 int size = rtsp_request_->BuildUnauthorizedRes(res.get(), 4096, auth_info_->GetRealm().c_str(), _nonce.c_str());
426 SendRtspMessage(res, size);
427 return false;
428 }
429 }
430
431 return true;
432}
433
434void RtspConnection::SendOptions(ConnectionMode mode)
435{

Callers

nothing calls this directly

Calls 7

GetResponseMethod · 0.80
GetAuthResponseMethod · 0.80
GetNonceMethod · 0.80
BuildUnauthorizedResMethod · 0.80
GetRealmMethod · 0.80
GetMethodMethod · 0.45
GetRtspUrlMethod · 0.45

Tested by

no test coverage detected