1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2001-2003, Ximian, Inc.
6 #ifndef __SOUP_AUTH_H__
7 #define __SOUP_AUTH_H__ 1
9 #include <libsoup/soup-types.h>
10 #include <libsoup/soup-headers.h>
14 #define SOUP_TYPE_AUTH (soup_auth_get_type ())
15 #define SOUP_AUTH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_AUTH, SoupAuth))
16 #define SOUP_AUTH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_AUTH, SoupAuthClass))
17 #define SOUP_IS_AUTH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_AUTH))
18 #define SOUP_IS_AUTH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_AUTH))
19 #define SOUP_AUTH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_AUTH, SoupAuthClass))
28 GObjectClass parent_class;
30 const char *scheme_name;
33 gboolean (*update) (SoupAuth *auth,
35 GHashTable *auth_header);
37 GSList * (*get_protection_space) (SoupAuth *auth,
40 void (*authenticate) (SoupAuth *auth,
42 const char *password);
43 gboolean (*is_authenticated) (SoupAuth *auth);
45 char * (*get_authorization) (SoupAuth *auth,
48 gboolean (*is_ready) (SoupAuth *auth,
51 gboolean (*can_authenticate) (SoupAuth *auth);
53 /* Padding for future expansion */
54 void (*_libsoup_reserved3) (void);
55 void (*_libsoup_reserved4) (void);
58 #define SOUP_AUTH_SCHEME_NAME "scheme-name"
59 #define SOUP_AUTH_REALM "realm"
60 #define SOUP_AUTH_HOST "host"
61 #define SOUP_AUTH_IS_FOR_PROXY "is-for-proxy"
62 #define SOUP_AUTH_IS_AUTHENTICATED "is-authenticated"
65 GType soup_auth_get_type (void);
68 SoupAuth *soup_auth_new (GType type,
70 const char *auth_header);
72 gboolean soup_auth_update (SoupAuth *auth,
74 const char *auth_header);
77 gboolean soup_auth_is_for_proxy (SoupAuth *auth);
79 const char *soup_auth_get_scheme_name (SoupAuth *auth);
81 const char *soup_auth_get_host (SoupAuth *auth);
83 const char *soup_auth_get_realm (SoupAuth *auth);
85 char *soup_auth_get_info (SoupAuth *auth);
88 void soup_auth_authenticate (SoupAuth *auth,
90 const char *password);
92 gboolean soup_auth_is_authenticated (SoupAuth *auth);
93 SOUP_AVAILABLE_IN_2_42
94 gboolean soup_auth_is_ready (SoupAuth *auth,
96 SOUP_AVAILABLE_IN_2_54
97 gboolean soup_auth_can_authenticate (SoupAuth *auth);
100 char *soup_auth_get_authorization (SoupAuth *auth,
103 SOUP_AVAILABLE_IN_2_4
104 GSList *soup_auth_get_protection_space (SoupAuth *auth,
105 SoupURI *source_uri);
106 SOUP_AVAILABLE_IN_2_4
107 void soup_auth_free_protection_space (SoupAuth *auth,
110 /* The actual auth types, which can be added/removed as features */
112 #define SOUP_TYPE_AUTH_BASIC (soup_auth_basic_get_type ())
113 SOUP_AVAILABLE_IN_2_4
114 GType soup_auth_basic_get_type (void);
115 #define SOUP_TYPE_AUTH_DIGEST (soup_auth_digest_get_type ())
116 SOUP_AVAILABLE_IN_2_4
117 GType soup_auth_digest_get_type (void);
118 #define SOUP_TYPE_AUTH_NTLM (soup_auth_ntlm_get_type ())
119 SOUP_AVAILABLE_IN_2_4
120 GType soup_auth_ntlm_get_type (void);
121 #define SOUP_TYPE_AUTH_NEGOTIATE (soup_auth_negotiate_get_type ())
122 SOUP_AVAILABLE_IN_2_54
123 GType soup_auth_negotiate_get_type (void);
125 /* Deprecated SoupPasswordManager-related APIs: all are now no-ops */
126 SOUP_AVAILABLE_IN_2_28
127 SOUP_DEPRECATED_IN_2_28
128 GSList *soup_auth_get_saved_users (SoupAuth *auth);
129 SOUP_AVAILABLE_IN_2_28
130 SOUP_DEPRECATED_IN_2_28
131 const char *soup_auth_get_saved_password (SoupAuth *auth,
133 SOUP_AVAILABLE_IN_2_28
134 SOUP_DEPRECATED_IN_2_28
135 void soup_auth_save_password (SoupAuth *auth,
136 const char *username,
137 const char *password);
138 SOUP_AVAILABLE_IN_2_28
139 SOUP_DEPRECATED_IN_2_28
140 void soup_auth_has_saved_password (SoupAuth *auth,
141 const char *username,
142 const char *password);
144 SOUP_AVAILABLE_IN_2_54
145 gboolean soup_auth_negotiate_supported (void);
149 #endif /* __SOUP_AUTH_H__ */