aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/tvmauth/client/misc/checker.h
diff options
context:
space:
mode:
authorcerevra <cerevra@yandex-team.ru>2022-02-10 16:45:59 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:59 +0300
commit4f292c7e2fd0a41da93fda51b2d440c979a330b7 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/tvmauth/client/misc/checker.h
parentbf41dd01f6c920583e9faae7cd55ed25e547e052 (diff)
downloadydb-4f292c7e2fd0a41da93fda51b2d440c979a330b7.tar.gz
Restoring authorship annotation for <cerevra@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/tvmauth/client/misc/checker.h')
-rw-r--r--library/cpp/tvmauth/client/misc/checker.h134
1 files changed, 67 insertions, 67 deletions
diff --git a/library/cpp/tvmauth/client/misc/checker.h b/library/cpp/tvmauth/client/misc/checker.h
index 608b7a2f39..e8ed2f5503 100644
--- a/library/cpp/tvmauth/client/misc/checker.h
+++ b/library/cpp/tvmauth/client/misc/checker.h
@@ -1,67 +1,67 @@
-#pragma once
-
-#include "async_updater.h"
-
-#include <library/cpp/tvmauth/client/exception.h>
-
-#include <library/cpp/tvmauth/checked_service_ticket.h>
-#include <library/cpp/tvmauth/checked_user_ticket.h>
-
-namespace NTvmAuth {
- class TServiceTicketChecker {
- public:
- TServiceTicketChecker(TAsyncUpdaterPtr updater)
- : Updater_(std::move(updater))
- {
- Y_ENSURE(Updater_);
- GetCache();
- }
-
- /*!
- * Checking must be enabled in TClientSettings
- * Can throw exception if cache is out of date or wrong config
- * @param ticket
- */
- TCheckedServiceTicket Check(TStringBuf ticket) const {
- return GetCache()->Check(ticket);
- }
-
- private:
- TServiceContextPtr GetCache() const {
- TServiceContextPtr c = Updater_->GetCachedServiceContext();
- Y_ENSURE_EX(c, TBrokenTvmClientSettings() << "Need to use TClientSettings::EnableServiceTicketChecking()");
- return c;
- }
-
- private:
- TAsyncUpdaterPtr Updater_;
- };
-
- class TUserTicketChecker {
- public:
- TUserTicketChecker(TAsyncUpdaterPtr updater)
- : Updater_(std::move(updater))
- {
- Y_ENSURE(Updater_);
- GetCache({});
- }
-
- /*!
- * Blackbox enviroment must be cofingured in TClientSettings
- * Can throw exception if cache is out of date or wrong config
- */
- TCheckedUserTicket Check(TStringBuf ticket, TMaybe<EBlackboxEnv> overridenEnv) const {
- return GetCache(overridenEnv)->Check(ticket);
- }
-
- private:
- TUserContextPtr GetCache(TMaybe<EBlackboxEnv> overridenEnv) const {
- TUserContextPtr c = Updater_->GetCachedUserContext(overridenEnv);
- Y_ENSURE_EX(c, TBrokenTvmClientSettings() << "Need to use TClientSettings::EnableUserTicketChecking()");
- return c;
- }
-
- private:
- TAsyncUpdaterPtr Updater_;
- };
-}
+#pragma once
+
+#include "async_updater.h"
+
+#include <library/cpp/tvmauth/client/exception.h>
+
+#include <library/cpp/tvmauth/checked_service_ticket.h>
+#include <library/cpp/tvmauth/checked_user_ticket.h>
+
+namespace NTvmAuth {
+ class TServiceTicketChecker {
+ public:
+ TServiceTicketChecker(TAsyncUpdaterPtr updater)
+ : Updater_(std::move(updater))
+ {
+ Y_ENSURE(Updater_);
+ GetCache();
+ }
+
+ /*!
+ * Checking must be enabled in TClientSettings
+ * Can throw exception if cache is out of date or wrong config
+ * @param ticket
+ */
+ TCheckedServiceTicket Check(TStringBuf ticket) const {
+ return GetCache()->Check(ticket);
+ }
+
+ private:
+ TServiceContextPtr GetCache() const {
+ TServiceContextPtr c = Updater_->GetCachedServiceContext();
+ Y_ENSURE_EX(c, TBrokenTvmClientSettings() << "Need to use TClientSettings::EnableServiceTicketChecking()");
+ return c;
+ }
+
+ private:
+ TAsyncUpdaterPtr Updater_;
+ };
+
+ class TUserTicketChecker {
+ public:
+ TUserTicketChecker(TAsyncUpdaterPtr updater)
+ : Updater_(std::move(updater))
+ {
+ Y_ENSURE(Updater_);
+ GetCache({});
+ }
+
+ /*!
+ * Blackbox enviroment must be cofingured in TClientSettings
+ * Can throw exception if cache is out of date or wrong config
+ */
+ TCheckedUserTicket Check(TStringBuf ticket, TMaybe<EBlackboxEnv> overridenEnv) const {
+ return GetCache(overridenEnv)->Check(ticket);
+ }
+
+ private:
+ TUserContextPtr GetCache(TMaybe<EBlackboxEnv> overridenEnv) const {
+ TUserContextPtr c = Updater_->GetCachedUserContext(overridenEnv);
+ Y_ENSURE_EX(c, TBrokenTvmClientSettings() << "Need to use TClientSettings::EnableUserTicketChecking()");
+ return c;
+ }
+
+ private:
+ TAsyncUpdaterPtr Updater_;
+ };
+}