Couchbase C Client  2.10.0
Asynchronous C Client for Couchbase
auth.h
Go to the documentation of this file.
1 /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3  * Copyright 2017-2018 Couchbase, Inc.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef LCB_AUTH_H
19 #define LCB_AUTH_H
20 
26 #ifdef __cplusplus
27 namespace lcb { class Authenticator; }
28 typedef lcb::Authenticator lcb_AUTHENTICATOR;
29 extern "C" {
30 #else /* C only! */
31 typedef struct lcb_AUTHENTICATOR_Cdummy lcb_AUTHENTICATOR;
32 #endif
33 
139 LIBCOUCHBASE_API
141 lcbauth_new(void);
142 
146 typedef enum {
148  LCBAUTH_F_CLUSTER = 1<<1,
155  LCBAUTH_F_BUCKET = 1<<2
157 
179 LIBCOUCHBASE_API
181 lcbauth_add_pass(lcb_AUTHENTICATOR *auth, const char *user, const char *pass, int flags);
182 
193 LIBCOUCHBASE_API
194 void
196 
205 LIBCOUCHBASE_API
206 void
208 
220 LIBCOUCHBASE_API
222 lcbauth_clone(const lcb_AUTHENTICATOR *src);
223 
235 typedef const char *(*lcb_AUTHCALLBACK)(void *cookie, const char *host, const char *port, const char *bucket);
236 
247 LIBCOUCHBASE_API
248 lcb_error_t lcbauth_set_callbacks(lcb_AUTHENTICATOR *auth, void *cookie, lcb_AUTHCALLBACK usercb,
249  lcb_AUTHCALLBACK passcb);
250 
251 typedef enum {
257 
265  LCBAUTH_MODE_RBAC = 1,
266 
273  LCBAUTH_MODE_DYNAMIC = 2
274 } lcbauth_MODE;
275 
288 LIBCOUCHBASE_API
291 
294 #ifdef __cplusplus
295 }
296 #endif
297 #endif /* LCB_AUTH_H */
lcb_AUTHENTICATOR * lcbauth_clone(const lcb_AUTHENTICATOR *src)
lcbauth_ADDPASSFLAGS
Flags to use when adding a new set of credentials to lcbauth_add_pass.
Definition: auth.h:147
lcb_error_t lcbauth_add_pass(lcb_AUTHENTICATOR *auth, const char *user, const char *pass, int flags)
lcbauth_MODE
Definition: auth.h:256
lcb_AUTHENTICATOR * lcbauth_new(void)
Opaque pointer containing credentials for the library.
void lcbauth_ref(lcb_AUTHENTICATOR *auth)
Use "bucket-specific" credentials when authenticating.
Definition: auth.h:261
lcb_error_t lcbauth_set_mode(lcb_AUTHENTICATOR *src, lcbauth_MODE mode)
lcb_error_t
Error codes returned by the library.
Definition: error.h:580
User is bucket name.
Definition: auth.h:156
User/Password is administrative; for cluster.
Definition: auth.h:149
void lcbauth_unref(lcb_AUTHENTICATOR *auth)
Use role-based access control.
Definition: auth.h:270