From 21c9b0e6b039e9765eb414c406c2b86e8cea6850 Mon Sep 17 00:00:00 2001 From: komels <komels@yandex-team.ru> Date: Thu, 14 Apr 2022 13:10:53 +0300 Subject: Final part on compatibility layer: LOGBROKER-7215 ref:777c67aadbf705d19034a09a792b2df61ba53697 --- library/cpp/tvmauth/deprecated/service_context.cpp | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 library/cpp/tvmauth/deprecated/service_context.cpp (limited to 'library/cpp/tvmauth/deprecated/service_context.cpp') diff --git a/library/cpp/tvmauth/deprecated/service_context.cpp b/library/cpp/tvmauth/deprecated/service_context.cpp new file mode 100644 index 0000000000..24822a9d53 --- /dev/null +++ b/library/cpp/tvmauth/deprecated/service_context.cpp @@ -0,0 +1,37 @@ +#include <library/cpp/tvmauth/checked_service_ticket.h> +#include <library/cpp/tvmauth/src/service_impl.h> + +namespace NTvmAuth { + static const char* EX_MSG = "ServiceContext already moved out"; + + TServiceContext::TServiceContext(TStringBuf secretBase64, TTvmId selfTvmId, TStringBuf tvmKeysResponse) + : Impl_(MakeHolder<TImpl>(secretBase64, selfTvmId, tvmKeysResponse)) + { + } + + TServiceContext::TServiceContext(TServiceContext&& o) = default; + TServiceContext& TServiceContext::operator=(TServiceContext&& o) = default; + TServiceContext::~TServiceContext() = default; + + TServiceContext TServiceContext::CheckingFactory(TTvmId selfTvmId, TStringBuf tvmKeysResponse) { + TServiceContext c; + c.Impl_ = MakeHolder<TImpl>(selfTvmId, tvmKeysResponse); + return c; + } + + TServiceContext TServiceContext::SigningFactory(TStringBuf secretBase64) { + TServiceContext c; + c.Impl_ = MakeHolder<TImpl>(secretBase64); + return c; + } + + TCheckedServiceTicket TServiceContext::Check(TStringBuf ticketBody) const { + Y_ENSURE(Impl_, EX_MSG); + return Impl_->Check(ticketBody); + } + + TString TServiceContext::SignCgiParamsForTvm(TStringBuf ts, TStringBuf dst, TStringBuf scopes) const { + Y_ENSURE(Impl_, EX_MSG); + return Impl_->SignCgiParamsForTvm(ts, dst, scopes); + } +} -- cgit v1.2.3