Search code examples
c++authenticationhashrtsp

Retrieve the authentication method used in RTSP connection using LiveMedia555 library


I've established an RTSP connection using LiveMedia library ( ref http://www.live555.com/liveMedia/)

// Create a media session object from this SDP description:
// and send setup on subsessios that we want 
ourClient->disallowBasicAuthentication(); //force authentication different from the basic one
Ret = ourClient->CreateMediaSessions(bMetaData, bMulticast, bAudio, !SDPviaHTTP, streamUsingTCP);

In the code above I use LiveMedia555 to realize a connection without the basic authentication, but how can I retrieve the authentication method used?

I've tried with isAuthorized() method in RTSPClient class, but it gives true if the authentication has been done, but not info about what kind of authentication has been used.


Solution

  • In RTSPClient class it's possible to retrieve information about authentication method used during connection.

    if (fCurrentAuthenticator.nonce() != nullptr)
    {
    //digest authentication
    }
    else
    {
    //basic authentication
    }
    

    if the nonce is not null, it means that a digest authentication has been done.