aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/tvmauth/client/misc/roles/parser.h
blob: 0982ba78c6517189a120ed58b5406a359acf9ec3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once

#include "roles.h"
#include "types.h"

namespace NJson {
    class TJsonValue;
}

namespace NTvmAuth::NRoles {
    class TParser {
    public:
        static TRolesPtr Parse(TRawPtr decodedBlob);

    public:
        static TRolesPtr ParseImpl(TRawPtr decodedBlob);
        static TRoles::TMeta GetMeta(const NJson::TJsonValue& doc);

        template <typename Id>
        static THashMap<Id, TConsumerRolesPtr> GetConsumers(
            const NJson::TJsonValue& doc,
            TStringBuf key);

        static TConsumerRolesPtr GetConsumer(
            const NJson::TJsonValue& obj,
            TStringBuf consumer);
        static TEntitiesPtr GetEntities(
            const NJson::TJsonValue& obj,
            TStringBuf consumer,
            TStringBuf role);
        static TEntityPtr GetEntity(
            const NJson::TJsonValue& obj,
            TStringBuf consumer,
            TStringBuf role);
    };
}