⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 118887 in webkit


Ignore:
Timestamp:
May 29, 2012, 8:51:23 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Loading media data with http authentication
https://bugs.webkit.org/show_bug.cgi?id=84214

Patch by Jonathan Dong <Jonathan Dong> on 2012-05-29
Reviewed by George Staikos.

.:

Added a manual test case which needs user to provide a HTTP server
with HTTP authentication support when loading the specified media
resource. The test case will test if the media resource is successfully
loaded.

  • ManualTests/blackberry/video-load-with-authentication.html: Added.

Source/WebCore:

RIM PR: 117618
Implemented http authentication feature for media by implementing
two interface functions in class MediaPlayerPrivate:
onAuthenticationNeeded(): this function is triggered when MMR
engine requires http authentication. We search the CredentialStorage
to see if we have already stored existing credential information,
or challenge user to provide it.
OnAuthenticationAccepted(): this function is triggered when MMR
engine accepts the credential information, and we need to save
it in CredentialStorage for later use.

Internally reviewed by Max Feil <mfeil@qnx.com>.

Manual test case: blackberry/video-load-with-authentication.html

  • platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:

(WebCore::generateProtectionSpaceFromMMRAuthChallenge):
(WebCore):
(WebCore::MediaPlayerPrivate::onAuthenticationNeeded):
(WebCore::MediaPlayerPrivate::onAuthenticationAccepted):

  • platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:

(MediaPlayerPrivate):

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r118828 r118887  
     12012-05-29  Jonathan Dong  <jonathan.dong@torchmobile.com.cn>
     2
     3        [BlackBerry] Loading media data with http authentication
     4        https://bugs.webkit.org/show_bug.cgi?id=84214
     5
     6        Reviewed by George Staikos.
     7
     8        Added a manual test case which needs user to provide a HTTP server
     9        with HTTP authentication support when loading the specified media
     10        resource. The test case will test if the media resource is successfully
     11        loaded.
     12
     13        * ManualTests/blackberry/video-load-with-authentication.html: Added.
     14
    1152012-05-29  Simon Fraser  <simon.fraser@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r118886 r118887  
     12012-05-29  Jonathan Dong  <jonathan.dong@torchmobile.com.cn>
     2
     3        [BlackBerry] Loading media data with http authentication
     4        https://bugs.webkit.org/show_bug.cgi?id=84214
     5
     6        Reviewed by George Staikos.
     7
     8        RIM PR: 117618
     9        Implemented http authentication feature for media by implementing
     10        two interface functions in class MediaPlayerPrivate:
     11        onAuthenticationNeeded(): this function is triggered when MMR
     12        engine requires http authentication. We search the CredentialStorage
     13        to see if we have already stored existing credential information,
     14        or challenge user to provide it.
     15        OnAuthenticationAccepted(): this function is triggered when MMR
     16        engine accepts the credential information, and we need to save
     17        it in CredentialStorage for later use.
     18
     19        Internally reviewed by Max Feil <mfeil@qnx.com>.
     20
     21        Manual test case: blackberry/video-load-with-authentication.html
     22
     23        * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
     24        (WebCore::generateProtectionSpaceFromMMRAuthChallenge):
     25        (WebCore):
     26        (WebCore::MediaPlayerPrivate::onAuthenticationNeeded):
     27        (WebCore::MediaPlayerPrivate::onAuthenticationAccepted):
     28        * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
     29        (MediaPlayerPrivate):
     30
    1312012-05-29  MORITA Hajime  <morrita@google.com>
    232
  • trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp

    r116858 r118887  
    2323
    2424#include "CookieManager.h"
     25#include "Credential.h"
     26#include "CredentialStorage.h"
    2527#include "Frame.h"
    2628#include "FrameView.h"
     
    3133#include "NotImplemented.h"
    3234#include "PlatformContextSkia.h"
     35#include "ProtectionSpace.h"
    3336#include "RenderBox.h"
    3437#include "TimeRanges.h"
     
    657660}
    658661#endif
     662
     663static ProtectionSpace generateProtectionSpaceFromMMRAuthChallenge(const MMRAuthChallenge& authChallenge)
     664{
     665    KURL url(ParsedURLString, String(authChallenge.url().c_str()));
     666    ASSERT(url.isValid());
     667
     668    return ProtectionSpace(url.host(), url.port(),
     669                           static_cast<ProtectionSpaceServerType>(authChallenge.serverType()),
     670                           authChallenge.realm().c_str(),
     671                           static_cast<ProtectionSpaceAuthenticationScheme>(authChallenge.authScheme()));
     672}
     673
     674bool MediaPlayerPrivate::onAuthenticationNeeded(MMRAuthChallenge& authChallenge)
     675{
     676    KURL url(ParsedURLString, String(authChallenge.url().c_str()));
     677    if (!url.isValid())
     678        return false;
     679
     680    ProtectionSpace protectionSpace = generateProtectionSpaceFromMMRAuthChallenge(authChallenge);
     681    Credential credential = CredentialStorage::get(protectionSpace);
     682    bool isConfirmed = false;
     683    if (credential.isEmpty()) {
     684        if (frameView() && frameView()->hostWindow())
     685            isConfirmed = frameView()->hostWindow()->platformPageClient()->authenticationChallenge(url, protectionSpace, credential);
     686    } else
     687        isConfirmed = true;
     688
     689    if (isConfirmed)
     690        authChallenge.setCredential(credential.user().utf8().data(), credential.password().utf8().data(), static_cast<MMRAuthChallenge::CredentialPersistence>(credential.persistence()));
     691
     692    return isConfirmed;
     693}
     694
     695void MediaPlayerPrivate::onAuthenticationAccepted(const MMRAuthChallenge& authChallenge) const
     696{
     697    KURL url(ParsedURLString, String(authChallenge.url().c_str()));
     698    if (!url.isValid())
     699        return;
     700
     701    ProtectionSpace protectionSpace = generateProtectionSpaceFromMMRAuthChallenge(authChallenge);
     702    Credential savedCredential = CredentialStorage::get(protectionSpace);
     703    if (savedCredential.isEmpty())
     704        CredentialStorage::set(Credential(authChallenge.username().c_str(), authChallenge.password().c_str(), static_cast<CredentialPersistence>(authChallenge.persistence())), protectionSpace, url);
     705}
    659706
    660707int MediaPlayerPrivate::showErrorDialog(MMRPlayer::Error type)
  • trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h

    r116858 r118887  
    131131    virtual void onBuffering(bool);
    132132#endif
     133    virtual bool onAuthenticationNeeded(BlackBerry::Platform::MMRAuthChallenge&);
     134    virtual void onAuthenticationAccepted(const BlackBerry::Platform::MMRAuthChallenge&) const;
    133135
    134136    virtual bool isFullscreen() const;
Note: See TracChangeset for help on using the changeset viewer.