本文整理汇总了C++中ProtectionSpace::authenticationScheme方法的典型用法代码示例。如果您正苦于以下问题:C++ ProtectionSpace::authenticationScheme方法的具体用法?C++ ProtectionSpace::authenticationScheme怎么用?C++ ProtectionSpace::authenticationScheme使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProtectionSpace
的用法示例。
在下文中一共展示了ProtectionSpace::authenticationScheme方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: protectionSpaceToPlatformAuth
void protectionSpaceToPlatformAuth(const ProtectionSpace& protectionSpace, NetworkRequest::AuthType& authType, NetworkRequest::AuthProtocol& authProtocol, NetworkRequest::AuthScheme& authScheme)
{
authScheme = NetworkRequest::AuthSchemeNone;
switch (protectionSpace.authenticationScheme()) {
case ProtectionSpaceAuthenticationSchemeDefault:
authScheme = NetworkRequest::AuthSchemeDefault;
break;
case ProtectionSpaceAuthenticationSchemeHTTPBasic:
authScheme = NetworkRequest::AuthSchemeHTTPBasic;
break;
case ProtectionSpaceAuthenticationSchemeHTTPDigest:
authScheme = NetworkRequest::AuthSchemeHTTPDigest;
break;
case ProtectionSpaceAuthenticationSchemeNegotiate:
authScheme = NetworkRequest::AuthSchemeNegotiate;
break;
case ProtectionSpaceAuthenticationSchemeNTLM:
authScheme = NetworkRequest::AuthSchemeNTLM;
break;
default:
ASSERT_NOT_REACHED();
break;
}
authType = NetworkRequest::AuthTypeNone;
authProtocol = NetworkRequest::AuthProtocolNone;
switch (protectionSpace.serverType()) {
case ProtectionSpaceServerHTTP:
authType = NetworkRequest::AuthTypeHost;
authProtocol = NetworkRequest::AuthProtocolHTTP;
break;
case ProtectionSpaceServerHTTPS:
authType = NetworkRequest::AuthTypeHost;
authProtocol = NetworkRequest::AuthProtocolHTTPS;
break;
case ProtectionSpaceServerFTP:
authType = NetworkRequest::AuthTypeHost;
authProtocol = NetworkRequest::AuthProtocolFTP;
break;
case ProtectionSpaceServerFTPS:
authType = NetworkRequest::AuthTypeHost;
authProtocol = NetworkRequest::AuthProtocolFTPS;
break;
case ProtectionSpaceProxyHTTP:
authType = NetworkRequest::AuthTypeProxy;
authProtocol = NetworkRequest::AuthProtocolHTTP;
break;
case ProtectionSpaceProxyHTTPS:
authType = NetworkRequest::AuthTypeProxy;
authProtocol = NetworkRequest::AuthProtocolHTTPS;
break;
case ProtectionSpaceProxyFTP:
authType = NetworkRequest::AuthTypeProxy;
authProtocol = NetworkRequest::AuthProtocolFTP;
break;
default:
ASSERT_NOT_REACHED();
break;
}
}
示例2:
bool operator==(const ProtectionSpace& a, const ProtectionSpace& b)
{
if (a.host() != b.host())
return false;
if (a.port() != b.port())
return false;
if (a.serverType() != b.serverType())
return false;
// Ignore realm for proxies
if (!a.isProxy() && a.realm() != b.realm())
return false;
if (a.authenticationScheme() != b.authenticationScheme())
return false;
return true;
}
示例3: saveCredentialToPersistentStorage
void NetworkStorageSession::saveCredentialToPersistentStorage(const ProtectionSpace& protectionSpace, const Credential& credential)
{
#if USE(LIBSECRET)
if (m_sessionID.isEphemeral())
return;
if (credential.isEmpty())
return;
const String& realm = protectionSpace.realm();
if (realm.isEmpty())
return;
GRefPtr<GHashTable> attributes = adoptGRef(secret_attributes_build(SECRET_SCHEMA_COMPAT_NETWORK,
"domain", realm.utf8().data(),
"server", protectionSpace.host().utf8().data(),
"port", protectionSpace.port(),
"protocol", schemeFromProtectionSpaceServerType(protectionSpace.serverType()),
"authtype", authTypeFromProtectionSpaceAuthenticationScheme(protectionSpace.authenticationScheme()),
nullptr));
if (!attributes)
return;
g_hash_table_insert(attributes.get(), g_strdup("user"), g_strdup(credential.user().utf8().data()));
CString utf8Password = credential.password().utf8();
GRefPtr<SecretValue> newSecretValue = adoptGRef(secret_value_new(utf8Password.data(), utf8Password.length(), "text/plain"));
secret_service_store(nullptr, SECRET_SCHEMA_COMPAT_NETWORK, attributes.get(), SECRET_COLLECTION_DEFAULT, _("WebKitGTK+ password"),
newSecretValue.get(), nullptr, nullptr, nullptr);
#else
UNUSED_PARAM(protectionSpace);
UNUSED_PARAM(credential);
#endif
}
示例4: set
void CredentialStorage::set(const Credential& credential, const ProtectionSpace& protectionSpace, const URL& url)
{
ASSERT(protectionSpace.isProxy() || protectionSpace.authenticationScheme() == ProtectionSpaceAuthenticationSchemeClientCertificateRequested || url.protocolIsInHTTPFamily());
ASSERT(protectionSpace.isProxy() || protectionSpace.authenticationScheme() == ProtectionSpaceAuthenticationSchemeClientCertificateRequested || url.isValid());
m_protectionSpaceToCredentialMap.set(protectionSpace, credential);
#if PLATFORM(IOS)
if (protectionSpace.authenticationScheme() != ProtectionSpaceAuthenticationSchemeClientCertificateRequested)
saveToPersistentStorage(protectionSpace, credential);
#endif
if (!protectionSpace.isProxy() && protectionSpace.authenticationScheme() != ProtectionSpaceAuthenticationSchemeClientCertificateRequested) {
m_originsWithCredentials.add(originStringFromURL(url));
ProtectionSpaceAuthenticationScheme scheme = protectionSpace.authenticationScheme();
if (scheme == ProtectionSpaceAuthenticationSchemeHTTPBasic || scheme == ProtectionSpaceAuthenticationSchemeDefault) {
// The map can contain both a path and its subpath - while redundant, this makes lookups faster.
m_pathToDefaultProtectionSpaceMap.set(protectionSpaceMapKeyFromURL(url), protectionSpace);
}
}
}
示例5: canRespondToProtectionSpace
Boolean SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace(CFURLProtectionSpaceRef protectionSpace)
{
ASSERT(m_handle);
LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace(handle=%p (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
#if PLATFORM(IOS)
ProtectionSpace coreProtectionSpace = ProtectionSpace(protectionSpace);
if (coreProtectionSpace.authenticationScheme() == ProtectionSpaceAuthenticationSchemeUnknown)
return false;
return m_handle->canAuthenticateAgainstProtectionSpace(coreProtectionSpace);
#else
return m_handle->canAuthenticateAgainstProtectionSpace(core(protectionSpace));
#endif
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:15,代码来源:SynchronousResourceHandleCFURLConnectionDelegate.cpp
示例6: set
void CredentialStorage::set(const Credential& credential, const ProtectionSpace& protectionSpace, const KURL& url)
{
ASSERT(protectionSpace.isProxy() || url.protocolIsInHTTPFamily());
ASSERT(protectionSpace.isProxy() || url.isValid());
protectionSpaceToCredentialMap().set(protectionSpace, credential);
if (!protectionSpace.isProxy()) {
originsWithCredentials().add(originStringFromURL(url));
ProtectionSpaceAuthenticationScheme scheme = protectionSpace.authenticationScheme();
if (scheme == ProtectionSpaceAuthenticationSchemeHTTPBasic || scheme == ProtectionSpaceAuthenticationSchemeDefault) {
// The map can contain both a path and its subpath - while redundant, this makes lookups faster.
pathToDefaultProtectionSpaceMap().set(protectionSpaceMapKeyFromURL(url), protectionSpace);
}
}
}
示例7: canAuthenticateAgainstProtectionSpaceAsync
void NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle* handle, const ProtectionSpace& protectionSpace)
{
ASSERT(RunLoop::isMain());
ASSERT_UNUSED(handle, handle == m_handle);
// Handle server trust evaluation at platform-level if requested, for performance reasons.
if (protectionSpace.authenticationScheme() == ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested
&& !NetworkProcess::shared().canHandleHTTPSServerTrustEvaluation()) {
continueCanAuthenticateAgainstProtectionSpace(false);
return;
}
if (isSynchronous()) {
// FIXME: We should ask the WebProcess like the asynchronous case below does.
// This is currently impossible as the WebProcess is blocked waiting on this synchronous load.
// It's possible that we can jump straight to the UI process to resolve this.
continueCanAuthenticateAgainstProtectionSpace(true);
return;
}
sendAbortingOnFailure(Messages::WebResourceLoader::CanAuthenticateAgainstProtectionSpace(protectionSpace));
}
示例8: createCF
CFURLProtectionSpaceRef createCF(const ProtectionSpace& coreSpace)
{
CFURLProtectionSpaceServerType serverType = kCFURLProtectionSpaceServerHTTP;
switch (coreSpace.serverType()) {
case ProtectionSpaceServerHTTP:
serverType = kCFURLProtectionSpaceServerHTTP;
break;
case ProtectionSpaceServerHTTPS:
serverType = kCFURLProtectionSpaceServerHTTPS;
break;
case ProtectionSpaceServerFTP:
serverType = kCFURLProtectionSpaceServerFTP;
break;
case ProtectionSpaceServerFTPS:
serverType = kCFURLProtectionSpaceServerFTPS;
break;
case ProtectionSpaceProxyHTTP:
serverType = kCFURLProtectionSpaceProxyHTTP;
break;
case ProtectionSpaceProxyHTTPS:
serverType = kCFURLProtectionSpaceProxyHTTPS;
break;
case ProtectionSpaceProxyFTP:
serverType = kCFURLProtectionSpaceProxyFTP;
break;
case ProtectionSpaceProxySOCKS:
serverType = kCFURLProtectionSpaceProxySOCKS;
break;
default:
ASSERT_NOT_REACHED();
}
CFURLProtectionSpaceAuthenticationScheme scheme = kCFURLProtectionSpaceAuthenticationSchemeDefault;
switch (coreSpace.authenticationScheme()) {
case ProtectionSpaceAuthenticationSchemeDefault:
scheme = kCFURLProtectionSpaceAuthenticationSchemeDefault;
break;
case ProtectionSpaceAuthenticationSchemeHTTPBasic:
scheme = kCFURLProtectionSpaceAuthenticationSchemeHTTPBasic;
break;
case ProtectionSpaceAuthenticationSchemeHTTPDigest:
scheme = kCFURLProtectionSpaceAuthenticationSchemeHTTPDigest;
break;
case ProtectionSpaceAuthenticationSchemeHTMLForm:
scheme = kCFURLProtectionSpaceAuthenticationSchemeHTMLForm;
break;
case ProtectionSpaceAuthenticationSchemeNTLM:
scheme = kCFURLProtectionSpaceAuthenticationSchemeNTLM;
break;
case ProtectionSpaceAuthenticationSchemeNegotiate:
scheme = kCFURLProtectionSpaceAuthenticationSchemeNegotiate;
break;
default:
ASSERT_NOT_REACHED();
}
CFStringRef host = coreSpace.host().createCFString();
CFStringRef realm = coreSpace.realm().createCFString();
CFURLProtectionSpaceRef result = CFURLProtectionSpaceCreate(0, host, coreSpace.port(), serverType, realm, scheme);
CFRelease(host);
CFRelease(realm);
return result;
}
示例9: createCF
CFURLProtectionSpaceRef createCF(const ProtectionSpace& coreSpace)
{
CFURLProtectionSpaceServerType serverType = kCFURLProtectionSpaceServerHTTP;
switch (coreSpace.serverType()) {
case ProtectionSpaceServerHTTP:
serverType = kCFURLProtectionSpaceServerHTTP;
break;
case ProtectionSpaceServerHTTPS:
serverType = kCFURLProtectionSpaceServerHTTPS;
break;
case ProtectionSpaceServerFTP:
serverType = kCFURLProtectionSpaceServerFTP;
break;
case ProtectionSpaceServerFTPS:
serverType = kCFURLProtectionSpaceServerFTPS;
break;
case ProtectionSpaceProxyHTTP:
serverType = kCFURLProtectionSpaceProxyHTTP;
break;
case ProtectionSpaceProxyHTTPS:
serverType = kCFURLProtectionSpaceProxyHTTPS;
break;
case ProtectionSpaceProxyFTP:
serverType = kCFURLProtectionSpaceProxyFTP;
break;
case ProtectionSpaceProxySOCKS:
serverType = kCFURLProtectionSpaceProxySOCKS;
break;
default:
ASSERT_NOT_REACHED();
}
CFURLProtectionSpaceAuthenticationScheme scheme = kCFURLProtectionSpaceAuthenticationSchemeDefault;
switch (coreSpace.authenticationScheme()) {
case ProtectionSpaceAuthenticationSchemeDefault:
scheme = kCFURLProtectionSpaceAuthenticationSchemeDefault;
break;
case ProtectionSpaceAuthenticationSchemeHTTPBasic:
scheme = kCFURLProtectionSpaceAuthenticationSchemeHTTPBasic;
break;
case ProtectionSpaceAuthenticationSchemeHTTPDigest:
scheme = kCFURLProtectionSpaceAuthenticationSchemeHTTPDigest;
break;
case ProtectionSpaceAuthenticationSchemeHTMLForm:
scheme = kCFURLProtectionSpaceAuthenticationSchemeHTMLForm;
break;
case ProtectionSpaceAuthenticationSchemeNTLM:
scheme = kCFURLProtectionSpaceAuthenticationSchemeNTLM;
break;
case ProtectionSpaceAuthenticationSchemeNegotiate:
scheme = kCFURLProtectionSpaceAuthenticationSchemeNegotiate;
break;
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
case ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested:
scheme = kCFURLProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested;
break;
case ProtectionSpaceAuthenticationSchemeClientCertificateRequested:
scheme = kCFURLProtectionSpaceAuthenticationSchemeClientCertificateRequested;
break;
#endif
default:
ASSERT_NOT_REACHED();
}
CFStringRef host = coreSpace.host().createCFString();
CFStringRef realm = coreSpace.realm().createCFString();
CFURLProtectionSpaceRef result = CFURLProtectionSpaceCreate(0, host, coreSpace.port(), serverType, realm, scheme);
CFRelease(host);
CFRelease(realm);
return result;
}
示例10: getCredentialFromPersistentStorage
void NetworkStorageSession::getCredentialFromPersistentStorage(const ProtectionSpace& protectionSpace, Function<void (Credential&&)> completionHandler)
{
#if USE(LIBSECRET)
if (m_sessionID.isEphemeral()) {
completionHandler({ });
return;
}
const String& realm = protectionSpace.realm();
if (realm.isEmpty()) {
completionHandler({ });
return;
}
GRefPtr<GHashTable> attributes = adoptGRef(secret_attributes_build(SECRET_SCHEMA_COMPAT_NETWORK,
"domain", realm.utf8().data(),
"server", protectionSpace.host().utf8().data(),
"port", protectionSpace.port(),
"protocol", schemeFromProtectionSpaceServerType(protectionSpace.serverType()),
"authtype", authTypeFromProtectionSpaceAuthenticationScheme(protectionSpace.authenticationScheme()),
nullptr));
if (!attributes) {
completionHandler({ });
return;
}
m_persisentStorageCancellable = adoptGRef(g_cancellable_new());
m_persisentStorageCompletionHandler = WTFMove(completionHandler);
secret_service_search(nullptr, SECRET_SCHEMA_COMPAT_NETWORK, attributes.get(),
static_cast<SecretSearchFlags>(SECRET_SEARCH_UNLOCK | SECRET_SEARCH_LOAD_SECRETS), m_persisentStorageCancellable.get(),
[](GObject* source, GAsyncResult* result, gpointer userData) {
GUniqueOutPtr<GError> error;
GUniquePtr<GList> elements(secret_service_search_finish(SECRET_SERVICE(source), result, &error.outPtr()));
if (g_error_matches (error.get(), G_IO_ERROR, G_IO_ERROR_CANCELLED))
return;
NetworkStorageSession* session = static_cast<NetworkStorageSession*>(userData);
auto completionHandler = std::exchange(session->m_persisentStorageCompletionHandler, nullptr);
if (error || !elements || !elements->data) {
completionHandler({ });
return;
}
GRefPtr<SecretItem> secretItem = adoptGRef(static_cast<SecretItem*>(elements->data));
GRefPtr<GHashTable> attributes = adoptGRef(secret_item_get_attributes(secretItem.get()));
String user = String::fromUTF8(static_cast<const char*>(g_hash_table_lookup(attributes.get(), "user")));
if (user.isEmpty()) {
completionHandler({ });
return;
}
size_t length;
GRefPtr<SecretValue> secretValue = adoptGRef(secret_item_get_secret(secretItem.get()));
const char* passwordData = secret_value_get(secretValue.get(), &length);
completionHandler(Credential(user, String::fromUTF8(passwordData, length), CredentialPersistencePermanent));
}, this);
#else
UNUSED_PARAM(protectionSpace);
completionHandler({ });
#endif
}