Changeset 73614 in webkit


Ignore:
Timestamp:
Dec 9, 2010 8:55:19 AM (13 years ago)
Author:
beidson@apple.com
Message:

<rdar://problem/7660733> and https://bugs.webkit.org/show_bug.cgi?id=50191
WebKit2 Authentication Support

Reviewed by Maciej Stachowiak.

WebCore:

  • WebCore.exp.in:

WebKit2:

Implement authentication-related coders:

  • Shared/WebCoreArgumentCoders.h:

Allow the ResourceResponse coders to handle null responses:

  • Shared/mac/WebCoreArgumentCodersMac.mm:

(CoreIPC::encodeResourceResponse):
(CoreIPC::decodeResourceResponse):

Add new API and Impl casts for ProtectionSpace and Credential enums:

  • UIProcess/API/C/WKAPICast.h:

(WebKit::toAPI):
(WebKit::toCredentialPersistence):

Move the DecisionListener to be accessed off the challenge itself, and fill in other
necessary API:

  • UIProcess/API/C/WKAuthenticationChallenge.cpp:

(WKAuthenticationChallengeGetDecisionListener):
(WKAuthenticationChallengeGetProtectionSpace):
(WKAuthenticationChallengeGetProposedCredential):
(WKAuthenticationChallengeGetPreviousFailureCount):

  • UIProcess/API/C/WKAuthenticationChallenge.h:
  • UIProcess/Authentication/AuthenticationChallengeProxy.cpp:

(WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy):
(WebKit::AuthenticationChallengeProxy::proposedCredential):
(WebKit::AuthenticationChallengeProxy::protectionSpace):

  • UIProcess/Authentication/AuthenticationChallengeProxy.h:

(WebKit::AuthenticationChallengeProxy::previousFailureCount):

Fill in some credential API:

  • UIProcess/API/C/WKCredential.cpp:

(WKCredentialCreate):
(WKCredentialCopyUser):

  • UIProcess/API/C/WKCredential.h:
  • UIProcess/API/C/WKCredentialTypes.h: Added.
  • UIProcess/Authentication/WebCredential.cpp:

(WebKit::WebCredential::WebCredential):
(WebKit::WebCredential::user):

  • UIProcess/Authentication/WebCredential.h:

(WebKit::WebCredential::create):

Fill in some protection space API:

  • UIProcess/API/C/WKProtectionSpace.cpp:

(WKProtectionSpaceCopyHost):
(WKProtectionSpaceGetPort):
(WKProtectionSpaceCopyRealm):
(WKProtectionSpaceGetIsProxy):
(WKProtectionSpaceGetServerType):
(WKProtectionSpaceGetReceivesCredentialSecurely):
(WKProtectionSpaceGetAuthenticationScheme):

  • UIProcess/API/C/WKProtectionSpace.h:
  • UIProcess/API/C/WKProtectionSpaceTypes.h: Added.
  • UIProcess/Authentication/WebProtectionSpace.cpp:

(WebKit::WebProtectionSpace::WebProtectionSpace):
(WebKit::WebProtectionSpace::host):
(WebKit::WebProtectionSpace::port):
(WebKit::WebProtectionSpace::realm):
(WebKit::WebProtectionSpace::isProxy):
(WebKit::WebProtectionSpace::serverType):
(WebKit::WebProtectionSpace::receivesCredentialSecurely):
(WebKit::WebProtectionSpace::authenticationScheme):

  • UIProcess/Authentication/WebProtectionSpace.h:

Change the authentication challenge callback to reflect the new ownership of
the DecisionListener:

  • UIProcess/API/C/WKPage.h:
  • UIProcess/WebLoaderClient.cpp:

(WebKit::WebLoaderClient::didReceiveAuthenticationChallengeInFrame):

  • UIProcess/WebLoaderClient.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::didReceiveAuthenticationChallenge):

  • WebKit2.pro:
  • WebKit2.xcodeproj/project.pbxproj:
  • win/WebKit2.vcproj:
  • win/WebKit2Generated.make:
Location:
trunk
Files:
2 added
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r73613 r73614  
     12010-12-09  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        <rdar://problem/7660733> and https://bugs.webkit.org/show_bug.cgi?id=50191
     6        WebKit2 Authentication Support
     7
     8        * WebCore.exp.in:
     9
    1102010-12-09  Peter Beverloo  <peter@lvp-media.com>
    211
  • trunk/WebCore/WebCore.exp.in

    r73535 r73614  
    138138__ZN3WTF6StringC1EP8NSString
    139139__ZN3WTF6StringC1EPK10__CFString
     140__ZN7WebCore10CredentialC1ERKN3WTF6StringES4_NS_21CredentialPersistenceE
    140141__ZN7WebCore10CredentialC1Ev
    141142__ZN7WebCore10JSDocument6s_infoE
     
    372373__ZN7WebCore15GraphicsContextD1Ev
    373374__ZN7WebCore15JSDOMWindowBase18commonJSGlobalDataEv
     375__ZN7WebCore15ProtectionSpaceC1ERKN3WTF6StringEiNS_25ProtectionSpaceServerTypeES4_NS_35ProtectionSpaceAuthenticationSchemeE
    374376__ZN7WebCore15ProtectionSpaceC1Ev
    375377__ZN7WebCore15ScrollAlignment17alignCenterAlwaysE
     
    508510__ZN7WebCore22createFragmentFromTextEPNS_5RangeERKN3WTF6StringE
    509511__ZN7WebCore22externalRepresentationEPNS_5FrameEj
     512__ZN7WebCore23AuthenticationChallengeC1ERKNS_15ProtectionSpaceERKNS_10CredentialEjRKNS_16ResourceResponseERKNS_13ResourceErrorE
    510513__ZN7WebCore23ReplaceSelectionCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_16DocumentFragmentEEEbbbbbNS_10EditActionE
    511514__ZN7WebCore23createFragmentFromNodesEPNS_8DocumentERKN3WTF6VectorIPNS_4NodeELm0EEE
     
    915918__ZNK3JSC8Bindings10RootObject12globalObjectEv
    916919__ZNK3WTF6String14createCFStringEv
     920__ZNK7WebCore10Credential11persistenceEv
     921__ZNK7WebCore10Credential4userEv
     922__ZNK7WebCore10Credential8passwordEv
    917923__ZNK7WebCore10FloatPointcv8_NSPointEv
    918924__ZNK7WebCore10PluginData16supportsMimeTypeERKN3WTF6StringE
     
    10141020__ZNK7WebCore15GraphicsContext16paintingDisabledEv
    10151021__ZNK7WebCore15ProgressTracker17estimatedProgressEv
     1022__ZNK7WebCore15ProtectionSpace10serverTypeEv
     1023__ZNK7WebCore15ProtectionSpace26receivesCredentialSecurelyEv
     1024__ZNK7WebCore15ProtectionSpace4hostEv
     1025__ZNK7WebCore15ProtectionSpace4portEv
     1026__ZNK7WebCore15ProtectionSpace5realmEv
     1027__ZNK7WebCore15ProtectionSpace7isProxyEv
    10161028__ZNK7WebCore15ResourceRequest12nsURLRequestEv
    10171029__ZNK7WebCore15VisiblePosition14characterAfterEv
     
    10591071__ZNK7WebCore23FrameLoaderStateMachine23committingFirstRealLoadEv
    10601072__ZNK7WebCore26NetscapePlugInStreamLoader6isDoneEv
     1073__ZNK7WebCore27AuthenticationChallengeBase15failureResponseEv
     1074__ZNK7WebCore27AuthenticationChallengeBase15protectionSpaceEv
     1075__ZNK7WebCore27AuthenticationChallengeBase18proposedCredentialEv
     1076__ZNK7WebCore27AuthenticationChallengeBase20previousFailureCountEv
     1077__ZNK7WebCore27AuthenticationChallengeBase5errorEv
    10611078__ZNK7WebCore27AuthenticationChallengeBase6isNullEv
    10621079__ZNK7WebCore4Font10floatWidthERKNS_7TextRunEPN3WTF7HashSetIPKNS_14SimpleFontDataENS4_7PtrHashIS8_EENS4_10HashTraitsIS8_EEEEPNS_13GlyphOverflowE
  • trunk/WebKit2/ChangeLog

    r73591 r73614  
     12010-12-09  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        <rdar://problem/7660733> and https://bugs.webkit.org/show_bug.cgi?id=50191
     6        WebKit2 Authentication Support
     7
     8        Implement authentication-related coders:
     9        * Shared/WebCoreArgumentCoders.h:
     10
     11        Allow the ResourceResponse coders to handle null responses:
     12        * Shared/mac/WebCoreArgumentCodersMac.mm:
     13        (CoreIPC::encodeResourceResponse):
     14        (CoreIPC::decodeResourceResponse):
     15
     16        Add new API and Impl casts for ProtectionSpace and Credential enums:
     17        * UIProcess/API/C/WKAPICast.h:
     18        (WebKit::toAPI):
     19        (WebKit::toCredentialPersistence):
     20
     21        Move the DecisionListener to be accessed off the challenge itself, and fill in other
     22        necessary API:
     23        * UIProcess/API/C/WKAuthenticationChallenge.cpp:
     24        (WKAuthenticationChallengeGetDecisionListener):
     25        (WKAuthenticationChallengeGetProtectionSpace):
     26        (WKAuthenticationChallengeGetProposedCredential):
     27        (WKAuthenticationChallengeGetPreviousFailureCount):
     28        * UIProcess/API/C/WKAuthenticationChallenge.h:
     29        * UIProcess/Authentication/AuthenticationChallengeProxy.cpp:
     30        (WebKit::AuthenticationChallengeProxy::~AuthenticationChallengeProxy):
     31        (WebKit::AuthenticationChallengeProxy::proposedCredential):
     32        (WebKit::AuthenticationChallengeProxy::protectionSpace):
     33        * UIProcess/Authentication/AuthenticationChallengeProxy.h:
     34        (WebKit::AuthenticationChallengeProxy::previousFailureCount):
     35
     36        Fill in some credential API:
     37        * UIProcess/API/C/WKCredential.cpp:
     38        (WKCredentialCreate):
     39        (WKCredentialCopyUser):
     40        * UIProcess/API/C/WKCredential.h:
     41        * UIProcess/API/C/WKCredentialTypes.h: Added.
     42        * UIProcess/Authentication/WebCredential.cpp:
     43        (WebKit::WebCredential::WebCredential):
     44        (WebKit::WebCredential::user):
     45        * UIProcess/Authentication/WebCredential.h:
     46        (WebKit::WebCredential::create):
     47
     48        Fill in some protection space API:
     49        * UIProcess/API/C/WKProtectionSpace.cpp:
     50        (WKProtectionSpaceCopyHost):
     51        (WKProtectionSpaceGetPort):
     52        (WKProtectionSpaceCopyRealm):
     53        (WKProtectionSpaceGetIsProxy):
     54        (WKProtectionSpaceGetServerType):
     55        (WKProtectionSpaceGetReceivesCredentialSecurely):
     56        (WKProtectionSpaceGetAuthenticationScheme):
     57        * UIProcess/API/C/WKProtectionSpace.h:
     58        * UIProcess/API/C/WKProtectionSpaceTypes.h: Added.
     59        * UIProcess/Authentication/WebProtectionSpace.cpp:
     60        (WebKit::WebProtectionSpace::WebProtectionSpace):
     61        (WebKit::WebProtectionSpace::host):
     62        (WebKit::WebProtectionSpace::port):
     63        (WebKit::WebProtectionSpace::realm):
     64        (WebKit::WebProtectionSpace::isProxy):
     65        (WebKit::WebProtectionSpace::serverType):
     66        (WebKit::WebProtectionSpace::receivesCredentialSecurely):
     67        (WebKit::WebProtectionSpace::authenticationScheme):
     68        * UIProcess/Authentication/WebProtectionSpace.h:
     69
     70        Change the authentication challenge callback to reflect the new ownership of
     71        the DecisionListener:
     72        * UIProcess/API/C/WKPage.h:
     73        * UIProcess/WebLoaderClient.cpp:
     74        (WebKit::WebLoaderClient::didReceiveAuthenticationChallengeInFrame):
     75        * UIProcess/WebLoaderClient.h:
     76        * UIProcess/WebPageProxy.cpp:
     77        (WebKit::WebPageProxy::didReceiveAuthenticationChallenge):
     78
     79        * WebKit2.pro:
     80        * WebKit2.xcodeproj/project.pbxproj:
     81        * win/WebKit2.vcproj:
     82        * win/WebKit2Generated.make:
     83
    1842010-12-08  Sam Weinig  <sam@webkit.org>
    285
  • trunk/WebKit2/Shared/WebCoreArgumentCoders.h

    r73281 r73614  
    116116    static void encode(ArgumentEncoder* encoder, const WebCore::AuthenticationChallenge& challenge)
    117117    {
    118         // FIXME: Implement
    119     }
    120 
    121     static bool decode(ArgumentDecoder* decoder, WebCore::AuthenticationChallenge& credential)
    122     {
    123         // FIXME: Implement
     118        encoder->encode(CoreIPC::In(challenge.protectionSpace(), challenge.proposedCredential(), challenge.previousFailureCount(), challenge.failureResponse(), challenge.error()));
     119    }
     120
     121    static bool decode(ArgumentDecoder* decoder, WebCore::AuthenticationChallenge& challenge)
     122    {   
     123        WebCore::ProtectionSpace protectionSpace;
     124        WebCore::Credential proposedCredential;
     125        unsigned previousFailureCount;
     126        WebCore::ResourceResponse failureResponse;
     127        WebCore::ResourceError error;
     128
     129        if (!decoder->decode(CoreIPC::Out(protectionSpace, proposedCredential, previousFailureCount, failureResponse, error)))
     130            return false;
     131       
     132        challenge = WebCore::AuthenticationChallenge(protectionSpace, proposedCredential, previousFailureCount, failureResponse, error);
     133
    124134        return true;
    125135    }
     
    127137
    128138template<> struct ArgumentCoder<WebCore::ProtectionSpace> {
    129     static void encode(ArgumentEncoder* encoder, const WebCore::ProtectionSpace& challenge)
    130     {
    131         // FIXME: Implement
    132     }
    133 
    134     static bool decode(ArgumentDecoder* decoder, WebCore::ProtectionSpace& credential)
    135     {
    136         // FIXME: Implement
     139    static void encode(ArgumentEncoder* encoder, const WebCore::ProtectionSpace& space)
     140    {
     141        encoder->encode(CoreIPC::In(space.host(), space.port(), static_cast<uint32_t>(space.serverType()), space.realm(), static_cast<uint32_t>(space.authenticationScheme())));
     142    }
     143
     144    static bool decode(ArgumentDecoder* decoder, WebCore::ProtectionSpace& space)
     145    {
     146        String host;
     147        int port;
     148        uint32_t serverType;
     149        String realm;
     150        uint32_t authenticationScheme;
     151
     152        if (!decoder->decode(CoreIPC::Out(host, port, serverType, realm, authenticationScheme)))
     153            return false;
     154   
     155        space = WebCore::ProtectionSpace(host, port, static_cast<WebCore::ProtectionSpaceServerType>(serverType), realm, static_cast<WebCore::ProtectionSpaceAuthenticationScheme>(authenticationScheme));
     156
    137157        return true;
    138158    }
     
    142162    static void encode(ArgumentEncoder* encoder, const WebCore::Credential& credential)
    143163    {
    144         // FIXME: Implement
     164        encoder->encode(CoreIPC::In(credential.user(), credential.password(), static_cast<uint32_t>(credential.persistence())));
    145165    }
    146166
    147167    static bool decode(ArgumentDecoder* decoder, WebCore::Credential& credential)
    148168    {
    149         // FIXME: Implement
     169        String user;
     170        String password;
     171        int persistence;
     172        if (!decoder->decode(CoreIPC::Out(user, password, persistence)))
     173            return false;
     174       
     175        credential = WebCore::Credential(user, password, static_cast<WebCore::CredentialPersistence>(persistence));
    150176        return true;
    151177    }
  • trunk/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm

    r71868 r73614  
    6161void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceResponse& resourceResponse)
    6262{
     63    bool responseIsPresent = resourceResponse.nsURLResponse();
     64    encoder->encode(responseIsPresent);
     65   
     66    // FIXME: <rdar://problem/8741799> - We can't use NSKeyedArchiver here.
    6367    encodeWithNSKeyedArchiver(encoder, resourceResponse.nsURLResponse());
    6468}
     
    6670bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse& resourceResponse)
    6771{
     72    bool responseIsPresent;
     73    decoder->decode(responseIsPresent);
     74   
     75    // FIXME: <rdar://problem/8741799> - We can't use NSKeyedArchiver here.
    6876    NSURLResponse *nsURLResponse = decodeWithNSKeyedArchiver(decoder);
    69     if (!nsURLResponse)
     77    if (responseIsPresent && !nsURLResponse)
    7078        return false;
    7179
    72     resourceResponse = WebCore::ResourceResponse(nsURLResponse);
     80    if (responseIsPresent)
     81        resourceResponse = WebCore::ResourceResponse(nsURLResponse);
     82
    7383    return true;
    7484}
  • trunk/WebKit2/UIProcess/API/C/WKAPICast.h

    r73412 r73614  
    3030#include "FontSmoothingLevel.h"
    3131#include "WKContext.h"
     32#include "WKCredentialTypes.h"
    3233#include "WKPage.h"
    3334#include "WKPreferencesPrivate.h"
     35#include "WKProtectionSpaceTypes.h"
    3436#include "WKSharedAPICast.h"
     37#include <WebCore/Credential.h>
     38#include <WebCore/FrameLoaderTypes.h>
     39#include <WebCore/ProtectionSpace.h>
    3540
    3641namespace WebKit {
     
    148153}
    149154
     155inline WKProtectionSpaceServerType toAPI(WebCore::ProtectionSpaceServerType type)
     156{
     157    switch (type) {
     158    case WebCore::ProtectionSpaceServerHTTP:
     159        return kWKProtectionSpaceServerTypeHTTP;
     160    case WebCore::ProtectionSpaceServerHTTPS:
     161        return kWKProtectionSpaceServerTypeHTTPS;
     162    case WebCore::ProtectionSpaceServerFTP:
     163        return kWKProtectionSpaceServerTypeFTP;
     164    case WebCore::ProtectionSpaceServerFTPS:
     165        return kWKProtectionSpaceServerTypeFTPS;
     166    case WebCore::ProtectionSpaceProxyHTTP:
     167        return kWKProtectionSpaceProxyTypeHTTP;
     168    case WebCore::ProtectionSpaceProxyHTTPS:
     169        return kWKProtectionSpaceProxyTypeHTTPS;
     170    case WebCore::ProtectionSpaceProxyFTP:
     171        return kWKProtectionSpaceProxyTypeFTP;
     172    case WebCore::ProtectionSpaceProxySOCKS:
     173        return kWKProtectionSpaceProxyTypeSOCKS;
     174    }
     175    return kWKProtectionSpaceServerTypeHTTP;
     176}
     177
     178inline WKProtectionSpaceAuthenticationScheme toAPI(WebCore::ProtectionSpaceAuthenticationScheme type)
     179{
     180    switch (type) {
     181    case WebCore::ProtectionSpaceAuthenticationSchemeDefault:
     182        return kWKProtectionSpaceAuthenticationSchemeDefault;
     183    case WebCore::ProtectionSpaceAuthenticationSchemeHTTPBasic:
     184        return kWKProtectionSpaceAuthenticationSchemeHTTPBasic;
     185    case WebCore::ProtectionSpaceAuthenticationSchemeHTTPDigest:
     186        return kWKProtectionSpaceAuthenticationSchemeHTTPDigest;
     187    case WebCore::ProtectionSpaceAuthenticationSchemeHTMLForm:
     188        return kWKProtectionSpaceAuthenticationSchemeHTMLForm;
     189    case WebCore::ProtectionSpaceAuthenticationSchemeNTLM:
     190        return kWKProtectionSpaceAuthenticationSchemeNTLM;
     191    case WebCore::ProtectionSpaceAuthenticationSchemeNegotiate:
     192        return kWKProtectionSpaceAuthenticationSchemeNegotiate;
     193    case WebCore::ProtectionSpaceAuthenticationSchemeClientCertificateRequested:
     194        return kWKProtectionSpaceAuthenticationSchemeClientCertificateRequested;
     195    case WebCore::ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested:
     196        return kWKProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested;
     197    default:
     198        return kWKProtectionSpaceAuthenticationSchemeUnknown;
     199    }
     200}
     201
     202inline WebCore::CredentialPersistence toCredentialPersistence(WKCredentialPersistence type)
     203{
     204    switch (type) {
     205    case kWKCredentialPersistenceNone:
     206        return WebCore::CredentialPersistenceNone;
     207    case kWKCredentialPersistenceForSession:
     208        return WebCore::CredentialPersistenceForSession;
     209    case kWKCredentialPersistencePermanent:
     210        return WebCore::CredentialPersistencePermanent;
     211    default:
     212        return WebCore::CredentialPersistenceNone;
     213    }
     214}
     215
    150216} // namespace WebKit
    151217
  • trunk/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.cpp

    r73281 r73614  
    2727
    2828#include "AuthenticationChallengeProxy.h"
     29#include "WebCredential.h"
     30#include "WebProtectionSpace.h"
    2931#include "WKAPICast.h"
    3032
     
    3537    return toAPI(AuthenticationChallengeProxy::APIType);
    3638}
     39
     40WKAuthenticationDecisionListenerRef WKAuthenticationChallengeGetDecisionListener(WKAuthenticationChallengeRef challenge)
     41{
     42    return toAPI(toImpl(challenge)->listener());
     43}
     44
     45WKProtectionSpaceRef WKAuthenticationChallengeGetProtectionSpace(WKAuthenticationChallengeRef challenge)
     46{
     47    return toAPI(toImpl(challenge)->protectionSpace());
     48}
     49
     50WKCredentialRef WKAuthenticationChallengeGetProposedCredential(WKAuthenticationChallengeRef challenge)
     51{
     52    return toAPI(toImpl(challenge)->proposedCredential());
     53}
     54
     55int WKAuthenticationChallengeGetPreviousFailureCount(WKAuthenticationChallengeRef challenge)
     56{
     57    return toImpl(challenge)->previousFailureCount();
     58}
  • trunk/WebKit2/UIProcess/API/C/WKAuthenticationChallenge.h

    r73281 r73614  
    3535WK_EXPORT WKTypeID WKAuthenticationChallengeGetTypeID();
    3636
     37WK_EXPORT WKAuthenticationDecisionListenerRef WKAuthenticationChallengeGetDecisionListener(WKAuthenticationChallengeRef);
     38WK_EXPORT WKProtectionSpaceRef WKAuthenticationChallengeGetProtectionSpace(WKAuthenticationChallengeRef);
     39WK_EXPORT WKCredentialRef WKAuthenticationChallengeGetProposedCredential(WKAuthenticationChallengeRef);
     40WK_EXPORT int WKAuthenticationChallengeGetPreviousFailureCount(WKAuthenticationChallengeRef);
     41
    3742#ifdef __cplusplus
    3843}
  • trunk/WebKit2/UIProcess/API/C/WKCredential.cpp

    r73281 r73614  
    2727
    2828#include "WebCredential.h"
     29#include "WebString.h"
    2930#include "WKAPICast.h"
    3031
     
    3536    return toAPI(WebCredential::APIType);
    3637}
     38
     39WKCredentialRef WKCredentialCreate(WKStringRef username, WKStringRef password, WKCredentialPersistence persistence)
     40{
     41    RefPtr<WebCredential> credential = WebCredential::create(toImpl(username), toImpl(password), toCredentialPersistence(persistence));
     42    return toAPI(credential.release().releaseRef());
     43}
     44
     45WKStringRef WKCredentialCopyUser(WKCredentialRef credentialRef)
     46{
     47    return toCopiedAPI(toImpl(credentialRef)->user());
     48}
     49
  • trunk/WebKit2/UIProcess/API/C/WKCredential.h

    r73281 r73614  
    2828
    2929#include <WebKit2/WKBase.h>
     30#include <WebKit2/WKCredentialTypes.h>
    3031
    3132#ifdef __cplusplus
     
    3536WK_EXPORT WKTypeID WKCredentialGetTypeID();
    3637
     38WK_EXPORT WKCredentialRef WKCredentialCreate(WKStringRef username, WKStringRef password, WKCredentialPersistence);
     39WK_EXPORT WKStringRef WKCredentialCopyUser(WKCredentialRef);
     40
    3741#ifdef __cplusplus
    3842}
  • trunk/WebKit2/UIProcess/API/C/WKPage.h

    r73565 r73614  
    5858typedef void (*WKPageDidRunInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
    5959typedef bool (*WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback)(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo);
    60 typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, WKAuthenticationDecisionListenerRef listener, const void *clientInfo);
     60typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo);
    6161
    6262// Progress Client
  • trunk/WebKit2/UIProcess/API/C/WKProtectionSpace.cpp

    r73281 r73614  
    3535    return toAPI(WebProtectionSpace::APIType);
    3636}
     37
     38WKStringRef WKProtectionSpaceCopyHost(WKProtectionSpaceRef protectionSpaceRef)
     39{
     40    return toCopiedAPI(toImpl(protectionSpaceRef)->host());
     41}
     42
     43int WKProtectionSpaceGetPort(WKProtectionSpaceRef protectionSpaceRef)
     44{
     45    return toImpl(protectionSpaceRef)->port();
     46}
     47
     48WKStringRef WKProtectionSpaceCopyRealm(WKProtectionSpaceRef protectionSpaceRef)
     49{
     50    return toCopiedAPI(toImpl(protectionSpaceRef)->realm());
     51}
     52
     53bool WKProtectionSpaceGetIsProxy(WKProtectionSpaceRef protectionSpaceRef)
     54{
     55    return toImpl(protectionSpaceRef)->isProxy();
     56}
     57
     58WKProtectionSpaceServerType WKProtectionSpaceGetServerType(WKProtectionSpaceRef protectionSpaceRef)
     59{
     60    return toAPI(toImpl(protectionSpaceRef)->serverType());
     61}
     62
     63bool WKProtectionSpaceGetReceivesCredentialSecurely(WKProtectionSpaceRef protectionSpaceRef)
     64{
     65    return toImpl(protectionSpaceRef)->receivesCredentialSecurely();
     66}
     67
     68WKProtectionSpaceAuthenticationScheme WKProtectionSpaceGetAuthenticationScheme(WKProtectionSpaceRef protectionSpaceRef)
     69{
     70    return toAPI(toImpl(protectionSpaceRef)->authenticationScheme());
     71}
  • trunk/WebKit2/UIProcess/API/C/WKProtectionSpace.h

    r73281 r73614  
    2828
    2929#include <WebKit2/WKBase.h>
     30#include <WebKit2/WKProtectionSpaceTypes.h>
    3031
    3132#ifdef __cplusplus
     
    3536WK_EXPORT WKTypeID WKProtectionSpaceGetTypeID();
    3637
     38WK_EXPORT WKStringRef WKProtectionSpaceCopyHost(WKProtectionSpaceRef);
     39WK_EXPORT int WKProtectionSpaceGetPort(WKProtectionSpaceRef);
     40WK_EXPORT WKStringRef WKProtectionSpaceCopyRealm(WKProtectionSpaceRef);
     41WK_EXPORT bool WKProtectionSpaceGetIsProxy(WKProtectionSpaceRef);
     42WK_EXPORT WKProtectionSpaceServerType WKProtectionSpaceGetServerType(WKProtectionSpaceRef);
     43WK_EXPORT bool WKProtectionSpaceGetReceivesCredentialSecurely(WKProtectionSpaceRef);
     44WK_EXPORT WKProtectionSpaceAuthenticationScheme WKProtectionSpaceGetAuthenticationScheme(WKProtectionSpaceRef);
     45
    3746#ifdef __cplusplus
    3847}
  • trunk/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.cpp

    r73281 r73614  
    3232#include "WebPageProxy.h"
    3333#include "WebProcessProxy.h"
     34#include "WebProtectionSpace.h"
    3435
    3536namespace WebKit {
     
    4849    // If an outstanding AuthenticationChallengeProxy is being destroyed even though it hasn't been responded to yet,
    4950    // we cancel it here so the WebProcess isn't waiting for an answer forever.
    50     if (m_challengeID)
     51    if (m_challengeID && m_page->process())
    5152        m_page->process()->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), m_page->pageID());
    5253
     
    7879}
    7980
     81WebCredential* AuthenticationChallengeProxy::proposedCredential() const
     82{
     83    if (!m_webCredential)
     84        m_webCredential = WebCredential::create(m_coreAuthenticationChallenge.proposedCredential());
     85       
     86    return m_webCredential.get();
     87}
     88
     89WebProtectionSpace* AuthenticationChallengeProxy::protectionSpace() const
     90{
     91    if (!m_webProtectionSpace)
     92        m_webProtectionSpace = WebProtectionSpace::create(m_coreAuthenticationChallenge.protectionSpace());
     93       
     94    return m_webProtectionSpace.get();
     95}
     96
    8097} // namespace WebKit
  • trunk/WebKit2/UIProcess/Authentication/AuthenticationChallengeProxy.h

    r73281 r73614  
    4242class WebCredential;
    4343class WebPageProxy;
     44class WebProtectionSpace;
    4445
    4546class AuthenticationChallengeProxy : public APIObject {
     
    5859
    5960    AuthenticationDecisionListener* listener() const { return m_listener.get(); }
     61    WebCredential* proposedCredential() const;
     62    WebProtectionSpace* protectionSpace() const;
     63    int previousFailureCount() const { return m_coreAuthenticationChallenge.previousFailureCount(); }
    6064
    6165private:
     
    6872    RefPtr<WebPageProxy> m_page;
    6973    RefPtr<AuthenticationDecisionListener> m_listener;
     74    mutable RefPtr<WebCredential> m_webCredential;
     75    mutable RefPtr<WebProtectionSpace> m_webProtectionSpace;
    7076};
    7177
  • trunk/WebKit2/UIProcess/Authentication/WebCredential.cpp

    r73281 r73614  
    2828namespace WebKit {
    2929
     30WebCredential::WebCredential(const WebCore::Credential& credential)
     31    : m_coreCredential(credential)
     32{
     33}
     34
    3035const WebCore::Credential& WebCredential::core()
    3136{
     
    3338}
    3439
     40const String& WebCredential::user() const
     41{
     42    return m_coreCredential.user();
     43}
     44
    3545} // namespace WebKit
  • trunk/WebKit2/UIProcess/Authentication/WebCredential.h

    r73281 r73614  
    2828
    2929#include "APIObject.h"
     30#include "WebString.h"
     31
    3032#include <WebCore/Credential.h>
    3133#include <wtf/PassRefPtr.h>
     
    3840    static const Type APIType = TypeCredential;
    3941
    40     static PassRefPtr<WebCredential> create()
     42    static PassRefPtr<WebCredential> create(const WebCore::Credential& credential)
    4143    {
    42         return adoptRef(new WebCredential());
     44        return adoptRef(new WebCredential(credential));
     45    }
     46   
     47    static PassRefPtr<WebCredential> create(WebString* username, WebString* password, WebCore::CredentialPersistence persistence)
     48    {
     49        return adoptRef(new WebCredential(WebCore::Credential(username->string(), password->string(), persistence)));
    4350    }
    4451   
    4552    const WebCore::Credential& core();
    4653
     54    const String& user() const;
     55   
    4756private:
    48     WebCredential();
     57    WebCredential(const WebCore::Credential&);
    4958
    5059    virtual Type type() const { return APIType; }
  • trunk/WebKit2/UIProcess/Authentication/WebProtectionSpace.cpp

    r73281 r73614  
    2626#include "WebProtectionSpace.h"
    2727
     28#include <WebCore/SharedBuffer.h>
     29
    2830namespace WebKit {
    2931
     
    3133    : m_coreProtectionSpace(coreProtectionSpace)
    3234{
     35}
    3336
     37const String& WebProtectionSpace::host() const
     38{
     39    return m_coreProtectionSpace.host();
     40}
     41
     42int WebProtectionSpace::port() const
     43{
     44    return m_coreProtectionSpace.port();
     45}
     46
     47const String& WebProtectionSpace::realm() const
     48{
     49    return m_coreProtectionSpace.realm();
     50}
     51
     52bool WebProtectionSpace::isProxy() const
     53{
     54    return m_coreProtectionSpace.isProxy();
     55}
     56
     57WebCore::ProtectionSpaceServerType WebProtectionSpace::serverType() const
     58{
     59    return m_coreProtectionSpace.serverType();
     60}
     61
     62bool WebProtectionSpace::receivesCredentialSecurely() const
     63{
     64    return m_coreProtectionSpace.receivesCredentialSecurely();
     65}
     66
     67WebCore::ProtectionSpaceAuthenticationScheme WebProtectionSpace::authenticationScheme() const
     68{
     69    return m_coreProtectionSpace.authenticationScheme();
    3470}
    3571
  • trunk/WebKit2/UIProcess/Authentication/WebProtectionSpace.h

    r73281 r73614  
    4141        return adoptRef(new WebProtectionSpace(protectionSpace));
    4242    }
     43   
     44    const String& protocol() const;
     45    const String& host() const;
     46    int port() const;
     47    const String& realm() const;
     48    bool isProxy() const;
     49    WebCore::ProtectionSpaceServerType serverType() const;
     50    bool receivesCredentialSecurely() const;
     51    WebCore::ProtectionSpaceAuthenticationScheme authenticationScheme() const;
    4352
    4453private:
  • trunk/WebKit2/UIProcess/WebLoaderClient.cpp

    r73412 r73614  
    153153}
    154154
    155 void WebLoaderClient::didReceiveAuthenticationChallengeInFrame(WebPageProxy* page, WebFrameProxy* frame, AuthenticationChallengeProxy* authenticationChallenge, AuthenticationDecisionListener* listener)
     155void WebLoaderClient::didReceiveAuthenticationChallengeInFrame(WebPageProxy* page, WebFrameProxy* frame, AuthenticationChallengeProxy* authenticationChallenge)
    156156{
    157157    if (!m_client.didReceiveAuthenticationChallengeInFrame)
    158158        return;
    159159
    160     m_client.didReceiveAuthenticationChallengeInFrame(toAPI(page), toAPI(frame), toAPI(authenticationChallenge), toAPI(listener), m_client.clientInfo);
     160    m_client.didReceiveAuthenticationChallengeInFrame(toAPI(page), toAPI(frame), toAPI(authenticationChallenge), m_client.clientInfo);
    161161}
    162162
  • trunk/WebKit2/UIProcess/WebLoaderClient.h

    r73412 r73614  
    6363   
    6464    bool canAuthenticateAgainstProtectionSpaceInFrame(WebPageProxy*, WebFrameProxy*, WebProtectionSpace*);
    65     void didReceiveAuthenticationChallengeInFrame(WebPageProxy*, WebFrameProxy*, AuthenticationChallengeProxy*, AuthenticationDecisionListener*);
     65    void didReceiveAuthenticationChallengeInFrame(WebPageProxy*, WebFrameProxy*, AuthenticationChallengeProxy*);
    6666
    6767    void didStartProgress(WebPageProxy*);
  • trunk/WebKit2/UIProcess/WebPageProxy.cpp

    r73533 r73614  
    15601560    RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, this);
    15611561   
    1562     m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get(), authenticationChallenge->listener());
     1562    m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get());
    15631563}
    15641564
  • trunk/WebKit2/WebKit2.pro

    r73451 r73614  
    276276    UIProcess/API/C/WKContextPrivate.h \
    277277    UIProcess/API/C/WKCredential.h \
     278    UIProcess/API/C/WKCredentialTypes.h \
    278279    UIProcess/API/C/WKDownload.h \
    279280    UIProcess/API/C/WKFrame.h \
     
    288289    UIProcess/API/C/WKPreferencesPrivate.h \
    289290    UIProcess/API/C/WKProtectionSpace.h \
     291    UIProcess/API/C/WKProtectionSpaceTypes.h \
    290292    UIProcess/API/C/WebKit2.h \
    291293    UIProcess/API/C/qt/WKNativeEvent.h \
  • trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r73449 r73614  
    233233                51871B5B127CB89D00F76232 /* WebContextMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51871B59127CB89D00F76232 /* WebContextMenu.cpp */; };
    234234                51871B5C127CB89D00F76232 /* WebContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 51871B5A127CB89D00F76232 /* WebContextMenu.h */; };
     235                518ACAEA12AEE6BB00B04B83 /* WKProtectionSpaceTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 518ACAE912AEE6BB00B04B83 /* WKProtectionSpaceTypes.h */; settings = {ATTRIBUTES = (Public, ); }; };
     236                518ACF1112B015F800B04B83 /* WKCredentialTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 518ACF1012B015F800B04B83 /* WKCredentialTypes.h */; settings = {ATTRIBUTES = (Public, ); }; };
    235237                51A555F5128C6C47009ABCEC /* WKContextMenuItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A555F3128C6C47009ABCEC /* WKContextMenuItem.cpp */; };
    236238                51A555F6128C6C47009ABCEC /* WKContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A555F4128C6C47009ABCEC /* WKContextMenuItem.h */; settings = {ATTRIBUTES = (Public, ); }; };
     
    864866                51871B59127CB89D00F76232 /* WebContextMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenu.cpp; sourceTree = "<group>"; };
    865867                51871B5A127CB89D00F76232 /* WebContextMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenu.h; sourceTree = "<group>"; };
     868                518ACAE912AEE6BB00B04B83 /* WKProtectionSpaceTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProtectionSpaceTypes.h; sourceTree = "<group>"; };
     869                518ACF1012B015F800B04B83 /* WKCredentialTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKCredentialTypes.h; sourceTree = "<group>"; };
    866870                51A555F3128C6C47009ABCEC /* WKContextMenuItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKContextMenuItem.cpp; sourceTree = "<group>"; };
    867871                51A555F4128C6C47009ABCEC /* WKContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextMenuItem.h; sourceTree = "<group>"; };
     
    19051909                                512F58F112A88A5400629530 /* WKCredential.cpp */,
    19061910                                512F58F212A88A5400629530 /* WKCredential.h */,
     1911                                518ACF1012B015F800B04B83 /* WKCredentialTypes.h */,
    19071912                                1AB7D78C1288CD9A00CFD08C /* WKDownload.cpp */,
    19081913                                1AB7D78B1288CD9A00CFD08C /* WKDownload.h */,
     
    19301935                                512F58F312A88A5400629530 /* WKProtectionSpace.cpp */,
    19311936                                512F58F412A88A5400629530 /* WKProtectionSpace.h */,
     1937                                518ACAE912AEE6BB00B04B83 /* WKProtectionSpaceTypes.h */,
    19321938                        );
    19331939                        path = C;
     
    26352641                                F634445612A885C8000612D8 /* WebSecurityOrigin.h in Headers */,
    26362642                                F634445D12A885E9000612D8 /* WKSecurityOrigin.h in Headers */,
     2643                                518ACAEA12AEE6BB00B04B83 /* WKProtectionSpaceTypes.h in Headers */,
     2644                                518ACF1112B015F800B04B83 /* WKCredentialTypes.h in Headers */,
    26372645                                BC2D021712AC41CB00E732A3 /* SameDocumentNavigationType.h in Headers */,
    26382646                                BC2D021912AC426C00E732A3 /* WKPageLoadTypes.h in Headers */,
  • trunk/WebKit2/win/WebKit2.vcproj

    r73449 r73614  
    21262126                                        </File>
    21272127                                        <File
     2128                                                RelativePath="..\UIProcess\API\C\WKCredentialTypes.h"
     2129                                                >
     2130                                        </File>
     2131                                        <File
    21282132                                                RelativePath="..\UIProcess\API\C\WKDownload.cpp"
    21292133                                                >
     
    22232227                                        <File
    22242228                                                RelativePath="..\UIProcess\API\C\WKProtectionSpace.h"
     2229                                                >
     2230                                        </File>
     2231                                        <File
     2232                                                RelativePath="..\UIProcess\API\C\WKProtectionSpaceTypes.h"
    22252233                                                >
    22262234                                        </File>
  • trunk/WebKit2/win/WebKit2Generated.make

    r73412 r73614  
    4141    xcopy /y /d "..\UIProcess\API\C\WKContextPrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    4242    xcopy /y /d "..\UIProcess\API\C\WKCredential.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     43    xcopy /y /d "..\UIProcess\API\C\WKCredentialTypes.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    4344    xcopy /y /d "..\UIProcess\API\C\WKDownload.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    4445    xcopy /y /d "..\UIProcess\API\C\WKFormSubmissionListener.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     
    5455    xcopy /y /d "..\UIProcess\API\C\WKPreferencesPrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    5556    xcopy /y /d "..\UIProcess\API\C\WKProtectionSpace.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     57    xcopy /y /d "..\UIProcess\API\C\WKProtectionSpaceTypes.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    5658    xcopy /y /d "..\UIProcess\API\C\win\WKContextPrivateWin.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    5759    xcopy /y /d "..\UIProcess\API\C\win\WKView.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
Note: See TracChangeset for help on using the changeset viewer.