1 | #ifndef HEADER_CURL_VAUTH_H
|
---|
2 | #define HEADER_CURL_VAUTH_H
|
---|
3 | /***************************************************************************
|
---|
4 | * _ _ ____ _
|
---|
5 | * Project ___| | | | _ \| |
|
---|
6 | * / __| | | | |_) | |
|
---|
7 | * | (__| |_| | _ <| |___
|
---|
8 | * \___|\___/|_| \_\_____|
|
---|
9 | *
|
---|
10 | * Copyright (C) 2014 - 2017, Steve Holme, <[email protected]>.
|
---|
11 | *
|
---|
12 | * This software is licensed as described in the file COPYING, which
|
---|
13 | * you should have received as part of this distribution. The terms
|
---|
14 | * are also available at https://curl.haxx.se/docs/copyright.html.
|
---|
15 | *
|
---|
16 | * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
---|
17 | * copies of the Software, and permit persons to whom the Software is
|
---|
18 | * furnished to do so, under the terms of the COPYING file.
|
---|
19 | *
|
---|
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
---|
21 | * KIND, either express or implied.
|
---|
22 | *
|
---|
23 | ***************************************************************************/
|
---|
24 |
|
---|
25 | #include <curl/curl.h>
|
---|
26 |
|
---|
27 | struct Curl_easy;
|
---|
28 |
|
---|
29 | #if !defined(CURL_DISABLE_CRYPTO_AUTH)
|
---|
30 | struct digestdata;
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #if defined(USE_NTLM)
|
---|
34 | struct ntlmdata;
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | #if defined(USE_KERBEROS5)
|
---|
38 | struct kerberos5data;
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | #if (defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)) && defined(USE_SPNEGO)
|
---|
42 | struct negotiatedata;
|
---|
43 | #endif
|
---|
44 |
|
---|
45 | #if defined(USE_WINDOWS_SSPI)
|
---|
46 | #define GSS_ERROR(status) (status & 0x80000000)
|
---|
47 | #endif
|
---|
48 |
|
---|
49 | /* This is used to build a SPN string */
|
---|
50 | #if !defined(USE_WINDOWS_SSPI)
|
---|
51 | char *Curl_auth_build_spn(const char *service, const char *host,
|
---|
52 | const char *realm);
|
---|
53 | #else
|
---|
54 | TCHAR *Curl_auth_build_spn(const char *service, const char *host,
|
---|
55 | const char *realm);
|
---|
56 | #endif
|
---|
57 |
|
---|
58 | /* This is used to test if the user contains a Windows domain name */
|
---|
59 | bool Curl_auth_user_contains_domain(const char *user);
|
---|
60 |
|
---|
61 | /* This is used to generate a base64 encoded PLAIN cleartext message */
|
---|
62 | CURLcode Curl_auth_create_plain_message(struct Curl_easy *data,
|
---|
63 | const char *userp,
|
---|
64 | const char *passwdp,
|
---|
65 | char **outptr, size_t *outlen);
|
---|
66 |
|
---|
67 | /* This is used to generate a base64 encoded LOGIN cleartext message */
|
---|
68 | CURLcode Curl_auth_create_login_message(struct Curl_easy *data,
|
---|
69 | const char *valuep, char **outptr,
|
---|
70 | size_t *outlen);
|
---|
71 |
|
---|
72 | /* This is used to generate a base64 encoded EXTERNAL cleartext message */
|
---|
73 | CURLcode Curl_auth_create_external_message(struct Curl_easy *data,
|
---|
74 | const char *user, char **outptr,
|
---|
75 | size_t *outlen);
|
---|
76 |
|
---|
77 | #if !defined(CURL_DISABLE_CRYPTO_AUTH)
|
---|
78 | /* This is used to decode a CRAM-MD5 challenge message */
|
---|
79 | CURLcode Curl_auth_decode_cram_md5_message(const char *chlg64, char **outptr,
|
---|
80 | size_t *outlen);
|
---|
81 |
|
---|
82 | /* This is used to generate a CRAM-MD5 response message */
|
---|
83 | CURLcode Curl_auth_create_cram_md5_message(struct Curl_easy *data,
|
---|
84 | const char *chlg,
|
---|
85 | const char *userp,
|
---|
86 | const char *passwdp,
|
---|
87 | char **outptr, size_t *outlen);
|
---|
88 |
|
---|
89 | /* This is used to evaluate if DIGEST is supported */
|
---|
90 | bool Curl_auth_is_digest_supported(void);
|
---|
91 |
|
---|
92 | /* This is used to generate a base64 encoded DIGEST-MD5 response message */
|
---|
93 | CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
|
---|
94 | const char *chlg64,
|
---|
95 | const char *userp,
|
---|
96 | const char *passwdp,
|
---|
97 | const char *service,
|
---|
98 | char **outptr, size_t *outlen);
|
---|
99 |
|
---|
100 | /* This is used to decode a HTTP DIGEST challenge message */
|
---|
101 | CURLcode Curl_auth_decode_digest_http_message(const char *chlg,
|
---|
102 | struct digestdata *digest);
|
---|
103 |
|
---|
104 | /* This is used to generate a HTTP DIGEST response message */
|
---|
105 | CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
---|
106 | const char *userp,
|
---|
107 | const char *passwdp,
|
---|
108 | const unsigned char *request,
|
---|
109 | const unsigned char *uri,
|
---|
110 | struct digestdata *digest,
|
---|
111 | char **outptr, size_t *outlen);
|
---|
112 |
|
---|
113 | /* This is used to clean up the digest specific data */
|
---|
114 | void Curl_auth_digest_cleanup(struct digestdata *digest);
|
---|
115 | #endif /* !CURL_DISABLE_CRYPTO_AUTH */
|
---|
116 |
|
---|
117 | #if defined(USE_NTLM)
|
---|
118 | /* This is used to evaluate if NTLM is supported */
|
---|
119 | bool Curl_auth_is_ntlm_supported(void);
|
---|
120 |
|
---|
121 | /* This is used to generate a base64 encoded NTLM type-1 message */
|
---|
122 | CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
|
---|
123 | const char *userp,
|
---|
124 | const char *passwdp,
|
---|
125 | const char *service,
|
---|
126 | const char *host,
|
---|
127 | struct ntlmdata *ntlm,
|
---|
128 | char **outptr,
|
---|
129 | size_t *outlen);
|
---|
130 |
|
---|
131 | /* This is used to decode a base64 encoded NTLM type-2 message */
|
---|
132 | CURLcode Curl_auth_decode_ntlm_type2_message(struct Curl_easy *data,
|
---|
133 | const char *type2msg,
|
---|
134 | struct ntlmdata *ntlm);
|
---|
135 |
|
---|
136 | /* This is used to generate a base64 encoded NTLM type-3 message */
|
---|
137 | CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
|
---|
138 | const char *userp,
|
---|
139 | const char *passwdp,
|
---|
140 | struct ntlmdata *ntlm,
|
---|
141 | char **outptr, size_t *outlen);
|
---|
142 |
|
---|
143 | /* This is used to clean up the NTLM specific data */
|
---|
144 | void Curl_auth_ntlm_cleanup(struct ntlmdata *ntlm);
|
---|
145 | #endif /* USE_NTLM */
|
---|
146 |
|
---|
147 | /* This is used to generate a base64 encoded OAuth 2.0 message */
|
---|
148 | CURLcode Curl_auth_create_oauth_bearer_message(struct Curl_easy *data,
|
---|
149 | const char *user,
|
---|
150 | const char *host,
|
---|
151 | const long port,
|
---|
152 | const char *bearer,
|
---|
153 | char **outptr, size_t *outlen);
|
---|
154 | #if defined(USE_KERBEROS5)
|
---|
155 | /* This is used to evaluate if GSSAPI (Kerberos V5) is supported */
|
---|
156 | bool Curl_auth_is_gssapi_supported(void);
|
---|
157 |
|
---|
158 | /* This is used to generate a base64 encoded GSSAPI (Kerberos V5) user token
|
---|
159 | message */
|
---|
160 | CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
|
---|
161 | const char *userp,
|
---|
162 | const char *passwdp,
|
---|
163 | const char *service,
|
---|
164 | const char *host,
|
---|
165 | const bool mutual,
|
---|
166 | const char *chlg64,
|
---|
167 | struct kerberos5data *krb5,
|
---|
168 | char **outptr, size_t *outlen);
|
---|
169 |
|
---|
170 | /* This is used to generate a base64 encoded GSSAPI (Kerberos V5) security
|
---|
171 | token message */
|
---|
172 | CURLcode Curl_auth_create_gssapi_security_message(struct Curl_easy *data,
|
---|
173 | const char *input,
|
---|
174 | struct kerberos5data *krb5,
|
---|
175 | char **outptr,
|
---|
176 | size_t *outlen);
|
---|
177 |
|
---|
178 | /* This is used to clean up the GSSAPI specific data */
|
---|
179 | void Curl_auth_gssapi_cleanup(struct kerberos5data *krb5);
|
---|
180 | #endif /* USE_KERBEROS5 */
|
---|
181 |
|
---|
182 | #if defined(USE_SPNEGO)
|
---|
183 | /* This is used to evaluate if SPNEGO (Negotiate) is supported */
|
---|
184 | bool Curl_auth_is_spnego_supported(void);
|
---|
185 |
|
---|
186 | /* This is used to decode a base64 encoded SPNEGO (Negotiate) challenge
|
---|
187 | message */
|
---|
188 | CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
|
---|
189 | const char *user,
|
---|
190 | const char *passwood,
|
---|
191 | const char *service,
|
---|
192 | const char *host,
|
---|
193 | const char *chlg64,
|
---|
194 | struct negotiatedata *nego);
|
---|
195 |
|
---|
196 | /* This is used to generate a base64 encoded SPNEGO (Negotiate) response
|
---|
197 | message */
|
---|
198 | CURLcode Curl_auth_create_spnego_message(struct Curl_easy *data,
|
---|
199 | struct negotiatedata *nego,
|
---|
200 | char **outptr, size_t *outlen);
|
---|
201 |
|
---|
202 | /* This is used to clean up the SPNEGO specifiec data */
|
---|
203 | void Curl_auth_spnego_cleanup(struct negotiatedata *nego);
|
---|
204 |
|
---|
205 | #endif /* USE_SPNEGO */
|
---|
206 |
|
---|
207 | #endif /* HEADER_CURL_VAUTH_H */
|
---|