aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/service/auth/tvm/auth.h
blob: 432beff9d6dc9a62dc9987494e12097f948fa5ce (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
#pragma once

#include <library/cpp/monlib/service/mon_service_http_request.h>
#include <library/cpp/monlib/service/auth.h>
#include <library/cpp/tvmauth/client/facade.h>

namespace NMonitoring {
    struct ITvmManager {
        virtual ~ITvmManager() = default;
        virtual bool IsAllowedClient(NTvmAuth::TTvmId clientId) = 0;
        virtual NTvmAuth::TCheckedServiceTicket CheckServiceTicket(TStringBuf ticket) = 0;
    };

    THolder<ITvmManager> CreateDefaultTvmManager(
        NTvmAuth::NTvmApi::TClientSettings settings,
        TVector<NTvmAuth::TTvmId> allowedClients,
        NTvmAuth::TLoggerPtr logger = NTvmAuth::TDevNullLogger::IAmBrave());

    THolder<ITvmManager> CreateDefaultTvmManager(
        NTvmAuth::NTvmTool::TClientSettings settings,
        TVector<NTvmAuth::TTvmId> allowedClients,
        NTvmAuth::TLoggerPtr logger = NTvmAuth::TDevNullLogger::IAmBrave());

    THolder<ITvmManager> CreateDefaultTvmManager(
        TAtomicSharedPtr<NTvmAuth::TTvmClient> client,
        TVector<NTvmAuth::TTvmId> allowedClients);

    THolder<ITvmManager> CreateDefaultTvmManager(
        std::shared_ptr<NTvmAuth::TTvmClient> client,
        TVector<NTvmAuth::TTvmId> allowedClients);

    THolder<IAuthProvider> CreateTvmAuth(THolder<ITvmManager> tvmManager);
} // namespace NMonitoring