Daniel P. Berrangé | fb5c4eb | 2018-05-02 15:40:33 +0100 | [diff] [blame] | 1 | /* |
| 2 | * QEMU simple authorization driver |
| 3 | * |
| 4 | * Copyright (c) 2018 Red Hat, Inc. |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
Chetan Pant | 036a80c | 2020-10-14 13:49:02 +0000 | [diff] [blame] | 9 | * version 2.1 of the License, or (at your option) any later version. |
Daniel P. Berrangé | fb5c4eb | 2018-05-02 15:40:33 +0100 | [diff] [blame] | 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | */ |
| 20 | |
Markus Armbruster | a8b991b | 2019-03-15 15:51:21 +0100 | [diff] [blame] | 21 | #ifndef QAUTHZ_SIMPLE_H |
| 22 | #define QAUTHZ_SIMPLE_H |
Daniel P. Berrangé | fb5c4eb | 2018-05-02 15:40:33 +0100 | [diff] [blame] | 23 | |
| 24 | #include "authz/base.h" |
Eduardo Habkost | db1015e | 2020-09-03 16:43:22 -0400 | [diff] [blame] | 25 | #include "qom/object.h" |
Daniel P. Berrangé | fb5c4eb | 2018-05-02 15:40:33 +0100 | [diff] [blame] | 26 | |
| 27 | #define TYPE_QAUTHZ_SIMPLE "authz-simple" |
| 28 | |
Eduardo Habkost | 30b5707 | 2020-09-16 14:25:17 -0400 | [diff] [blame] | 29 | OBJECT_DECLARE_SIMPLE_TYPE(QAuthZSimple, |
Eduardo Habkost | c734cd4 | 2020-09-16 14:25:16 -0400 | [diff] [blame] | 30 | QAUTHZ_SIMPLE) |
Daniel P. Berrangé | fb5c4eb | 2018-05-02 15:40:33 +0100 | [diff] [blame] | 31 | |
Daniel P. Berrangé | fb5c4eb | 2018-05-02 15:40:33 +0100 | [diff] [blame] | 32 | |
| 33 | |
| 34 | /** |
| 35 | * QAuthZSimple: |
| 36 | * |
| 37 | * This authorization driver provides a simple mechanism |
| 38 | * for granting access based on an exact matched username. |
| 39 | * |
| 40 | * To create an instance of this class via QMP: |
| 41 | * |
| 42 | * { |
| 43 | * "execute": "object-add", |
| 44 | * "arguments": { |
| 45 | * "qom-type": "authz-simple", |
| 46 | * "id": "authz0", |
| 47 | * "props": { |
| 48 | * "identity": "fred" |
| 49 | * } |
| 50 | * } |
| 51 | * } |
| 52 | * |
| 53 | * Or via the command line |
| 54 | * |
| 55 | * -object authz-simple,id=authz0,identity=fred |
| 56 | * |
| 57 | */ |
| 58 | struct QAuthZSimple { |
| 59 | QAuthZ parent_obj; |
| 60 | |
| 61 | char *identity; |
| 62 | }; |
| 63 | |
| 64 | |
Daniel P. Berrangé | fb5c4eb | 2018-05-02 15:40:33 +0100 | [diff] [blame] | 65 | |
| 66 | |
| 67 | QAuthZSimple *qauthz_simple_new(const char *id, |
| 68 | const char *identity, |
| 69 | Error **errp); |
| 70 | |
| 71 | |
Markus Armbruster | a8b991b | 2019-03-15 15:51:21 +0100 | [diff] [blame] | 72 | #endif /* QAUTHZ_SIMPLE_H */ |