aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/service/auth.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/monlib/service/auth.h
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/monlib/service/auth.h')
-rw-r--r--library/cpp/monlib/service/auth.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/library/cpp/monlib/service/auth.h b/library/cpp/monlib/service/auth.h
new file mode 100644
index 0000000000..ae53b8bd8e
--- /dev/null
+++ b/library/cpp/monlib/service/auth.h
@@ -0,0 +1,48 @@
+#pragma once
+
+#include "mon_service_http_request.h"
+
+namespace NMonitoring {
+ enum class EAuthType {
+ None = 0,
+ Tvm = 1,
+ };
+
+ struct TAuthResult {
+ enum class EStatus {
+ NoCredentials = 0,
+ Denied,
+ Ok,
+ };
+
+ TAuthResult(EStatus status)
+ : Status{status}
+ {
+ }
+
+ static TAuthResult Denied() {
+ return TAuthResult(EStatus::Denied);
+ }
+
+ static TAuthResult NoCredentials() {
+ return TAuthResult(EStatus::NoCredentials);
+ }
+
+ static TAuthResult Ok() {
+ return TAuthResult(EStatus::Ok);
+ }
+
+ explicit operator bool() const {
+ return Status == EStatus::Ok;
+ }
+
+ EStatus Status{EStatus::NoCredentials};
+ };
+
+ struct IAuthProvider {
+ virtual ~IAuthProvider() = default;
+ virtual TAuthResult Check(const IHttpRequest& req) = 0;
+ };
+
+ THolder<IAuthProvider> CreateFakeAuth();
+} // namespace NMonitoring