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 22extern "C" { 23#endif 24 25void 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. */ 31const 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 **/ 37apr_status_t serf__init_basic(int code, 38 serf_context_t *ctx, 39 apr_pool_t *pool); 40apr_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); 44apr_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); 51apr_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 **/ 60apr_status_t serf__init_digest(int code, 61 serf_context_t *ctx, 62 apr_pool_t *pool); 63apr_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); 67apr_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); 74apr_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); 81apr_status_t serf__validate_response_digest_auth(const serf__authn_scheme_t *scheme, 82 peer_t peer, 83 int code, 84 serf_connection_t *conn, 85 serf_request_t *request, 86 serf_bucket_t *response, 87 apr_pool_t *pool); 88 89#ifdef SERF_HAVE_SPNEGO 90/** Kerberos authentication **/ 91apr_status_t serf__init_spnego(int code, 92 serf_context_t *ctx, 93 apr_pool_t *pool); 94apr_status_t serf__init_spnego_connection(const serf__authn_scheme_t *scheme, 95 int code, 96 serf_connection_t *conn, 97 apr_pool_t *pool); 98apr_status_t serf__handle_spnego_auth(int code, 99 serf_request_t *request, 100 serf_bucket_t *response, 101 const char *auth_hdr, 102 const char *auth_attr, 103 void *baton, 104 apr_pool_t *pool); 105apr_status_t serf__setup_request_spnego_auth(peer_t peer, 106 int code, 107 serf_connection_t *conn, 108 serf_request_t *request, 109 const char *method, 110 const char *uri, 111 serf_bucket_t *hdrs_bkt); 112apr_status_t serf__validate_response_spnego_auth(const serf__authn_scheme_t *scheme, 113 peer_t peer, 114 int code, 115 serf_connection_t *conn, 116 serf_request_t *request, 117 serf_bucket_t *response, 118 apr_pool_t *pool); 119#endif /* SERF_HAVE_SPNEGO */ 120 121#ifdef __cplusplus 122} 123#endif 124 125#endif /* !AUTH_H */ 126