aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/tvmauth/src/ut/utils_ut.cpp
diff options
context:
space:
mode:
authorppodolsky <ppodolsky@yandex-team.ru>2022-02-10 16:48:03 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:03 +0300
commitff24d93e6130e0944ce0c9e2d2f54e1e88fc08dd (patch)
tree5f33d1a762f7b540dff1883c83c71b391876a558 /library/cpp/tvmauth/src/ut/utils_ut.cpp
parent02eacb2e0795d01f1d266d68904068b3789750f5 (diff)
downloadydb-ff24d93e6130e0944ce0c9e2d2f54e1e88fc08dd.tar.gz
Restoring authorship annotation for <ppodolsky@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/tvmauth/src/ut/utils_ut.cpp')
-rw-r--r--library/cpp/tvmauth/src/ut/utils_ut.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/library/cpp/tvmauth/src/ut/utils_ut.cpp b/library/cpp/tvmauth/src/ut/utils_ut.cpp
index c9cb81c36f..38b1d384d2 100644
--- a/library/cpp/tvmauth/src/ut/utils_ut.cpp
+++ b/library/cpp/tvmauth/src/ut/utils_ut.cpp
@@ -8,24 +8,24 @@ Y_UNIT_TEST_SUITE(UtilsTestSuite) {
static const TString VALID_SERVICE_TICKET_1 = "3:serv:CBAQ__________9_IhkI5QEQHBoIYmI6c2VzczEaCGJiOnNlc3My:WUPx1cTf05fjD1exB35T5j2DCHWH1YaLJon_a4rN-D7JfXHK1Ai4wM4uSfboHD9xmGQH7extqtlEk1tCTCGm5qbRVloJwWzCZBXo3zKX6i1oBYP_89WcjCNPVe1e8jwGdLsnu6PpxL5cn0xCksiStILH5UmDR6xfkJdnmMG94o8";
static const TString EXPIRED_SERVICE_TICKET = "3:serv:CBAQACIZCOUBEBwaCGJiOnNlc3MxGghiYjpzZXNzMg:IwfMNJYEqStY_SixwqJnyHOMCPR7-3HHk4uylB2oVRkthtezq-OOA7QizDvx7VABLs_iTlXuD1r5IjufNei_EiV145eaa3HIg4xCdJXCojMexf2UYJz8mF2b0YzFAy6_KWagU7xo13CyKAqzJuQf5MJcSUf0ecY9hVh36cJ51aw";
using namespace NTvmAuth;
-
+
Y_UNIT_TEST(base64Test) {
UNIT_ASSERT_VALUES_EQUAL("-hHx", NUtils::Bin2base64url("\xfa\x11\xf1"));
UNIT_ASSERT_VALUES_EQUAL("-hHx_g", NUtils::Bin2base64url("\xfa\x11\xf1\xfe"));
UNIT_ASSERT_VALUES_EQUAL("-hHx_v8", NUtils::Bin2base64url("\xfa\x11\xf1\xfe\xff"));
-
+
UNIT_ASSERT_VALUES_EQUAL("", NUtils::Base64url2bin("hHx++"));
UNIT_ASSERT_VALUES_EQUAL("", NUtils::Base64url2bin("&*^"));
UNIT_ASSERT_VALUES_EQUAL("", NUtils::Base64url2bin(""));
UNIT_ASSERT_VALUES_EQUAL("", NUtils::Bin2base64url(""));
-
+
UNIT_ASSERT_VALUES_EQUAL("\xfa\x11\xf1", NUtils::Base64url2bin("-hHx"));
UNIT_ASSERT_VALUES_EQUAL("\xfa\x11\xf1\xfe", NUtils::Base64url2bin("-hHx_g"));
UNIT_ASSERT_VALUES_EQUAL("\xfa\x11\xf1\xfe", NUtils::Base64url2bin("-hHx_g="));
UNIT_ASSERT_VALUES_EQUAL("\xfa\x11\xf1\xfe", NUtils::Base64url2bin("-hHx_g=="));
UNIT_ASSERT_VALUES_EQUAL("\xfa\x11\xf1\xfe\xff", NUtils::Base64url2bin("-hHx_v8"));
UNIT_ASSERT_VALUES_EQUAL("\xfa\x11\xf1\xfe\xff", NUtils::Base64url2bin("-hHx_v8="));
-
+
UNIT_ASSERT_VALUES_EQUAL("SGVsbG8sIGV2ZXJ5Ym9keSE",
NUtils::Bin2base64url(("Hello, everybody!")));
UNIT_ASSERT_VALUES_EQUAL("Hello, everybody!",
@@ -34,33 +34,33 @@ Y_UNIT_TEST_SUITE(UtilsTestSuite) {
NUtils::Bin2base64url(("The Magic Words are Squeamish Ossifrage")));
UNIT_ASSERT_VALUES_EQUAL("The Magic Words are Squeamish Ossifrage",
NUtils::Base64url2bin(("VGhlIE1hZ2ljIFdvcmRzIGFyZSBTcXVlYW1pc2ggT3NzaWZyYWdl")));
- }
-
+ }
+
Y_UNIT_TEST(sign) {
UNIT_ASSERT_VALUES_EQUAL("wkGfeuopf709ozPAeGcDMqtZXPzsWvuNJ1BL586dSug",
NUtils::SignCgiParamsForTvm(NUtils::Base64url2bin("GRMJrKnj4fOVnvOqe-WyD1"),
"1490000000",
"13,19",
"bb:sess,bb:sess2"));
-
+
UNIT_ASSERT_VALUES_EQUAL("HANDYrA4ApQMQ5cfSWZk_InHWJffoXAa57P_X_B5s4M",
NUtils::SignCgiParamsForTvm(NUtils::Base64url2bin("GRMJrKnj4fOasvOqe-WyD1"),
"1490000000",
"13,19",
"bb:sess,bb:sess2"));
-
+
UNIT_ASSERT_VALUES_EQUAL("T-M-3_qtjRM1dR_3hS1CRlHBTZRKK04doHXBJw-5VRk",
NUtils::SignCgiParamsForTvm(NUtils::Base64url2bin("GRMJrKnj4fOasvOqe-WyD1"),
"1490000001",
"13,19",
"bb:sess,bb:sess2"));
-
+
UNIT_ASSERT_VALUES_EQUAL("gwB6M_9Jij50ZADmlDMnoyLc6AhQmtq6MClgGzO1PBE",
NUtils::SignCgiParamsForTvm(NUtils::Base64url2bin("GRMJrKnj4fOasvOqe-WyD1"),
"1490000001",
"13,19",
""));
- }
+ }
Y_UNIT_TEST(GetExpirationTime) {
UNIT_ASSERT(!NTvmAuth::NInternal::TCanningKnife::GetExpirationTime("3:aadasdasdasdas"));
@@ -92,4 +92,4 @@ Y_UNIT_TEST_SUITE(UtilsTestSuite) {
UNIT_ASSERT_VALUES_EQUAL("asdxcbvfgdsgfasdfxczvdsgfxcdvbcbvf",
NUtils::RemoveTicketSignature("asdxcbvfgdsgfasdfxczvdsgfxcdvbcbvf"));
}
-}
+}