|
Lines 27-32
Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp_sec1
|
| 27 |
#include "AuthenticationChallengeProxy.h" |
27 |
#include "AuthenticationChallengeProxy.h" |
| 28 |
|
28 |
|
| 29 |
#include "AuthenticationDecisionListener.h" |
29 |
#include "AuthenticationDecisionListener.h" |
|
|
30 |
#include "AuthenticationManager.h" |
| 30 |
#include "AuthenticationManagerMessages.h" |
31 |
#include "AuthenticationManagerMessages.h" |
| 31 |
#include "ChildProcessProxy.h" |
32 |
#include "ChildProcessProxy.h" |
| 32 |
#include "WebCertificateInfo.h" |
33 |
#include "WebCertificateInfo.h" |
|
Lines 41-128
Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp_sec2
|
| 41 |
|
42 |
|
| 42 |
namespace WebKit { |
43 |
namespace WebKit { |
| 43 |
|
44 |
|
| 44 |
AuthenticationChallengeProxy::AuthenticationChallengeProxy(WebCore::AuthenticationChallenge&& authenticationChallenge, uint64_t challengeID, IPC::Connection* connection) |
45 |
AuthenticationChallengeProxy::AuthenticationChallengeProxy(WebCore::AuthenticationChallenge&& authenticationChallenge, uint64_t challengeID, Ref<IPC::Connection>&& connection, WeakPtr<SecKeyProxyStore>&& secKeyProxyStore) |
| 45 |
: m_coreAuthenticationChallenge(WTFMove(authenticationChallenge)) |
46 |
: m_coreAuthenticationChallenge(WTFMove(authenticationChallenge)) |
| 46 |
, m_challengeID(challengeID) |
47 |
, m_listener(AuthenticationDecisionListener::create([challengeID, connection = WTFMove(connection), secKeyProxyStore = WTFMove(secKeyProxyStore)](AuthenticationChallengeDisposition disposition, std::optional<WebCore::Credential>&& credential) { |
| 47 |
, m_connection(connection) |
48 |
switch (disposition) { |
| 48 |
{ |
49 |
case AuthenticationChallengeDisposition::Cancel: |
| 49 |
ASSERT(m_challengeID); |
50 |
connection->send(Messages::AuthenticationManager::CancelChallenge(challengeID), 0); |
| 50 |
m_listener = AuthenticationDecisionListener::create(this); |
51 |
break; |
| 51 |
} |
52 |
case AuthenticationChallengeDisposition::PerformDefaultHandling: |
| 52 |
|
53 |
connection->send(Messages::AuthenticationManager::PerformDefaultHandling(challengeID), 0); |
| 53 |
AuthenticationChallengeProxy::~AuthenticationChallengeProxy() |
54 |
break; |
| 54 |
{ |
55 |
case AuthenticationChallengeDisposition::RejectProtectionSpaceAndContinue: |
| 55 |
// If an outstanding AuthenticationChallengeProxy is being destroyed even though it hasn't been responded to yet, |
56 |
connection->send(Messages::AuthenticationManager::RejectProtectionSpaceAndContinue(challengeID), 0); |
| 56 |
// we cancel it here so the process isn't waiting for an answer forever. |
57 |
break; |
| 57 |
if (m_challengeID) |
58 |
case AuthenticationChallengeDisposition::UseCredential: |
| 58 |
m_connection->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0); |
59 |
if (!credential) { |
| 59 |
|
60 |
connection->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(challengeID), 0); |
| 60 |
if (m_listener) |
61 |
break; |
| 61 |
m_listener->detachChallenge(); |
62 |
} |
| 62 |
} |
63 |
|
| 63 |
|
|
|
| 64 |
void AuthenticationChallengeProxy::useCredential(WebCredential* credential) |
| 65 |
{ |
| 66 |
if (!m_challengeID) |
| 67 |
return; |
| 68 |
|
| 69 |
uint64_t challengeID = m_challengeID; |
| 70 |
m_challengeID = 0; |
| 71 |
|
| 72 |
if (!credential) { |
| 73 |
m_connection->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(challengeID), 0); |
| 74 |
return; |
| 75 |
} |
| 76 |
|
| 77 |
#if HAVE(SEC_KEY_PROXY) |
64 |
#if HAVE(SEC_KEY_PROXY) |
| 78 |
if (protectionSpace()->authenticationScheme() == WebCore::ProtectionSpaceAuthenticationSchemeClientCertificateRequested) { |
65 |
if (secKeyProxyStore) { |
| 79 |
if (!m_secKeyProxyStore) { |
66 |
secKeyProxyStore->initialize(*credential); |
| 80 |
m_connection->send(Messages::AuthenticationManager::ContinueWithoutCredentialForChallenge(challengeID), 0); |
67 |
sendClientCertificateCredentialOverXpc(connection, *secKeyProxyStore, challengeID, *credential); |
| 81 |
return; |
68 |
break; |
| 82 |
} |
69 |
} |
| 83 |
m_secKeyProxyStore->initialize(credential->credential()); |
|
|
| 84 |
sendClientCertificateCredentialOverXpc(challengeID, credential->credential()); |
| 85 |
return; |
| 86 |
} |
| 87 |
#endif |
70 |
#endif |
| 88 |
m_connection->send(Messages::AuthenticationManager::UseCredentialForChallenge(challengeID, credential->credential()), 0); |
|
|
| 89 |
} |
| 90 |
|
71 |
|
| 91 |
void AuthenticationChallengeProxy::cancel() |
72 |
connection->send(Messages::AuthenticationManager::UseCredentialForChallenge(challengeID, *credential), 0); |
| 92 |
{ |
73 |
} |
| 93 |
if (!m_challengeID) |
74 |
})) |
| 94 |
return; |
|
|
| 95 |
|
| 96 |
m_connection->send(Messages::AuthenticationManager::CancelChallenge(m_challengeID), 0); |
| 97 |
|
| 98 |
m_challengeID = 0; |
| 99 |
} |
| 100 |
|
| 101 |
void AuthenticationChallengeProxy::performDefaultHandling() |
| 102 |
{ |
| 103 |
if (!m_challengeID) |
| 104 |
return; |
| 105 |
|
| 106 |
m_connection->send(Messages::AuthenticationManager::PerformDefaultHandling(m_challengeID), 0); |
| 107 |
|
| 108 |
m_challengeID = 0; |
| 109 |
} |
| 110 |
|
| 111 |
void AuthenticationChallengeProxy::rejectProtectionSpaceAndContinue() |
| 112 |
{ |
75 |
{ |
| 113 |
if (!m_challengeID) |
|
|
| 114 |
return; |
| 115 |
|
| 116 |
m_connection->send(Messages::AuthenticationManager::RejectProtectionSpaceAndContinue(m_challengeID), 0); |
| 117 |
|
| 118 |
m_challengeID = 0; |
| 119 |
} |
76 |
} |
| 120 |
|
77 |
|
| 121 |
WebCredential* AuthenticationChallengeProxy::proposedCredential() const |
78 |
WebCredential* AuthenticationChallengeProxy::proposedCredential() const |
| 122 |
{ |
79 |
{ |
| 123 |
if (!m_webCredential) |
80 |
if (!m_webCredential) |
| 124 |
m_webCredential = WebCredential::create(m_coreAuthenticationChallenge.proposedCredential()); |
81 |
m_webCredential = WebCredential::create(m_coreAuthenticationChallenge.proposedCredential()); |
| 125 |
|
82 |
|
| 126 |
return m_webCredential.get(); |
83 |
return m_webCredential.get(); |
| 127 |
} |
84 |
} |
| 128 |
|
85 |
|
|
Lines 130-144
WebProtectionSpace* AuthenticationChalle
Source/WebKit/UIProcess/Authentication/AuthenticationChallengeProxy.cpp_sec3
|
| 130 |
{ |
87 |
{ |
| 131 |
if (!m_webProtectionSpace) |
88 |
if (!m_webProtectionSpace) |
| 132 |
m_webProtectionSpace = WebProtectionSpace::create(m_coreAuthenticationChallenge.protectionSpace()); |
89 |
m_webProtectionSpace = WebProtectionSpace::create(m_coreAuthenticationChallenge.protectionSpace()); |
| 133 |
|
|
|
| 134 |
return m_webProtectionSpace.get(); |
| 135 |
} |
| 136 |
|
90 |
|
| 137 |
#if HAVE(SEC_KEY_PROXY) |
91 |
return m_webProtectionSpace.get(); |
| 138 |
void AuthenticationChallengeProxy::setSecKeyProxyStore(SecKeyProxyStore& store) |
|
|
| 139 |
{ |
| 140 |
m_secKeyProxyStore = makeWeakPtr(store); |
| 141 |
} |
92 |
} |
| 142 |
#endif |
|
|
| 143 |
|
93 |
|
| 144 |
} // namespace WebKit |
94 |
} // namespace WebKit |