lib/kadm5: find_db_spec do not leak 'info'
[heimdal.git] / kdc / token_validator_plugin.h
blob73b05e5d007fc096e62705e336497138e3e88550
1 /*
2 * Copyright (c) 2019 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
34 #ifndef HEIMDAL_KDC_BEARER_TOKEN_PLUGIN_H
35 #define HEIMDAL_KDC_BEARER_TOKEN_PLUGIN_H 1
37 #define KDC_PLUGIN_BEARER "kdc_token_validator"
38 #define KDC_PLUGIN_BEARER_VERSION_0 0
41 * @param init Plugin initialization function (see krb5-plugin(7))
42 * @param minor_version The plugin minor version number (0)
43 * @param fini Plugin finalization function
44 * @param validate Plugin token validation function
46 * The validate field is the plugin entry point that performs the bearer token
47 * validation operation however the plugin desires. It is invoked in no
48 * particular order relative to other bearer token validator plugins. The
49 * plugin validate function must return KRB5_PLUGIN_NO_HANDLE if the rule is
50 * not applicable to it.
52 * The plugin validate function has the following arguments, in this
53 * order:
55 * -# plug_ctx, the context value output by the plugin's init function
56 * -# context, a krb5_context
57 * -# realm, a const char *
58 * -# token_type, a const char *
59 * -# token, a krb5_data *
60 * -# audiences, a const pointer to an array of const char * containing
61 * expected audiences of the token (aka, acceptor names)
62 * -# naudiences, a size_t count of audiences
63 * -# requested_principal, a krb5_const_principal
64 * -# validation result, a pointer to a krb5_boolean
65 * -# actual principal, a krb5_principal * output parameter (optional)
67 * @ingroup krb5_support
69 typedef struct krb5plugin_token_validator_ftable_desc {
70 int minor_version;
71 krb5_error_code (KRB5_LIB_CALL *init)(krb5_context, void **);
72 void (KRB5_LIB_CALL *fini)(void *);
73 krb5_error_code (KRB5_LIB_CALL *validate)(void *, /*plug_ctx*/
74 krb5_context,
75 const char *, /*realm*/
76 const char *, /*token_type*/
77 krb5_data *, /*token*/
78 const char * const *, /*audiences*/
79 size_t, /*naudiences*/
80 krb5_boolean *, /*valid*/
81 krb5_principal *, /*actual_principal*/
82 krb5_times *); /*token_times*/
83 } krb5plugin_token_validator_ftable;
85 #endif /* HEIMDAL_KDC_BEARER_TOKEN_PLUGIN_H */