Commit 67dc2b25 authored by beidson@apple.com's avatar beidson@apple.com

<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:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73614 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ea4caf4e
2010-12-09 Brady Eidson <beidson@apple.com>
Reviewed by Maciej Stachowiak.
<rdar://problem/7660733> and https://bugs.webkit.org/show_bug.cgi?id=50191
WebKit2 Authentication Support
* WebCore.exp.in:
2010-12-09 Peter Beverloo <peter@lvp-media.com>
Reviewed by Maciej Stachowiak.
......
......@@ -137,6 +137,7 @@ __ZN3JSC8Bindings8Instance16newRuntimeObjectEPNS_9ExecStateE
__ZN3WTF10StringImplcvP8NSStringEv
__ZN3WTF6StringC1EP8NSString
__ZN3WTF6StringC1EPK10__CFString
__ZN7WebCore10CredentialC1ERKN3WTF6StringES4_NS_21CredentialPersistenceE
__ZN7WebCore10CredentialC1Ev
__ZN7WebCore10JSDocument6s_infoE
__ZN7WebCore10MouseEventC1ERKN3WTF12AtomicStringEbbNS1_10PassRefPtrINS_9DOMWindowEEEiiiiibbbbtNS5_INS_11EventTargetEEENS5_INS_9ClipboardEEEb
......@@ -371,6 +372,7 @@ __ZN7WebCore15GraphicsContext9translateEff
__ZN7WebCore15GraphicsContextC1EP9CGContext
__ZN7WebCore15GraphicsContextD1Ev
__ZN7WebCore15JSDOMWindowBase18commonJSGlobalDataEv
__ZN7WebCore15ProtectionSpaceC1ERKN3WTF6StringEiNS_25ProtectionSpaceServerTypeES4_NS_35ProtectionSpaceAuthenticationSchemeE
__ZN7WebCore15ProtectionSpaceC1Ev
__ZN7WebCore15ScrollAlignment17alignCenterAlwaysE
__ZN7WebCore15ScrollAlignment19alignToEdgeIfNeededE
......@@ -507,6 +509,7 @@ __ZN7WebCore22contextMenuItemTagBoldEv
__ZN7WebCore22counterValueForElementEPNS_7ElementE
__ZN7WebCore22createFragmentFromTextEPNS_5RangeERKN3WTF6StringE
__ZN7WebCore22externalRepresentationEPNS_5FrameEj
__ZN7WebCore23AuthenticationChallengeC1ERKNS_15ProtectionSpaceERKNS_10CredentialEjRKNS_16ResourceResponseERKNS_13ResourceErrorE
__ZN7WebCore23ReplaceSelectionCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_16DocumentFragmentEEEbbbbbNS_10EditActionE
__ZN7WebCore23createFragmentFromNodesEPNS_8DocumentERKN3WTF6VectorIPNS_4NodeELm0EEE
__ZN7WebCore23overrideDefaultLanguageERKN3WTF6StringE
......@@ -914,6 +917,9 @@ __ZN7WebCore9plainTextEPKNS_5RangeENS_20TextIteratorBehaviorE
__ZN7WebCore9toElementEN3JSC7JSValueE
__ZNK3JSC8Bindings10RootObject12globalObjectEv
__ZNK3WTF6String14createCFStringEv
__ZNK7WebCore10Credential11persistenceEv
__ZNK7WebCore10Credential4userEv
__ZNK7WebCore10Credential8passwordEv
__ZNK7WebCore10FloatPointcv8_NSPointEv
__ZNK7WebCore10PluginData16supportsMimeTypeERKN3WTF6StringE
__ZNK7WebCore10RenderText16linesBoundingBoxEv
......@@ -1013,6 +1019,12 @@ __ZNK7WebCore15FocusController18focusedOrMainFrameEv
__ZNK7WebCore15GraphicsContext15platformContextEv
__ZNK7WebCore15GraphicsContext16paintingDisabledEv
__ZNK7WebCore15ProgressTracker17estimatedProgressEv
__ZNK7WebCore15ProtectionSpace10serverTypeEv
__ZNK7WebCore15ProtectionSpace26receivesCredentialSecurelyEv
__ZNK7WebCore15ProtectionSpace4hostEv
__ZNK7WebCore15ProtectionSpace4portEv
__ZNK7WebCore15ProtectionSpace5realmEv
__ZNK7WebCore15ProtectionSpace7isProxyEv
__ZNK7WebCore15ResourceRequest12nsURLRequestEv
__ZNK7WebCore15VisiblePosition14characterAfterEv
__ZNK7WebCore15VisiblePosition14localCaretRectERPNS_12RenderObjectE
......@@ -1058,6 +1070,11 @@ __ZNK7WebCore23AuthenticationChallenge20authenticationClientEv
__ZNK7WebCore23FrameLoaderStateMachine15firstLayoutDoneEv
__ZNK7WebCore23FrameLoaderStateMachine23committingFirstRealLoadEv
__ZNK7WebCore26NetscapePlugInStreamLoader6isDoneEv
__ZNK7WebCore27AuthenticationChallengeBase15failureResponseEv
__ZNK7WebCore27AuthenticationChallengeBase15protectionSpaceEv
__ZNK7WebCore27AuthenticationChallengeBase18proposedCredentialEv
__ZNK7WebCore27AuthenticationChallengeBase20previousFailureCountEv
__ZNK7WebCore27AuthenticationChallengeBase5errorEv
__ZNK7WebCore27AuthenticationChallengeBase6isNullEv
__ZNK7WebCore4Font10floatWidthERKNS_7TextRunEPN3WTF7HashSetIPKNS_14SimpleFontDataENS4_7PtrHashIS8_EENS4_10HashTraitsIS8_EEEEPNS_13GlyphOverflowE
__ZNK7WebCore4Font8drawTextEPNS_15GraphicsContextERKNS_7TextRunERKNS_10FloatPointEii
......
2010-12-09 Brady Eidson <beidson@apple.com>
Reviewed by Maciej Stachowiak.
<rdar://problem/7660733> and https://bugs.webkit.org/show_bug.cgi?id=50191
WebKit2 Authentication Support
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:
2010-12-08 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey "Error" Garen.
......@@ -115,25 +115,45 @@ template<> struct ArgumentCoder<WebCore::HTTPHeaderMap> {
template<> struct ArgumentCoder<WebCore::AuthenticationChallenge> {
static void encode(ArgumentEncoder* encoder, const WebCore::AuthenticationChallenge& challenge)
{
// FIXME: Implement
encoder->encode(CoreIPC::In(challenge.protectionSpace(), challenge.proposedCredential(), challenge.previousFailureCount(), challenge.failureResponse(), challenge.error()));
}
static bool decode(ArgumentDecoder* decoder, WebCore::AuthenticationChallenge& credential)
{
// FIXME: Implement
static bool decode(ArgumentDecoder* decoder, WebCore::AuthenticationChallenge& challenge)
{
WebCore::ProtectionSpace protectionSpace;
WebCore::Credential proposedCredential;
unsigned previousFailureCount;
WebCore::ResourceResponse failureResponse;
WebCore::ResourceError error;
if (!decoder->decode(CoreIPC::Out(protectionSpace, proposedCredential, previousFailureCount, failureResponse, error)))
return false;
challenge = WebCore::AuthenticationChallenge(protectionSpace, proposedCredential, previousFailureCount, failureResponse, error);
return true;
}
};
template<> struct ArgumentCoder<WebCore::ProtectionSpace> {
static void encode(ArgumentEncoder* encoder, const WebCore::ProtectionSpace& challenge)
static void encode(ArgumentEncoder* encoder, const WebCore::ProtectionSpace& space)
{
// FIXME: Implement
encoder->encode(CoreIPC::In(space.host(), space.port(), static_cast<uint32_t>(space.serverType()), space.realm(), static_cast<uint32_t>(space.authenticationScheme())));
}
static bool decode(ArgumentDecoder* decoder, WebCore::ProtectionSpace& credential)
static bool decode(ArgumentDecoder* decoder, WebCore::ProtectionSpace& space)
{
// FIXME: Implement
String host;
int port;
uint32_t serverType;
String realm;
uint32_t authenticationScheme;
if (!decoder->decode(CoreIPC::Out(host, port, serverType, realm, authenticationScheme)))
return false;
space = WebCore::ProtectionSpace(host, port, static_cast<WebCore::ProtectionSpaceServerType>(serverType), realm, static_cast<WebCore::ProtectionSpaceAuthenticationScheme>(authenticationScheme));
return true;
}
};
......@@ -141,12 +161,18 @@ template<> struct ArgumentCoder<WebCore::ProtectionSpace> {
template<> struct ArgumentCoder<WebCore::Credential> {
static void encode(ArgumentEncoder* encoder, const WebCore::Credential& credential)
{
// FIXME: Implement
encoder->encode(CoreIPC::In(credential.user(), credential.password(), static_cast<uint32_t>(credential.persistence())));
}
static bool decode(ArgumentDecoder* decoder, WebCore::Credential& credential)
{
// FIXME: Implement
String user;
String password;
int persistence;
if (!decoder->decode(CoreIPC::Out(user, password, persistence)))
return false;
credential = WebCore::Credential(user, password, static_cast<WebCore::CredentialPersistence>(persistence));
return true;
}
};
......
......@@ -60,16 +60,26 @@ bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& r
void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceResponse& resourceResponse)
{
bool responseIsPresent = resourceResponse.nsURLResponse();
encoder->encode(responseIsPresent);
// FIXME: <rdar://problem/8741799> - We can't use NSKeyedArchiver here.
encodeWithNSKeyedArchiver(encoder, resourceResponse.nsURLResponse());
}
bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse& resourceResponse)
{
bool responseIsPresent;
decoder->decode(responseIsPresent);
// FIXME: <rdar://problem/8741799> - We can't use NSKeyedArchiver here.
NSURLResponse *nsURLResponse = decodeWithNSKeyedArchiver(decoder);
if (!nsURLResponse)
if (responseIsPresent && !nsURLResponse)
return false;
resourceResponse = WebCore::ResourceResponse(nsURLResponse);
if (responseIsPresent)
resourceResponse = WebCore::ResourceResponse(nsURLResponse);
return true;
}
......
......@@ -29,9 +29,14 @@
#include "CacheModel.h"
#include "FontSmoothingLevel.h"
#include "WKContext.h"
#include "WKCredentialTypes.h"
#include "WKPage.h"
#include "WKPreferencesPrivate.h"
#include "WKProtectionSpaceTypes.h"
#include "WKSharedAPICast.h"
#include <WebCore/Credential.h>
#include <WebCore/FrameLoaderTypes.h>
#include <WebCore/ProtectionSpace.h>
namespace WebKit {
......@@ -147,6 +152,67 @@ inline WKFontSmoothingLevel toAPI(FontSmoothingLevel level)
return kWKFontSmoothingLevelMedium;
}
inline WKProtectionSpaceServerType toAPI(WebCore::ProtectionSpaceServerType type)
{
switch (type) {
case WebCore::ProtectionSpaceServerHTTP:
return kWKProtectionSpaceServerTypeHTTP;
case WebCore::ProtectionSpaceServerHTTPS:
return kWKProtectionSpaceServerTypeHTTPS;
case WebCore::ProtectionSpaceServerFTP:
return kWKProtectionSpaceServerTypeFTP;
case WebCore::ProtectionSpaceServerFTPS:
return kWKProtectionSpaceServerTypeFTPS;
case WebCore::ProtectionSpaceProxyHTTP:
return kWKProtectionSpaceProxyTypeHTTP;
case WebCore::ProtectionSpaceProxyHTTPS:
return kWKProtectionSpaceProxyTypeHTTPS;
case WebCore::ProtectionSpaceProxyFTP:
return kWKProtectionSpaceProxyTypeFTP;
case WebCore::ProtectionSpaceProxySOCKS:
return kWKProtectionSpaceProxyTypeSOCKS;
}
return kWKProtectionSpaceServerTypeHTTP;
}
inline WKProtectionSpaceAuthenticationScheme toAPI(WebCore::ProtectionSpaceAuthenticationScheme type)
{
switch (type) {
case WebCore::ProtectionSpaceAuthenticationSchemeDefault:
return kWKProtectionSpaceAuthenticationSchemeDefault;
case WebCore::ProtectionSpaceAuthenticationSchemeHTTPBasic:
return kWKProtectionSpaceAuthenticationSchemeHTTPBasic;
case WebCore::ProtectionSpaceAuthenticationSchemeHTTPDigest:
return kWKProtectionSpaceAuthenticationSchemeHTTPDigest;
case WebCore::ProtectionSpaceAuthenticationSchemeHTMLForm:
return kWKProtectionSpaceAuthenticationSchemeHTMLForm;
case WebCore::ProtectionSpaceAuthenticationSchemeNTLM:
return kWKProtectionSpaceAuthenticationSchemeNTLM;
case WebCore::ProtectionSpaceAuthenticationSchemeNegotiate:
return kWKProtectionSpaceAuthenticationSchemeNegotiate;
case WebCore::ProtectionSpaceAuthenticationSchemeClientCertificateRequested:
return kWKProtectionSpaceAuthenticationSchemeClientCertificateRequested;
case WebCore::ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested:
return kWKProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested;
default:
return kWKProtectionSpaceAuthenticationSchemeUnknown;
}
}
inline WebCore::CredentialPersistence toCredentialPersistence(WKCredentialPersistence type)
{
switch (type) {
case kWKCredentialPersistenceNone:
return WebCore::CredentialPersistenceNone;
case kWKCredentialPersistenceForSession:
return WebCore::CredentialPersistenceForSession;
case kWKCredentialPersistencePermanent:
return WebCore::CredentialPersistencePermanent;
default:
return WebCore::CredentialPersistenceNone;
}
}
} // namespace WebKit
#if defined(WIN32) || defined(_WIN32)
......
......@@ -26,6 +26,8 @@
#include "WKAuthenticationChallenge.h"
#include "AuthenticationChallengeProxy.h"
#include "WebCredential.h"
#include "WebProtectionSpace.h"
#include "WKAPICast.h"
using namespace WebKit;
......@@ -34,3 +36,23 @@ WKTypeID WKAuthenticationChallengeGetTypeID()
{
return toAPI(AuthenticationChallengeProxy::APIType);
}
WKAuthenticationDecisionListenerRef WKAuthenticationChallengeGetDecisionListener(WKAuthenticationChallengeRef challenge)
{
return toAPI(toImpl(challenge)->listener());
}
WKProtectionSpaceRef WKAuthenticationChallengeGetProtectionSpace(WKAuthenticationChallengeRef challenge)
{
return toAPI(toImpl(challenge)->protectionSpace());
}
WKCredentialRef WKAuthenticationChallengeGetProposedCredential(WKAuthenticationChallengeRef challenge)
{
return toAPI(toImpl(challenge)->proposedCredential());
}
int WKAuthenticationChallengeGetPreviousFailureCount(WKAuthenticationChallengeRef challenge)
{
return toImpl(challenge)->previousFailureCount();
}
......@@ -34,6 +34,11 @@ extern "C" {
WK_EXPORT WKTypeID WKAuthenticationChallengeGetTypeID();
WK_EXPORT WKAuthenticationDecisionListenerRef WKAuthenticationChallengeGetDecisionListener(WKAuthenticationChallengeRef);
WK_EXPORT WKProtectionSpaceRef WKAuthenticationChallengeGetProtectionSpace(WKAuthenticationChallengeRef);
WK_EXPORT WKCredentialRef WKAuthenticationChallengeGetProposedCredential(WKAuthenticationChallengeRef);
WK_EXPORT int WKAuthenticationChallengeGetPreviousFailureCount(WKAuthenticationChallengeRef);
#ifdef __cplusplus
}
#endif
......
......@@ -26,6 +26,7 @@
#include "WKCredential.h"
#include "WebCredential.h"
#include "WebString.h"
#include "WKAPICast.h"
using namespace WebKit;
......@@ -34,3 +35,15 @@ WKTypeID WKCredentialGetTypeID()
{
return toAPI(WebCredential::APIType);
}
WKCredentialRef WKCredentialCreate(WKStringRef username, WKStringRef password, WKCredentialPersistence persistence)
{
RefPtr<WebCredential> credential = WebCredential::create(toImpl(username), toImpl(password), toCredentialPersistence(persistence));
return toAPI(credential.release().releaseRef());
}
WKStringRef WKCredentialCopyUser(WKCredentialRef credentialRef)
{
return toCopiedAPI(toImpl(credentialRef)->user());
}
......@@ -27,6 +27,7 @@
#define WKCredential_h
#include <WebKit2/WKBase.h>
#include <WebKit2/WKCredentialTypes.h>
#ifdef __cplusplus
extern "C" {
......@@ -34,6 +35,9 @@ extern "C" {
WK_EXPORT WKTypeID WKCredentialGetTypeID();
WK_EXPORT WKCredentialRef WKCredentialCreate(WKStringRef username, WKStringRef password, WKCredentialPersistence);
WK_EXPORT WKStringRef WKCredentialCopyUser(WKCredentialRef);
#ifdef __cplusplus
}
#endif
......
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WKCredentialTypes_h
#define WKCredentialTypes_h
#ifdef __cplusplus
extern "C" {
#endif
enum {
kWKCredentialPersistenceNone,
kWKCredentialPersistenceForSession,
kWKCredentialPersistencePermanent
};
typedef uint32_t WKCredentialPersistence;
#ifdef __cplusplus
}
#endif
#endif /* WKCredentialTypes_h */
......@@ -57,7 +57,7 @@ typedef void (*WKPageDidRemoveFrameFromHierarchyCallback)(WKPageRef page, WKFram
typedef void (*WKPageDidDisplayInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
typedef void (*WKPageDidRunInsecureContentForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
typedef bool (*WKPageCanAuthenticateAgainstProtectionSpaceInFrameCallback)(WKPageRef page, WKFrameRef frame, WKProtectionSpaceRef protectionSpace, const void *clientInfo);
typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, WKAuthenticationDecisionListenerRef listener, const void *clientInfo);
typedef void (*WKPageDidReceiveAuthenticationChallengeInFrameCallback)(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo);
// Progress Client
typedef void (*WKPageDidStartProgressCallback)(WKPageRef page, const void *clientInfo);
......
......@@ -34,3 +34,38 @@ WKTypeID WKProtectionSpaceGetTypeID()
{
return toAPI(WebProtectionSpace::APIType);
}
WKStringRef WKProtectionSpaceCopyHost(WKProtectionSpaceRef protectionSpaceRef)
{
return toCopiedAPI(toImpl(protectionSpaceRef)->host());
}
int WKProtectionSpaceGetPort(WKProtectionSpaceRef protectionSpaceRef)
{
return toImpl(protectionSpaceRef)->port();
}
WKStringRef WKProtectionSpaceCopyRealm(WKProtectionSpaceRef protectionSpaceRef)
{
return toCopiedAPI(toImpl(protectionSpaceRef)->realm());
}
bool WKProtectionSpaceGetIsProxy(WKProtectionSpaceRef protectionSpaceRef)
{
return toImpl(protectionSpaceRef)->isProxy();
}
WKProtectionSpaceServerType WKProtectionSpaceGetServerType(WKProtectionSpaceRef protectionSpaceRef)
{
return toAPI(toImpl(protectionSpaceRef)->serverType());
}
bool WKProtectionSpaceGetReceivesCredentialSecurely(WKProtectionSpaceRef protectionSpaceRef)
{
return toImpl(protectionSpaceRef)->receivesCredentialSecurely();
}
WKProtectionSpaceAuthenticationScheme WKProtectionSpaceGetAuthenticationScheme(WKProtectionSpaceRef protectionSpaceRef)
{
return toAPI(toImpl(protectionSpaceRef)->authenticationScheme());
}
......@@ -27,6 +27,7 @@
#define WKProtectionSpace_h
#include <WebKit2/WKBase.h>
#include <WebKit2/WKProtectionSpaceTypes.h>
#ifdef __cplusplus
extern "C" {
......@@ -34,6 +35,14 @@ extern "C" {
WK_EXPORT WKTypeID WKProtectionSpaceGetTypeID();
WK_EXPORT WKStringRef WKProtectionSpaceCopyHost(WKProtectionSpaceRef);
WK_EXPORT int WKProtectionSpaceGetPort(WKProtectionSpaceRef);
WK_EXPORT WKStringRef WKProtectionSpaceCopyRealm(WKProtectionSpaceRef);
WK_EXPORT bool WKProtectionSpaceGetIsProxy(WKProtectionSpaceRef);
WK_EXPORT WKProtectionSpaceServerType WKProtectionSpaceGetServerType(WKProtectionSpaceRef);
WK_EXPORT bool WKProtectionSpaceGetReceivesCredentialSecurely(WKProtectionSpaceRef);
WK_EXPORT WKProtectionSpaceAuthenticationScheme WKProtectionSpaceGetAuthenticationScheme(WKProtectionSpaceRef);
#ifdef __cplusplus
}
#endif
......
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WKProtectionSpaceTypes_h
#define WKProtectionSpaceTypes_h
#include <WebKit2/WKBase.h>
#ifdef __cplusplus
extern "C" {
#endif
enum {
kWKProtectionSpaceServerTypeHTTP = 1,
kWKProtectionSpaceServerTypeHTTPS,
kWKProtectionSpaceServerTypeFTP,
kWKProtectionSpaceServerTypeFTPS,
kWKProtectionSpaceProxyTypeHTTP,
kWKProtectionSpaceProxyTypeHTTPS,
kWKProtectionSpaceProxyTypeFTP,
kWKProtectionSpaceProxyTypeSOCKS,
};
typedef uint32_t WKProtectionSpaceServerType;
enum {
kWKProtectionSpaceAuthenticationSchemeDefault = 1,
kWKProtectionSpaceAuthenticationSchemeHTTPBasic,
kWKProtectionSpaceAuthenticationSchemeHTTPDigest,
kWKProtectionSpaceAuthenticationSchemeHTMLForm,
kWKProtectionSpaceAuthenticationSchemeNTLM,
kWKProtectionSpaceAuthenticationSchemeNegotiate,
kWKProtectionSpaceAuthenticationSchemeClientCertificateRequested,
kWKProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested,
kWKProtectionSpaceAuthenticationSchemeUnknown = 100,
};
typedef uint32_t WKProtectionSpaceAuthenticationScheme;
#ifdef __cplusplus
}
#endif
#endif // WKProtectionSpaceTypes_h
......@@ -31,6 +31,7 @@
#include "WebCredential.h"
#include "WebPageProxy.h"
#include "WebProcessProxy.h"
#include "WebProtectionSpace.h"
namespace WebKit {
......@@ -47,7 +48,7 @@ AuthenticationChallengeProxy::~AuthenticationChallengeProxy()
{
// If an outstanding AuthenticationChallengeProxy is being destroyed even though it hasn't been responded to yet,
// we cancel it here so the WebProcess isn't waiting for an answer forever.
if (m_challengeID)
if (m_challengeID && m_page->process())
m_page->process()->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), m_page->pageID());