## WebKitAuthenticationRequest WebKitAuthenticationRequest — Represents an authentication request |

## Synopsis

    struct              WebKitAuthenticationRequest;
    enum                WebKitAuthenticationScheme;
    void                webkit_authentication_request_authenticate
                                                            (WebKitAuthenticationRequest *request,
                                                             WebKitCredential *credential);
    void                webkit_authentication_request_cancel
                                                            (WebKitAuthenticationRequest *request);
    gboolean            webkit_authentication_request_can_save_credentials
                                                            (WebKitAuthenticationRequest *request);
    const gchar *       webkit_authentication_request_get_host
                                                            (WebKitAuthenticationRequest *request);
    guint               webkit_authentication_request_get_port
                                                            (WebKitAuthenticationRequest *request);
    gboolean            webkit_authentication_request_is_retry
                                                            (WebKitAuthenticationRequest *request);
    WebKitCredential *  webkit_authentication_request_get_proposed_credential
                                                            (WebKitAuthenticationRequest *request);
    const gchar *       webkit_authentication_request_get_realm
                                                            (WebKitAuthenticationRequest *request);
    WebKitAuthenticationScheme webkit_authentication_request_get_scheme
                                                            (WebKitAuthenticationRequest *request);
    gboolean            webkit_authentication_request_is_for_proxy
                                                            (WebKitAuthenticationRequest *request);

                        WebKitCredential;
    enum                WebKitCredentialPersistence;
    WebKitCredential *  webkit_credential_new               (const gchar *username,
                                                             const gchar *password,
                                                             WebKitCredentialPersistence persistence);
    WebKitCredential *  webkit_credential_copy              (WebKitCredential *credential);
    void                webkit_credential_free              (WebKitCredential *credential);
    const gchar *       webkit_credential_get_password      (WebKitCredential *credential);
    WebKitCredentialPersistence webkit_credential_get_persistence
                                                            (WebKitCredential *credential);
    const gchar *       webkit_credential_get_username      (WebKitCredential *credential);
    gboolean            webkit_credential_has_password      (WebKitCredential *credential);

## Object Hierarchy

      GObject
       +----WebKitAuthenticationRequest

      GBoxed
       +----WebKitCredential

## Signals

      "cancelled"                                      : Run Last

## Description

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.

## Details

### struct WebKitAuthenticationRequest

    struct WebKitAuthenticationRequest;

### enum WebKitAuthenticationScheme

    typedef enum {
        WEBKIT_AUTHENTICATION_SCHEME_DEFAULT = 1,
        WEBKIT_AUTHENTICATION_SCHEME_HTTP_BASIC = 2,
        WEBKIT_AUTHENTICATION_SCHEME_HTTP_DIGEST = 3,
        WEBKIT_AUTHENTICATION_SCHEME_HTML_FORM = 4,
        WEBKIT_AUTHENTICATION_SCHEME_NTLM = 5,
        WEBKIT_AUTHENTICATION_SCHEME_NEGOTIATE = 6,
        WEBKIT_AUTHENTICATION_SCHEME_CLIENT_CERTIFICATE_REQUESTED = 7,
        WEBKIT_AUTHENTICATION_SCHEME_SERVER_TRUST_EVALUATION_REQUESTED = 8,
        WEBKIT_AUTHENTICATION_SCHEME_UNKNOWN = 100,
    } WebKitAuthenticationScheme;

Enum values representing the authentication scheme.

`WEBKIT_AUTHENTICATION_SCHEME_DEFAULT` | The default authentication scheme of WebKit.
`WEBKIT_AUTHENTICATION_SCHEME_HTTP_BASIC` | Basic authentication scheme as defined in RFC 2617.
`WEBKIT_AUTHENTICATION_SCHEME_HTTP_DIGEST` | Digest authentication scheme as defined in RFC 2617.
`WEBKIT_AUTHENTICATION_SCHEME_HTML_FORM` | HTML Form authentication.
`WEBKIT_AUTHENTICATION_SCHEME_NTLM` | NTLM Microsoft proprietary authentication scheme.
`WEBKIT_AUTHENTICATION_SCHEME_NEGOTIATE` | Negotiate (or SPNEGO) authentication scheme as defined in RFC 4559.
`WEBKIT_AUTHENTICATION_SCHEME_CLIENT_CERTIFICATE_REQUESTED` | Client Certificate Authentication (see RFC 2246).
`WEBKIT_AUTHENTICATION_SCHEME_SERVER_TRUST_EVALUATION_REQUESTED` | Server Trust Authentication.
`WEBKIT_AUTHENTICATION_SCHEME_UNKNOWN` | Authentication scheme unknown.

Since 2.2

### webkit_authentication_request_authenticate ()

    void                webkit_authentication_request_authenticate
                                                            (WebKitAuthenticationRequest *request,
                                                             WebKitCredential *credential);

Authenticate the WebKitAuthenticationRequest using the WebKitCredential supplied. To continue without credentials, pass `NULL` as `credential`.

`request` : | a WebKitAuthenticationRequest
`credential` : | A WebKitCredential, or `NULL`. [transfer none][allow-none]

Since 2.2

### webkit_authentication_request_cancel ()

    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.

`request` : | a WebKitAuthenticationRequest

Since 2.2

### webkit_authentication_request_can_save_credentials ()

    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 or if private browsing is enabled.

`request` : | a WebKitAuthenticationRequest
Returns : | `TRUE` if webkit can store credentials or `FALSE` otherwise.

Since 2.2

### webkit_authentication_request_get_host ()

    const gchar *       webkit_authentication_request_get_host
                                                            (WebKitAuthenticationRequest *request);

Get the host that this authentication challenge is applicable to.

`request` : | a WebKitAuthenticationRequest
Returns : | The host of `request`.

Since 2.2

### webkit_authentication_request_get_port ()

    guint               webkit_authentication_request_get_port
                                                            (WebKitAuthenticationRequest *request);

Get the port that this authentication challenge is applicable to.

`request` : | a WebKitAuthenticationRequest
Returns : | The port of `request`.

Since 2.2

### webkit_authentication_request_is_retry ()

    gboolean            webkit_authentication_request_is_retry
                                                            (WebKitAuthenticationRequest *request);

Determine whether this this is a first attempt or a retry for this authentication challenge.

`request` : | a WebKitAuthenticationRequest
Returns : | `TRUE` if authentication attempt is a retry or `FALSE` otherwise.

Since 2.2

### webkit_authentication_request_get_proposed_credential ()

    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.

`request` : | a WebKitAuthenticationRequest
Returns : | A WebKitCredential encapsulating credential details or `NULL` if there is no stored credential. [transfer full]

Since 2.2

### webkit_authentication_request_get_realm ()

    const gchar *       webkit_authentication_request_get_realm
                                                            (WebKitAuthenticationRequest *request);

Get the realm that this authentication challenge is applicable to.

`request` : | a WebKitAuthenticationRequest
Returns : | The realm of `request`.

Since 2.2

### webkit_authentication_request_get_scheme ()

    WebKitAuthenticationScheme webkit_authentication_request_get_scheme
                                                            (WebKitAuthenticationRequest *request);

Get the authentication scheme of the authentication challenge.

`request` : | a WebKitAuthenticationRequest
Returns : | The WebKitAuthenticationScheme of `request`.

Since 2.2

### webkit_authentication_request_is_for_proxy ()

    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.

`request` : | a WebKitAuthenticationRequest
Returns : | `TRUE` if authentication is for a proxy or `FALSE` otherwise.

Since 2.2

### WebKitCredential

    typedef struct _WebKitCredential WebKitCredential;

### enum WebKitCredentialPersistence

    typedef enum {
        WEBKIT_CREDENTIAL_PERSISTENCE_NONE,
        WEBKIT_CREDENTIAL_PERSISTENCE_FOR_SESSION,
        WEBKIT_CREDENTIAL_PERSISTENCE_PERMANENT
    } WebKitCredentialPersistence;

Enum values representing the duration for which a credential persists.

`WEBKIT_CREDENTIAL_PERSISTENCE_NONE` | Credential does not persist
`WEBKIT_CREDENTIAL_PERSISTENCE_FOR_SESSION` | Credential persists for session only
`WEBKIT_CREDENTIAL_PERSISTENCE_PERMANENT` | Credential persists permanently

Since 2.2

### webkit_credential_new ()

    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
Returns : | A WebKitCredential. [transfer full]

Since 2.2

### webkit_credential_copy ()

    WebKitCredential *  webkit_credential_copy              (WebKitCredential *credential);

Make a copy of the WebKitCredential.

`credential` : | a WebKitCredential
Returns : | A copy of passed in WebKitCredential. [transfer full]

Since 2.2

### webkit_credential_free ()

    void                webkit_credential_free              (WebKitCredential *credential);

Free the WebKitCredential.

`credential` : | A WebKitCredential

Since 2.2

### webkit_credential_get_password ()

    const gchar *       webkit_credential_get_password      (WebKitCredential *credential);

Get the password currently held by this WebKitCredential.

`credential` : | a WebKitCredential
Returns : | The password stored in the WebKitCredential.

Since 2.2

### webkit_credential_get_persistence ()

    WebKitCredentialPersistence webkit_credential_get_persistence
                                                            (WebKitCredential *credential);

Get the persistence mode currently held by this WebKitCredential.

`credential` : | a WebKitCredential
Returns : | The WebKitCredentialPersistence stored in the WebKitCredential.

Since 2.2

### webkit_credential_get_username ()

    const gchar *       webkit_credential_get_username      (WebKitCredential *credential);

Get the username currently held by this WebKitCredential.

`credential` : | a WebKitCredential
Returns : | The username stored in the WebKitCredential.

Since 2.2

### webkit_credential_has_password ()

    gboolean            webkit_credential_has_password      (WebKitCredential *credential);

Determine whether this credential has a password stored.

`credential` : | a WebKitCredential
Returns : | `TRUE` if the credential has a password or `FALSE` otherwise.

Since 2.2

## Signal Details

### The `"cancelled"` signal

    void                user_function                      (WebKitAuthenticationRequest *request,
                                                            gpointer                     user_data)      : Run Last

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.

`request` : | the WebKitAuthenticationRequest
`user_data` : | user data set when the signal handler was connected.

Since 2.2

## See Also

WebKitWebView