aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/tvmauth/checked_service_ticket.h
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/tvmauth/checked_service_ticket.h
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/tvmauth/checked_service_ticket.h')
-rw-r--r--library/cpp/tvmauth/checked_service_ticket.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/library/cpp/tvmauth/checked_service_ticket.h b/library/cpp/tvmauth/checked_service_ticket.h
new file mode 100644
index 0000000000..cf4c5c43e3
--- /dev/null
+++ b/library/cpp/tvmauth/checked_service_ticket.h
@@ -0,0 +1,71 @@
+#pragma once
+
+#include "ticket_status.h"
+#include "type.h"
+#include "utils.h"
+
+#include <util/generic/ptr.h>
+
+namespace NTvmAuth::NInternal {
+ class TCanningKnife;
+}
+
+namespace NTvmAuth {
+ class TCheckedServiceTicket {
+ public:
+ class TImpl;
+
+ TCheckedServiceTicket(THolder<TImpl> impl);
+ TCheckedServiceTicket(TCheckedServiceTicket&& o);
+ ~TCheckedServiceTicket();
+
+ TCheckedServiceTicket& operator=(TCheckedServiceTicket&&);
+
+ /*!
+ * @return True value if ticket parsed and checked successfully
+ */
+ explicit operator bool() const;
+
+ /*!
+ * You should check src with your ACL
+ * @return TvmId of request source
+ */
+ TTvmId GetSrc() const;
+
+ /*!
+ * @return Ticket check status
+ */
+ ETicketStatus GetStatus() const;
+
+ /*!
+ * DebugInfo is human readable data for debug purposes
+ * @return Serialized ticket
+ */
+ TString DebugInfo() const;
+
+ /*!
+ * IssuerUID is UID of developer who is debuging something,
+ * so he(she) issued ServiceTicket with his(her) ssh-sign:
+ * it is grant_type=sshkey in tvm-api.
+ * https://wiki.yandex-team.ru/passport/tvm2/debug/#sxoditvapizakrytoeserviceticketami
+ * @return uid
+ */
+ TMaybe<TUid> GetIssuerUid() const;
+
+ public: // for python binding
+ TCheckedServiceTicket() = default;
+
+ private:
+ THolder<TImpl> Impl_;
+ friend class NInternal::TCanningKnife;
+ };
+
+ namespace NBlackboxTvmId {
+ const TStringBuf Prod = "222";
+ const TStringBuf Test = "224";
+ const TStringBuf ProdYateam = "223";
+ const TStringBuf TestYateam = "225";
+ const TStringBuf Stress = "226";
+ const TStringBuf Mimino = "239";
+ }
+}