]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/serf/auth/auth.h
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / contrib / serf / auth / auth.h
1 /* Copyright 2009 Justin Erenkrantz and Greg Stein
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #ifndef AUTH_H
17 #define AUTH_H
18
19 #include "auth_spnego.h"
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 void serf__encode_auth_header(const char **header, const char *protocol,
26                               const char *data, apr_size_t data_len,
27                               apr_pool_t *pool);
28
29 /* Prefixes the realm_name with a string containing scheme, hostname and port
30    of the connection, for providing it to the application. */
31 const char *serf__construct_realm(peer_t peer,
32                                   serf_connection_t *conn,
33                                   const char *realm_name,
34                                   apr_pool_t *pool);
35
36 /** Basic authentication **/
37 apr_status_t serf__init_basic(int code,
38                               serf_context_t *ctx,
39                               apr_pool_t *pool);
40 apr_status_t serf__init_basic_connection(const serf__authn_scheme_t *scheme,
41                                          int code,
42                                          serf_connection_t *conn,
43                                          apr_pool_t *pool);
44 apr_status_t serf__handle_basic_auth(int code,
45                                      serf_request_t *request,
46                                      serf_bucket_t *response,
47                                      const char *auth_hdr,
48                                      const char *auth_attr,
49                                      void *baton,
50                                      apr_pool_t *pool);
51 apr_status_t serf__setup_request_basic_auth(peer_t peer,
52                                             int code,
53                                             serf_connection_t *conn,
54                                             serf_request_t *request,
55                                             const char *method,
56                                             const char *uri,
57                                             serf_bucket_t *hdrs_bkt);
58
59 /** Digest authentication **/
60 apr_status_t serf__init_digest(int code,
61                                serf_context_t *ctx,
62                                apr_pool_t *pool);
63 apr_status_t serf__init_digest_connection(const serf__authn_scheme_t *scheme,
64                                           int code,
65                                           serf_connection_t *conn,
66                                           apr_pool_t *pool);
67 apr_status_t serf__handle_digest_auth(int code,
68                                       serf_request_t *request,
69                                       serf_bucket_t *response,
70                                       const char *auth_hdr,
71                                       const char *auth_attr,
72                                       void *baton,
73                                       apr_pool_t *pool);
74 apr_status_t serf__setup_request_digest_auth(peer_t peer,
75                                              int code,
76                                              serf_connection_t *conn,
77                                              serf_request_t *request,
78                                              const char *method,
79                                              const char *uri,
80                                              serf_bucket_t *hdrs_bkt);
81 apr_status_t serf__validate_response_digest_auth(peer_t peer,
82                                                  int code,
83                                                  serf_connection_t *conn,
84                                                  serf_request_t *request,
85                                                  serf_bucket_t *response,
86                                                  apr_pool_t *pool);
87
88 #ifdef SERF_HAVE_SPNEGO
89 /** Kerberos authentication **/
90 apr_status_t serf__init_spnego(int code,
91                                serf_context_t *ctx,
92                                apr_pool_t *pool);
93 apr_status_t serf__init_spnego_connection(const serf__authn_scheme_t *scheme,
94                                           int code,
95                                           serf_connection_t *conn,
96                                           apr_pool_t *pool);
97 apr_status_t serf__handle_spnego_auth(int code,
98                                      serf_request_t *request,
99                                      serf_bucket_t *response,
100                                      const char *auth_hdr,
101                                      const char *auth_attr,
102                                      void *baton,
103                                      apr_pool_t *pool);
104 apr_status_t serf__setup_request_spnego_auth(peer_t peer,
105                                              int code,
106                                              serf_connection_t *conn,
107                                              serf_request_t *request,
108                                              const char *method,
109                                              const char *uri,
110                                              serf_bucket_t *hdrs_bkt);
111 apr_status_t serf__validate_response_spnego_auth(peer_t peer,
112                                                  int code,
113                                                  serf_connection_t *conn,
114                                                  serf_request_t *request,
115                                                  serf_bucket_t *response,
116                                                  apr_pool_t *pool);
117 #endif /* SERF_HAVE_SPNEGO */
118
119 #ifdef __cplusplus
120 }
121 #endif
122
123 #endif    /* !AUTH_H */