static ProtectionSpace generateProtectionSpaceFromMMRAuthChallenge(const MMRAuthChallenge& authChallenge)
{
    KURL url(ParsedURLString, WTF::String(authChallenge.url().c_str()));
    ASSERT(url.isValid());

    return ProtectionSpace(url.host(), url.port(),
                           static_cast<ProtectionSpaceServerType>(authChallenge.serverType()),
                           authChallenge.realm().c_str(),
                           static_cast<ProtectionSpaceAuthenticationScheme>(authChallenge.authScheme()));
}
void MediaPlayerPrivate::onAuthenticationAccepted(const MMRAuthChallenge& authChallenge) const
{
    KURL url(ParsedURLString, WTF::String(authChallenge.url().c_str()));
    if (!url.isValid())
        return;

    ProtectionSpace protectionSpace = generateProtectionSpaceFromMMRAuthChallenge(authChallenge);
    Credential savedCredential = CredentialStorage::get(protectionSpace);
    if (savedCredential.isEmpty())
        CredentialStorage::set(Credential(authChallenge.username().c_str(), authChallenge.password().c_str(), static_cast<CredentialPersistence>(authChallenge.persistence())), protectionSpace, url);
}
Exemplo n.º 3
0
bool MediaPlayerPrivate::onAuthenticationNeeded(MMRAuthChallenge& authChallenge)
{
    KURL url(ParsedURLString, String(authChallenge.url().c_str()));
    if (!url.isValid())
        return false;

    ProtectionSpace protectionSpace = generateProtectionSpaceFromMMRAuthChallenge(authChallenge);
    Credential credential = CredentialStorage::get(protectionSpace);
    bool isConfirmed = false;
    if (credential.isEmpty()) {
        if (frameView() && frameView()->hostWindow())
            isConfirmed = frameView()->hostWindow()->platformPageClient()->authenticationChallenge(url, protectionSpace, credential);
    } else
        isConfirmed = true;

    if (isConfirmed)
        authChallenge.setCredential(credential.user().utf8().data(), credential.password().utf8().data(), static_cast<MMRAuthChallenge::CredentialPersistence>(credential.persistence()));

    return isConfirmed;
}
Exemplo n.º 4
0
void MediaPlayerPrivate::onAuthenticationNeeded(MMRAuthChallenge& authChallenge)
{
    KURL url(ParsedURLString, String(authChallenge.url().c_str()));
    if (!url.isValid())
        return;

    ProtectionSpace protectionSpace = generateProtectionSpaceFromMMRAuthChallenge(authChallenge);
    Credential credential = CredentialStorage::get(protectionSpace);
    if (!credential.isEmpty()) {
        notifyChallengeResult(url, protectionSpace, AuthenticationChallengeSuccess, credential);
        return;
    }

    if (frameView() && frameView()->hostWindow())
        frameView()->hostWindow()->platformPageClient()->authenticationChallenge(url, protectionSpace, credential, this);
}
void MediaPlayerPrivate::onAuthenticationNeeded(MMRAuthChallenge& authChallenge)
{
    KURL url(ParsedURLString, WTF::String(authChallenge.url().c_str()));
    if (!url.isValid())
        return;

    ProtectionSpace protectionSpace = generateProtectionSpaceFromMMRAuthChallenge(authChallenge);
    Credential credential = CredentialStorage::get(protectionSpace);
    if (!credential.isEmpty()) {
        notifyChallengeResult(url, protectionSpace, AuthenticationChallengeSuccess, credential);
        return;
    }

    m_isAuthenticationChallenging = true;
    AuthenticationChallengeManager::instance()->authenticationChallenge(url, protectionSpace, credential,
        this, m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient());
}