| 1 |
/* |
| 2 |
* Copyright (C) 2013 Red Hat, Inc. |
| 3 |
* SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef __COCKPIT_CREDS_H__ |
| 7 |
#define __COCKPIT_CREDS_H__ |
| 8 |
|
| 9 |
#include <glib.h> |
| 10 |
#include <glib-object.h> |
| 11 |
|
| 12 |
#include <json-glib/json-glib.h> |
| 13 |
|
| 14 |
G_BEGIN_DECLS |
| 15 |
|
| 16 |
typedef struct _CockpitCreds CockpitCreds; |
| 17 |
|
| 18 |
#define COCKPIT_CRED_USER "user" |
| 19 |
#define COCKPIT_CRED_PASSWORD "password" |
| 20 |
#define COCKPIT_CRED_RHOST "rhost" |
| 21 |
#define COCKPIT_CRED_CSRF_TOKEN "csrf-token" |
| 22 |
#define COCKPIT_CRED_SUPERUSER "superuser" |
| 23 |
|
| 24 |
GType cockpit_creds_get_type (void) G_GNUC_CONST; |
| 25 |
|
| 26 |
CockpitCreds * cockpit_creds_new (const gchar *application, |
| 27 |
...) G_GNUC_NULL_TERMINATED; |
| 28 |
|
| 29 |
CockpitCreds * cockpit_creds_ref (CockpitCreds *creds); |
| 30 |
|
| 31 |
void cockpit_creds_unref (gpointer creds); |
| 32 |
|
| 33 |
void cockpit_creds_poison (CockpitCreds *creds); |
| 34 |
|
| 35 |
const gchar * cockpit_creds_get_user (CockpitCreds *creds); |
| 36 |
|
| 37 |
void cockpit_creds_set_user (CockpitCreds *creds, |
| 38 |
const gchar *user); |
| 39 |
|
| 40 |
GBytes * cockpit_creds_get_password (CockpitCreds *creds); |
| 41 |
|
| 42 |
void cockpit_creds_set_password (CockpitCreds *creds, |
| 43 |
GBytes *password); |
| 44 |
|
| 45 |
const gchar * cockpit_creds_get_rhost (CockpitCreds *creds); |
| 46 |
|
| 47 |
const gchar * cockpit_creds_get_csrf_token (CockpitCreds *creds); |
| 48 |
|
| 49 |
const gchar * cockpit_creds_get_superuser (CockpitCreds *creds); |
| 50 |
|
| 51 |
const gchar * cockpit_creds_get_application (CockpitCreds *creds); |
| 52 |
|
| 53 |
void cockpit_creds_set_login_data (CockpitCreds *creds, |
| 54 |
JsonObject *login_data); |
| 55 |
|
| 56 |
JsonObject * cockpit_creds_get_login_data (CockpitCreds *creds); |
| 57 |
|
| 58 |
JsonObject * cockpit_creds_to_json (CockpitCreds *creds); |
| 59 |
|
| 60 |
G_DEFINE_AUTOPTR_CLEANUP_FUNC(CockpitCreds, cockpit_creds_unref) |
| 61 |
|
| 62 |
G_END_DECLS |
| 63 |
|
| 64 |
#endif |