aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/tvmauth/src/status.cpp
blob: 1b08fc098f9864a5f4e22ee3f7230888e7aa6922 (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
#include <library/cpp/tvmauth/ticket_status.h>

#include <util/generic/yexception.h>

namespace NTvmAuth {
    TStringBuf StatusToString(ETicketStatus st) {
        switch (st) {
            case ETicketStatus::Ok:
                return "OK";
            case ETicketStatus::Expired:
                return "Expired ticket";
            case ETicketStatus::InvalidBlackboxEnv:
                return "Invalid BlackBox environment";
            case ETicketStatus::InvalidDst:
                return "Invalid ticket destination";
            case ETicketStatus::InvalidTicketType:
                return "Invalid ticket type";
            case ETicketStatus::Malformed:
                return "Malformed ticket";
            case ETicketStatus::MissingKey:
                return "Context does not have required key to check ticket: public keys are too old";
            case ETicketStatus::SignBroken:
                return "Invalid ticket signature";
            case ETicketStatus::UnsupportedVersion:
                return "Unsupported ticket version";
            case ETicketStatus::NoRoles:
                return "Subject (src or defaultUid) does not have any roles in IDM";
        }

        ythrow yexception() << "Unexpected status: " << static_cast<int>(st);
    }
}