libsoup Reference Manual | ||||
---|---|---|---|---|
SoupAuthDomainBasic; SoupAuthDomain* soup_auth_domain_basic_new (const char *optname1, ...); gboolean (*SoupAuthDomainBasicAuthCallback) (SoupAuthDomain *domain, SoupMessage *msg, const char *username, const char *password, gpointer user_data); void soup_auth_domain_basic_set_auth_callback (SoupAuthDomain *domain, SoupAuthDomainBasicAuthCallback callback, gpointer user_data, GDestroyNotify dnotify); #define SOUP_AUTH_DOMAIN_BASIC_AUTH_CALLBACK #define SOUP_AUTH_DOMAIN_BASIC_AUTH_DATA
SoupAuthDomainBasic handles the server side of HTTP "Basic" (ie, cleartext password) authentication.
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.
optname1 : |
name of first option, or NULL
|
... : |
option name/value pairs |
Returns : | the new SoupAuthDomain |
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.
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
|
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.
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
|
#define SOUP_AUTH_DOMAIN_BASIC_AUTH_CALLBACK "auth-callback"
Alias for the "auth-callback" property. (The SoupAuthDomainBasicAuthCallback.)
#define SOUP_AUTH_DOMAIN_BASIC_AUTH_DATA "auth-data"
Alias for the "auth-data" property. (The data to pass to the SoupAuthDomainBasicAuthCallback.)