soup-auth.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
  2. /*
  3. * Copyright (C) 2001-2003, Ximian, Inc.
  4. */
  5. #ifndef SOUP_AUTH_H
  6. #define SOUP_AUTH_H 1
  7. #include <libsoup/soup-types.h>
  8. #include <libsoup/soup-headers.h>
  9. G_BEGIN_DECLS
  10. #define SOUP_TYPE_AUTH (soup_auth_get_type ())
  11. #define SOUP_AUTH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_AUTH, SoupAuth))
  12. #define SOUP_AUTH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_AUTH, SoupAuthClass))
  13. #define SOUP_IS_AUTH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_AUTH))
  14. #define SOUP_IS_AUTH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_AUTH))
  15. #define SOUP_AUTH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_AUTH, SoupAuthClass))
  16. struct _SoupAuth {
  17. GObject parent;
  18. char *realm;
  19. };
  20. typedef struct {
  21. GObjectClass parent_class;
  22. const char *scheme_name;
  23. guint strength;
  24. gboolean (*update) (SoupAuth *auth,
  25. SoupMessage *msg,
  26. GHashTable *auth_header);
  27. GSList * (*get_protection_space) (SoupAuth *auth,
  28. SoupURI *source_uri);
  29. void (*authenticate) (SoupAuth *auth,
  30. const char *username,
  31. const char *password);
  32. gboolean (*is_authenticated) (SoupAuth *auth);
  33. char * (*get_authorization) (SoupAuth *auth,
  34. SoupMessage *msg);
  35. gboolean (*is_ready) (SoupAuth *auth,
  36. SoupMessage *msg);
  37. gboolean (*can_authenticate) (SoupAuth *auth);
  38. /* Padding for future expansion */
  39. void (*_libsoup_reserved3) (void);
  40. void (*_libsoup_reserved4) (void);
  41. } SoupAuthClass;
  42. #define SOUP_AUTH_SCHEME_NAME "scheme-name"
  43. #define SOUP_AUTH_REALM "realm"
  44. #define SOUP_AUTH_HOST "host"
  45. #define SOUP_AUTH_IS_FOR_PROXY "is-for-proxy"
  46. #define SOUP_AUTH_IS_AUTHENTICATED "is-authenticated"
  47. SOUP_AVAILABLE_IN_2_4
  48. GType soup_auth_get_type (void);
  49. SOUP_AVAILABLE_IN_2_4
  50. SoupAuth *soup_auth_new (GType type,
  51. SoupMessage *msg,
  52. const char *auth_header);
  53. SOUP_AVAILABLE_IN_2_4
  54. gboolean soup_auth_update (SoupAuth *auth,
  55. SoupMessage *msg,
  56. const char *auth_header);
  57. SOUP_AVAILABLE_IN_2_4
  58. gboolean soup_auth_is_for_proxy (SoupAuth *auth);
  59. SOUP_AVAILABLE_IN_2_4
  60. const char *soup_auth_get_scheme_name (SoupAuth *auth);
  61. SOUP_AVAILABLE_IN_2_4
  62. const char *soup_auth_get_host (SoupAuth *auth);
  63. SOUP_AVAILABLE_IN_2_4
  64. const char *soup_auth_get_realm (SoupAuth *auth);
  65. SOUP_AVAILABLE_IN_2_4
  66. char *soup_auth_get_info (SoupAuth *auth);
  67. SOUP_AVAILABLE_IN_2_4
  68. void soup_auth_authenticate (SoupAuth *auth,
  69. const char *username,
  70. const char *password);
  71. SOUP_AVAILABLE_IN_2_4
  72. gboolean soup_auth_is_authenticated (SoupAuth *auth);
  73. SOUP_AVAILABLE_IN_2_42
  74. gboolean soup_auth_is_ready (SoupAuth *auth,
  75. SoupMessage *msg);
  76. SOUP_AVAILABLE_IN_2_54
  77. gboolean soup_auth_can_authenticate (SoupAuth *auth);
  78. SOUP_AVAILABLE_IN_2_4
  79. char *soup_auth_get_authorization (SoupAuth *auth,
  80. SoupMessage *msg);
  81. SOUP_AVAILABLE_IN_2_4
  82. GSList *soup_auth_get_protection_space (SoupAuth *auth,
  83. SoupURI *source_uri);
  84. SOUP_AVAILABLE_IN_2_4
  85. void soup_auth_free_protection_space (SoupAuth *auth,
  86. GSList *space);
  87. /* The actual auth types, which can be added/removed as features */
  88. #define SOUP_TYPE_AUTH_BASIC (soup_auth_basic_get_type ())
  89. SOUP_AVAILABLE_IN_2_4
  90. GType soup_auth_basic_get_type (void);
  91. #define SOUP_TYPE_AUTH_DIGEST (soup_auth_digest_get_type ())
  92. SOUP_AVAILABLE_IN_2_4
  93. GType soup_auth_digest_get_type (void);
  94. #define SOUP_TYPE_AUTH_NTLM (soup_auth_ntlm_get_type ())
  95. SOUP_AVAILABLE_IN_2_4
  96. GType soup_auth_ntlm_get_type (void);
  97. #define SOUP_TYPE_AUTH_NEGOTIATE (soup_auth_negotiate_get_type ())
  98. SOUP_AVAILABLE_IN_2_54
  99. GType soup_auth_negotiate_get_type (void);
  100. /* Deprecated SoupPasswordManager-related APIs: all are now no-ops */
  101. SOUP_AVAILABLE_IN_2_28
  102. SOUP_DEPRECATED_IN_2_28
  103. GSList *soup_auth_get_saved_users (SoupAuth *auth);
  104. SOUP_AVAILABLE_IN_2_28
  105. SOUP_DEPRECATED_IN_2_28
  106. const char *soup_auth_get_saved_password (SoupAuth *auth,
  107. const char *user);
  108. SOUP_AVAILABLE_IN_2_28
  109. SOUP_DEPRECATED_IN_2_28
  110. void soup_auth_save_password (SoupAuth *auth,
  111. const char *username,
  112. const char *password);
  113. SOUP_AVAILABLE_IN_2_28
  114. SOUP_DEPRECATED_IN_2_28
  115. void soup_auth_has_saved_password (SoupAuth *auth,
  116. const char *username,
  117. const char *password);
  118. SOUP_AVAILABLE_IN_2_54
  119. gboolean soup_auth_negotiate_supported (void);
  120. G_END_DECLS
  121. #endif /* SOUP_AUTH_H */