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