aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/tvmauth/client/examples/create_with_tvmtool/create.cpp
blob: a87d3e705d9abf75fa05e6dfa041ad4ab8bc1bb2 (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
#include <library/cpp/tvmauth/client/facade.h>

namespace NExample {
    // Possibility of using functions depends on config of tvmtool
    //    CheckServiceTicket
    //    CheckUserTicket
    //    GetServiceTicketFor

    NTvmAuth::TTvmClient CreateClientInQloudOrYandexDeploy() {
        NTvmAuth::NTvmTool::TClientSettings setts(
            "my_service" // specified in Qloud/YP/tvmtool interface
        );

        NTvmAuth::TLoggerPtr log = MakeIntrusive<NTvmAuth::TCerrLogger>(7);

        NTvmAuth::TTvmClient c(setts, log);

        return c;
    }

    NTvmAuth::TTvmClient CreateClientForDevOrTests() {
        NTvmAuth::NTvmTool::TClientSettings setts(
            "my_service" // specified in Qloud/YP/tvmtool interface
        );
        setts.SetPort(18080);
        setts.SetAuthToken("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");

        NTvmAuth::TLoggerPtr log = MakeIntrusive<NTvmAuth::TCerrLogger>(7);

        NTvmAuth::TTvmClient c(setts, log);

        return c;
    }
}