summaryrefslogtreecommitdiff
path: root/libsoup/server/soup-auth-domain.h
blob: 1a9cdcef7ddbb3fc566f2b055006e016a794bbd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/*
 * Copyright (C) 2007 Novell, Inc.
 */

#pragma once

#include "soup-types.h"

G_BEGIN_DECLS

#define SOUP_TYPE_AUTH_DOMAIN (soup_auth_domain_get_type ())
SOUP_AVAILABLE_IN_ALL
G_DECLARE_DERIVABLE_TYPE (SoupAuthDomain, soup_auth_domain, SOUP, AUTH_DOMAIN, GObject)

struct _SoupAuthDomainClass {
	GObjectClass parent_class;

	char *   (*accepts)        (SoupAuthDomain    *domain,
				    SoupServerMessage *msg,
				    const char        *header);
	char *   (*challenge)      (SoupAuthDomain    *domain,
				    SoupServerMessage *msg);
	gboolean (*check_password) (SoupAuthDomain    *domain,
				    SoupServerMessage *msg,
				    const char        *username,
				    const char        *password);
	gpointer padding[6];
};

typedef gboolean (*SoupAuthDomainFilter) (SoupAuthDomain    *domain,
					  SoupServerMessage *msg,
					  gpointer           user_data);

typedef gboolean (*SoupAuthDomainGenericAuthCallback) (SoupAuthDomain    *domain,
						       SoupServerMessage *msg,
						       const char        *username,
						       gpointer           user_data);

SOUP_AVAILABLE_IN_ALL
void        soup_auth_domain_add_path    (SoupAuthDomain       *domain,
					  const char           *path);
SOUP_AVAILABLE_IN_ALL
void        soup_auth_domain_remove_path (SoupAuthDomain       *domain,
					  const char           *path);

SOUP_AVAILABLE_IN_ALL
void        soup_auth_domain_set_filter  (SoupAuthDomain       *domain,
					  SoupAuthDomainFilter  filter,
					  gpointer              filter_data,
					  GDestroyNotify        dnotify);

SOUP_AVAILABLE_IN_ALL
const char *soup_auth_domain_get_realm   (SoupAuthDomain       *domain);

SOUP_AVAILABLE_IN_ALL
void        soup_auth_domain_set_generic_auth_callback (SoupAuthDomain *domain,
							SoupAuthDomainGenericAuthCallback auth_callback,
							gpointer        auth_data,
							GDestroyNotify  dnotify);
SOUP_AVAILABLE_IN_ALL
gboolean    soup_auth_domain_check_password (SoupAuthDomain    *domain,
					     SoupServerMessage *msg,
					     const char        *username,
					     const char        *password);

SOUP_AVAILABLE_IN_ALL
gboolean    soup_auth_domain_covers      (SoupAuthDomain       *domain,
					  SoupServerMessage    *msg);
SOUP_AVAILABLE_IN_ALL
char       *soup_auth_domain_accepts     (SoupAuthDomain       *domain,
					  SoupServerMessage    *msg);
SOUP_AVAILABLE_IN_ALL
void        soup_auth_domain_challenge   (SoupAuthDomain       *domain,
					  SoupServerMessage    *msg);

G_END_DECLS