pub struct AuthHandler { /* private fields */ }Expand description
Handler for HTTP and proxy authentication challenges.
Implementations§
Source§impl AuthHandler
impl AuthHandler
Sourcepub fn new(connection: Arc<CdpConnection>, session_id: String) -> Self
pub fn new(connection: Arc<CdpConnection>, session_id: String) -> Self
Create a new auth handler.
Sourcepub fn with_credentials(
connection: Arc<CdpConnection>,
session_id: String,
credentials: HttpCredentials,
) -> Self
pub fn with_credentials( connection: Arc<CdpConnection>, session_id: String, credentials: HttpCredentials, ) -> Self
Create an auth handler with pre-configured credentials.
Sourcepub fn with_proxy_credentials(
connection: Arc<CdpConnection>,
session_id: String,
proxy_credentials: ProxyCredentials,
) -> Self
pub fn with_proxy_credentials( connection: Arc<CdpConnection>, session_id: String, proxy_credentials: ProxyCredentials, ) -> Self
Create an auth handler with pre-configured proxy credentials.
Sourcepub fn with_all_credentials(
connection: Arc<CdpConnection>,
session_id: String,
http_credentials: Option<HttpCredentials>,
proxy_credentials: Option<ProxyCredentials>,
) -> Self
pub fn with_all_credentials( connection: Arc<CdpConnection>, session_id: String, http_credentials: Option<HttpCredentials>, proxy_credentials: Option<ProxyCredentials>, ) -> Self
Create an auth handler with both HTTP and proxy credentials.
Sourcepub async fn set_credentials(&self, credentials: HttpCredentials)
pub async fn set_credentials(&self, credentials: HttpCredentials)
Set HTTP credentials.
Sourcepub fn set_credentials_sync(&self, credentials: HttpCredentials)
pub fn set_credentials_sync(&self, credentials: HttpCredentials)
Set HTTP credentials synchronously (for use during construction).
This uses blocking_write which should only be called from non-async contexts.
Sourcepub async fn clear_credentials(&self)
pub async fn clear_credentials(&self)
Clear HTTP credentials.
Sourcepub async fn set_proxy_credentials(&self, credentials: ProxyCredentials)
pub async fn set_proxy_credentials(&self, credentials: ProxyCredentials)
Set proxy credentials.
Sourcepub fn set_proxy_credentials_sync(&self, credentials: ProxyCredentials)
pub fn set_proxy_credentials_sync(&self, credentials: ProxyCredentials)
Set proxy credentials synchronously (for use during construction).
This uses try_write which should only be called from non-async contexts.
Sourcepub async fn clear_proxy_credentials(&self)
pub async fn clear_proxy_credentials(&self)
Clear proxy credentials.
Sourcepub async fn handle_auth_challenge(
&self,
event: &AuthRequiredEvent,
) -> Result<bool, NetworkError>
pub async fn handle_auth_challenge( &self, event: &AuthRequiredEvent, ) -> Result<bool, NetworkError>
Handle an authentication challenge.
Returns true if the challenge was handled, false if no credentials available.
§Errors
Returns an error if the CDP command to continue with authentication fails, such as when the connection is closed or the browser rejects the request.
Sourcepub async fn reset_retries(&self, origin: &str)
pub async fn reset_retries(&self, origin: &str)
Reset retry counts (call after successful auth).
Sourcepub async fn reset_all_retries(&self)
pub async fn reset_all_retries(&self)
Reset all retry counts.