aboutsummaryrefslogtreecommitdiffstats
path: root/library/java/tvmauth/examples/create_with_tvmtool/Create.java
blob: 351327a057518004f83c9a5ed013940af4984c82 (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
package ru.yandex.example;

import ru.yandex.passport.tvmauth.NativeTvmClient;
import ru.yandex.passport.tvmauth.TvmClient;
import ru.yandex.passport.tvmauth.TvmToolSettings;

public class Create {
    // Possibility of using functions depends on config of tvmtool
    //    checkServiceTicket
    //    checkUserTicket
    //    getServiceTicketFor

    public static TvmClient createClientInQloudOrYandexDeploy() {
        TvmToolSettings settings = TvmToolSettings.create("my_service");

        NativeTvmClient c = new NativeTvmClient(settings);

        return c;
    }

    public static TvmClient createClientForDevOrTests() {
        TvmToolSettings settings = TvmToolSettings.create("my_service");
        settings.setPort(18080);
        settings.setAuthToken("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");

        NativeTvmClient c = new NativeTvmClient(settings);

        return c;
    }
}