SoupAuthDomainBasic: libsoup Reference Manual

## SoupAuthDomainBasic SoupAuthDomainBasic — Server-side "Basic" authentication |

## Functions

SoupAuthDomain * | soup_auth_domain_basic_new ()
gboolean | (*SoupAuthDomainBasicAuthCallback) ()
void | soup_auth_domain_basic_set_auth_callback ()

## Properties

gpointer | auth-callback | Read / Write
gpointer | auth-data | Read / Write

## Types and Values

| SoupAuthDomainBasic
#define | SOUP_AUTH_DOMAIN_BASIC_AUTH_CALLBACK
#define | SOUP_AUTH_DOMAIN_BASIC_AUTH_DATA

## Object Hierarchy

        GObject
        ╰── SoupAuthDomain
            ╰── SoupAuthDomainBasic

## Includes

    #include <libsoup/soup.h>

## Description

SoupAuthDomainBasic handles the server side of HTTP "Basic" (ie, cleartext password) authentication.

## Functions

### soup_auth_domain_basic_new ()

    SoupAuthDomain *
    soup_auth_domain_basic_new (const char *optname1,
                                ...);

Creates a SoupAuthDomainBasic. You must set the `SOUP_AUTH_DOMAIN_REALM` parameter, to indicate the realm name to be returned with the authentication challenge to the client. Other parameters are optional.

#### Parameters

optname1 | name of first option, or `NULL` |
... | option name/value pairs |

#### Returns

the new SoupAuthDomain

### SoupAuthDomainBasicAuthCallback ()

    gboolean
    (*SoupAuthDomainBasicAuthCallback) (SoupAuthDomain *domain,
                                        SoupMessage *msg,
                                        const char *username,
                                        const char *password,
                                        gpointer user_data);

Callback used by SoupAuthDomainBasic for authentication purposes. The application should verify that `username` and `password` and valid and return `TRUE` or `FALSE`.

If you are maintaining your own password database (rather than using the password to authenticate against some other system like PAM or a remote server), you should make sure you know what you are doing. In particular, don't store cleartext passwords, or easily-computed hashes of cleartext passwords, even if you don't care that much about the security of your server, because users will frequently use the same password for multiple sites, and so compromising any site with a cleartext (or easily-cracked) password database may give attackers access to other more-interesting sites as well.

#### Parameters

domain | the domain |
msg | the message being authenticated |
username | the username provided by the client |
password | the password provided by the client |
user_data | the data passed to `soup_auth_domain_basic_set_auth_callback()` |

#### Returns

`TRUE` if `username` and `password` are valid

### soup_auth_domain_basic_set_auth_callback ()

    void
    soup_auth_domain_basic_set_auth_callback
                                   (SoupAuthDomain *domain,
                                    SoupAuthDomainBasicAuthCallback callback,
                                    gpointer user_data,
                                    GDestroyNotify dnotify);

Sets the callback that `domain` will use to authenticate incoming requests. For each request containing authorization, `domain` will invoke the callback, and then either accept or reject the request based on `callback` 's return value.

You can also set the auth callback by setting the `SOUP_AUTH_DOMAIN_BASIC_AUTH_CALLBACK` and `SOUP_AUTH_DOMAIN_BASIC_AUTH_DATA` properties, which can also be used to set the callback at construct time.

#### Parameters

domain | the domain |
callback | the callback |
user_data | data to pass to `auth_callback` |
dnotify | destroy notifier to free `user_data` when `domain` is destroyed |

## Types and Values

### SoupAuthDomainBasic

    typedef struct _SoupAuthDomainBasic SoupAuthDomainBasic;

### SOUP_AUTH_DOMAIN_BASIC_AUTH_CALLBACK

    #define SOUP_AUTH_DOMAIN_BASIC_AUTH_CALLBACK "auth-callback"

Alias for the “auth-callback” property. (The SoupAuthDomainBasicAuthCallback.)

### SOUP_AUTH_DOMAIN_BASIC_AUTH_DATA

    #define SOUP_AUTH_DOMAIN_BASIC_AUTH_DATA     "auth-data"

Alias for the “auth-data” property. (The data to pass to the SoupAuthDomainBasicAuthCallback.)

## Property Details

### The `“auth-callback”` property

      “auth-callback”            gpointer

Password-checking callback.

Flags: Read / Write

### The `“auth-data”` property

      “auth-data”                gpointer

Data to pass to authentication callback.

Flags: Read / Write