summaryrefslogtreecommitdiffstats
path: root/library/cpp/tvmauth/client/mocked_updater.h
blob: d20cf5f53f4f5a41b8e20d0d88f9c7bb2e372c78 (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
37
38
39
40
41
42
43
#pragma once 
 
#include "misc/async_updater.h" 
 
namespace NTvmAuth { 
    class TMockedUpdater: public TAsyncUpdaterBase { 
    public: 
        struct TSettings { 
            struct TTuple { 
                TClientSettings::TAlias Alias; 
                TTvmId Id = 0; 
                TString Value; // ticket or error 
            }; 
 
            TTvmId SelfTvmId = 0; 
            TVector<TTuple> Backends; 
            TVector<TTuple> BadBackends; 
            EBlackboxEnv UserTicketEnv = EBlackboxEnv::Test; 
            NRoles::TRolesPtr Roles; 
 
            static TSettings CreateDeafult(); 
        }; 
 
        TMockedUpdater(const TSettings& settings = TSettings::CreateDeafult()); 
 
        TClientStatus GetStatus() const override { 
            return TClientStatus(); 
        } 
 
        NRoles::TRolesPtr GetRoles() const override { 
            return Roles_; 
        } 
 
        using TAsyncUpdaterBase::SetServiceContext; 
        using TAsyncUpdaterBase::SetServiceTickets; 
        using TAsyncUpdaterBase::SetUpdateTimeOfPublicKeys; 
        using TAsyncUpdaterBase::SetUpdateTimeOfServiceTickets; 
        using TAsyncUpdaterBase::SetUserContext; 
 
    protected: 
        NRoles::TRolesPtr Roles_; 
    }; 
}