static void setAuthCredentials(NetworkRequest& platformRequest, const AuthenticationChallenge& challenge)
{
    if (challenge.isNull())
        return;

    Credential credential = challenge.proposedCredential();
    const ProtectionSpace& protectionSpace = challenge.protectionSpace();

    String username = credential.user();
    String password = credential.password();

    NetworkRequest::AuthType authType;
    NetworkRequest::AuthProtocol authProtocol;
    NetworkRequest::AuthScheme authScheme;
    protectionSpaceToPlatformAuth(protectionSpace, authType, authProtocol, authScheme);

    if (authType != NetworkRequest::AuthTypeNone && authProtocol != NetworkRequest::AuthProtocolNone && authScheme != NetworkRequest::AuthSchemeNone)
        platformRequest.setCredentials(authType, authProtocol, authScheme, username.utf8().data(), password.utf8().data());
}