Top |
Whenever a client attempts to load a page protected by HTTP authentication, credentials will need to be provided to authorize access. To allow the client to decide how it wishes to handle authentication, WebKit will fire a “authenticate” signal with a WebKitAuthenticationRequest object to provide client side authentication support. Credentials are exposed through the WebKitCredential object.
In case the client application does not wish to handle this signal WebKit will provide a default handler. To handle authentication asynchronously, simply increase the reference count of the WebKitAuthenticationRequest object.
void webkit_authentication_request_authenticate (WebKitAuthenticationRequest *request
,WebKitCredential *credential
);
Authenticate the WebKitAuthenticationRequest using the WebKitCredential
supplied. To continue without credentials, pass NULL
as credential
.
Since: 2.2
void
webkit_authentication_request_cancel (WebKitAuthenticationRequest *request
);
Cancel the authentication challenge. This will also cancel the page loading and result in a
“load-failed” signal with a WebKitNetworkError of type WEBKIT_NETWORK_ERROR_CANCELLED
being emitted.
Since: 2.2
gboolean
webkit_authentication_request_can_save_credentials
(WebKitAuthenticationRequest *request
);
Determine whether the authentication method associated with this
WebKitAuthenticationRequest should allow the storage of credentials.
This will return FALSE
if WebKit doesn't support credential storing,
if private browsing is enabled, or if persistent credential storage has been
disabled in WebKitWebsiteDataManager, unless credentials saving has been
explicitly enabled with webkit_authentication_request_set_can_save_credentials()
.
Since: 2.2
void webkit_authentication_request_set_can_save_credentials (WebKitAuthenticationRequest *request
,gboolean enabled
);
Set whether the authentication method associated with request
should allow the storage of credentials.
This should be used by applications handling their own credentials
storage to indicate that it should be supported even when internal
credential storage is disabled or unsupported.
Note that storing of credentials will not be allowed on ephemeral
sessions in any case.
Since: 2.30
const gchar *
webkit_authentication_request_get_host
(WebKitAuthenticationRequest *request
);
Get the host that this authentication challenge is applicable to.
Since: 2.2
guint
webkit_authentication_request_get_port
(WebKitAuthenticationRequest *request
);
Get the port that this authentication challenge is applicable to.
Since: 2.2
WebKitSecurityOrigin *
webkit_authentication_request_get_security_origin
(WebKitAuthenticationRequest *request
);
Get the WebKitSecurityOrigin that this authentication challenge is applicable to.
Since: 2.30
gboolean
webkit_authentication_request_is_retry
(WebKitAuthenticationRequest *request
);
Determine whether this this is a first attempt or a retry for this authentication challenge.
Since: 2.2
WebKitCredential *
webkit_authentication_request_get_proposed_credential
(WebKitAuthenticationRequest *request
);
Get the WebKitCredential of the proposed authentication challenge that was stored from a previous session. The client can use this directly for authentication or construct their own WebKitCredential.
A WebKitCredential encapsulating credential details
or NULL
if there is no stored credential.
[transfer full]
Since: 2.2
void webkit_authentication_request_set_proposed_credential (WebKitAuthenticationRequest *request
,WebKitCredential *credential
);
Set the WebKitCredential of the proposed authentication challenge that was
stored from a previous session. This should only be used by applications handling
their own credential storage. (When using the default WebKit credential storage,
webkit_authentication_request_get_proposed_credential()
already contains previously-stored
credentials.)
Passing a NULL
credential
will clear the proposed credential.
Since: 2.30
const gchar *
webkit_authentication_request_get_realm
(WebKitAuthenticationRequest *request
);
Get the realm that this authentication challenge is applicable to.
Since: 2.2
WebKitAuthenticationScheme
webkit_authentication_request_get_scheme
(WebKitAuthenticationRequest *request
);
Get the authentication scheme of the authentication challenge.
Since: 2.2
GTlsPasswordFlags
webkit_authentication_request_get_certificate_pin_flags
(WebKitAuthenticationRequest *request
);
Get the GTlsPasswordFlags of the WEBKIT_AUTHENTICATION_SCHEME_CLIENT_CERTIFICATE_PIN_REQUESTED
authentication challenge.
Since: 2.34
gboolean
webkit_authentication_request_is_for_proxy
(WebKitAuthenticationRequest *request
);
Determine whether the authentication challenge is associated with a proxy server rather than an "origin" server.
Since: 2.2
WebKitCredential * webkit_credential_new (const gchar *username
,const gchar *password
,WebKitCredentialPersistence persistence
);
Create a new credential from the provided username, password and persistence mode.
username |
The username for the new credential |
|
password |
The password for the new credential |
|
persistence |
The WebKitCredentialPersistence of the new credential |
Since: 2.2
WebKitCredential * webkit_credential_new_for_certificate_pin (const gchar *pin
,WebKitCredentialPersistence persistence
);
Create a new credential from the provided PIN and persistence mode.
Note that WEBKIT_CREDENTIAL_PERSISTENCE_PERMANENT
is not supported for certificate pin credentials.
pin |
The PIN for the new credential |
|
persistence |
The WebKitCredentialPersistence of the new credential |
Since: 2.34
WebKitCredential * webkit_credential_new_for_certificate (GTlsCertificate *certificate
,WebKitCredentialPersistence persistence
);
Create a new credential from the certificate
and persistence mode.
Note that WEBKIT_CREDENTIAL_PERSISTENCE_PERMANENT
is not supported for certificate credentials.
certificate |
The GTlsCertificate, or |
[nullable] |
persistence |
The WebKitCredentialPersistence of the new credential |
Since: 2.34
WebKitCredential *
webkit_credential_copy (WebKitCredential *credential
);
Make a copy of the WebKitCredential.
Since: 2.2
void
webkit_credential_free (WebKitCredential *credential
);
Free the WebKitCredential.
Since: 2.2
const gchar *
webkit_credential_get_password (WebKitCredential *credential
);
Get the password currently held by this WebKitCredential.
Since: 2.2
WebKitCredentialPersistence
webkit_credential_get_persistence (WebKitCredential *credential
);
Get the persistence mode currently held by this WebKitCredential.
Since: 2.2
const gchar *
webkit_credential_get_username (WebKitCredential *credential
);
Get the username currently held by this WebKitCredential.
Since: 2.2
gboolean
webkit_credential_has_password (WebKitCredential *credential
);
Determine whether this credential has a password stored.
Since: 2.2
GTlsCertificate *
webkit_credential_get_certificate (WebKitCredential *credential
);
Get the certificate currently held by this WebKitCredential.
Since: 2.34
Enum values representing the authentication scheme.
Since: 2.2
Enum values representing the duration for which a credential persists.
Since: 2.2
“authenticated”
signalvoid user_function (WebKitAuthenticationRequest *request, WebKitCredential *credential, gpointer user_data)
This signal is emitted when the user authentication request succeeded. Applications handling their own credential storage should connect to this signal to save the credentials.
request |
||
credential |
the WebKitCredential accepted |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 2.30
“cancelled”
signalvoid user_function (WebKitAuthenticationRequest *request, gpointer user_data)
This signal is emitted when the user authentication request is cancelled. It allows the application to dismiss its authentication dialog in case of page load failure for example.
Flags: Run Last
Since: 2.2