Files
komp_ac/common/src/proto/komp_ac.auth.rs

2040 lines
92 KiB
Rust

// This file is @generated by prost-build.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RegisterRequest {
#[prost(string, tag = "1")]
pub username: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub email: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub password: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub password_confirmation: ::prost::alloc::string::String,
/// IANA timezone, for example Europe/Bratislava
#[prost(string, tag = "5")]
pub timezone: ::prost::alloc::string::String,
/// ISO 3166-1 alpha-2 country used for national phone numbers, for example SK
#[prost(string, tag = "6")]
pub phone_country: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthResponse {
/// UUID in string format
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
/// Registered username
#[prost(string, tag = "2")]
pub username: ::prost::alloc::string::String,
/// Registered email (if provided)
#[prost(string, tag = "3")]
pub email: ::prost::alloc::string::String,
/// Always 'guest' for a self-registration
#[prost(string, tag = "4")]
pub role: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ChangePasswordRequest {
#[prost(string, tag = "1")]
pub current_password: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub new_password: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub new_password_confirmation: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PasswordOperationResponse {}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LoginRequest {
/// Can be username or email
#[prost(string, tag = "1")]
pub identifier: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub password: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LoginResponse {
/// JWT token
#[prost(string, tag = "1")]
pub access_token: ::prost::alloc::string::String,
/// Usually "Bearer"
#[prost(string, tag = "2")]
pub token_type: ::prost::alloc::string::String,
/// Expiration in seconds (86400 for 24 hours)
#[prost(int32, tag = "3")]
pub expires_in: i32,
/// User's UUID in string format
#[prost(string, tag = "4")]
pub user_id: ::prost::alloc::string::String,
/// User's role
#[prost(string, tag = "5")]
pub role: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub username: ::prost::alloc::string::String,
#[prost(message, optional, tag = "7")]
pub authorization: ::core::option::Option<AuthorizationSnapshot>,
#[prost(string, tag = "8")]
pub timezone: ::prost::alloc::string::String,
#[prost(string, tag = "9")]
pub phone_country: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SetTimezoneRequest {
/// IANA timezone, for example Europe/Bratislava
#[prost(string, tag = "1")]
pub timezone: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UserPreferences {
#[prost(string, tag = "1")]
pub timezone: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LogoutRequest {}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LogoutResponse {}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RevokeUserSessionsRequest {
#[prost(string, tag = "1")]
pub username: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RevokeUserSessionsResponse {}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetAuthorizationRequest {}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Permission {
/// Canonical object string, one of:
/// struct:<area> structural area, never grantable at runtime
/// data:<profile>/<table> one root table and its whole template family
/// data:<profile>/\* every table in a profile, present and future
/// data:\* every table everywhere
/// journal:<profile> one profile's accounting journal
/// journal:\* every profile's journal
#[prost(string, tag = "1")]
pub object: ::prost::alloc::string::String,
/// manage for structural areas; read/insert/update/delete on the data plane.
#[prost(string, tag = "2")]
pub action: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AuthorizationSnapshot {
#[prost(string, tag = "1")]
pub role: ::prost::alloc::string::String,
/// Every permission the role holds, inherited ones included.
#[prost(message, repeated, tag = "2")]
pub permissions: ::prost::alloc::vec::Vec<Permission>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Role {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// 'structural' (designs the system, never writes data) or 'data'.
#[prost(string, tag = "2")]
pub kind: ::prost::alloc::string::String,
#[prost(bool, tag = "3")]
pub built_in: bool,
/// Role this one inherits every grant from; empty when it has no parent.
#[prost(string, tag = "4")]
pub parent: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListRolesRequest {}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListRolesResponse {
#[prost(message, repeated, tag = "1")]
pub roles: ::prost::alloc::vec::Vec<Role>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AddRoleRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Optional data role to inherit from. Must rank below the caller.
#[prost(string, tag = "2")]
pub parent: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RemoveRoleRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GrantPermissionRequest {
#[prost(string, tag = "1")]
pub role: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub object: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub action: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RevokePermissionRequest {
#[prost(string, tag = "1")]
pub role: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub object: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub action: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListRolePermissionsRequest {
#[prost(string, tag = "1")]
pub role: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RolePermissions {
#[prost(string, tag = "1")]
pub role: ::prost::alloc::string::String,
/// Grants stored against this role alone, without inherited ones.
#[prost(message, repeated, tag = "2")]
pub permissions: ::prost::alloc::vec::Vec<Permission>,
/// Everything the role can actually do, inheritance resolved.
#[prost(message, repeated, tag = "3")]
pub effective_permissions: ::prost::alloc::vec::Vec<Permission>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListGrantableObjectsRequest {
/// The role being edited. The response contains only actions that may be
/// granted to this role by the caller.
#[prost(string, tag = "1")]
pub target_role: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GrantableObject {
/// Canonical value accepted by GrantPermission, for example
/// data:acme/invoices.
#[prost(string, tag = "1")]
pub object: ::prost::alloc::string::String,
/// Empty only for the data:\* and journal:\* global wildcards.
#[prost(string, tag = "2")]
pub profile: ::prost::alloc::string::String,
/// Set only for a table-family root.
#[prost(string, tag = "3")]
pub table: ::prost::alloc::string::String,
/// One of global_data, global_journal, profile, journal, table, or diagnostics.
#[prost(string, tag = "4")]
pub kind: ::prost::alloc::string::String,
/// Actions the caller may grant to target_role for this object.
#[prost(string, repeated, tag = "5")]
pub allowed_actions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListGrantableObjectsResponse {
#[prost(message, repeated, tag = "1")]
pub objects: ::prost::alloc::vec::Vec<GrantableObject>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InternalError {
#[prost(string, tag = "1")]
pub reference_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub user_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub username: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub grpc_method: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub detail: ::prost::alloc::string::String,
#[prost(int64, tag = "6")]
pub occurred_at_unix_milliseconds: i64,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListInternalErrorsRequest {
/// Every non-empty text/UUID field is an optional filter. Username and method
/// use case-insensitive substring matching.
#[prost(string, tag = "1")]
pub reference_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub user_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub username: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub grpc_method: ::prost::alloc::string::String,
#[prost(int64, tag = "5")]
pub occurred_from_unix_seconds: i64,
#[prost(int64, tag = "6")]
pub occurred_to_unix_seconds: i64,
#[prost(enumeration = "InternalErrorSort", tag = "7")]
pub sort: i32,
/// Unspecified sort always means newest first. For an explicit sort, false is
/// ascending and true is descending.
#[prost(bool, tag = "8")]
pub descending: bool,
/// Defaults to 100 and is capped at 500.
#[prost(uint32, tag = "9")]
pub limit: u32,
#[prost(uint64, tag = "10")]
pub offset: u64,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListInternalErrorsResponse {
#[prost(message, repeated, tag = "1")]
pub errors: ::prost::alloc::vec::Vec<InternalError>,
#[prost(uint64, tag = "2")]
pub total_count: u64,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetInternalErrorRequest {
#[prost(string, tag = "1")]
pub reference_id: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AssignUserRoleRequest {
#[prost(string, tag = "1")]
pub username: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub role: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ResetUserPasswordRequest {
#[prost(string, tag = "1")]
pub username: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub new_password: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub new_password_confirmation: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UserSummary {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub username: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub email: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub role: ::prost::alloc::string::String,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListUsersRequest {}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListUsersResponse {
#[prost(message, repeated, tag = "1")]
pub users: ::prost::alloc::vec::Vec<UserSummary>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum InternalErrorSort {
Unspecified = 0,
OccurredAt = 1,
ReferenceId = 2,
Username = 3,
GrpcMethod = 4,
}
impl InternalErrorSort {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "INTERNAL_ERROR_SORT_UNSPECIFIED",
Self::OccurredAt => "INTERNAL_ERROR_SORT_OCCURRED_AT",
Self::ReferenceId => "INTERNAL_ERROR_SORT_REFERENCE_ID",
Self::Username => "INTERNAL_ERROR_SORT_USERNAME",
Self::GrpcMethod => "INTERNAL_ERROR_SORT_GRPC_METHOD",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"INTERNAL_ERROR_SORT_UNSPECIFIED" => Some(Self::Unspecified),
"INTERNAL_ERROR_SORT_OCCURRED_AT" => Some(Self::OccurredAt),
"INTERNAL_ERROR_SORT_REFERENCE_ID" => Some(Self::ReferenceId),
"INTERNAL_ERROR_SORT_USERNAME" => Some(Self::Username),
"INTERNAL_ERROR_SORT_GRPC_METHOD" => Some(Self::GrpcMethod),
_ => None,
}
}
}
/// Generated client implementations.
pub mod auth_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct AuthServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl AuthServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> AuthServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> AuthServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
AuthServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn register(
&mut self,
request: impl tonic::IntoRequest<super::RegisterRequest>,
) -> std::result::Result<tonic::Response<super::AuthResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/Register",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "Register"));
self.inner.unary(req, path, codec).await
}
pub async fn login(
&mut self,
request: impl tonic::IntoRequest<super::LoginRequest>,
) -> std::result::Result<tonic::Response<super::LoginResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/Login",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "Login"));
self.inner.unary(req, path, codec).await
}
/// Changes the authenticated user's password after verifying the current one.
pub async fn change_password(
&mut self,
request: impl tonic::IntoRequest<super::ChangePasswordRequest>,
) -> std::result::Result<
tonic::Response<super::PasswordOperationResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/ChangePassword",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "ChangePassword"));
self.inner.unary(req, path, codec).await
}
pub async fn get_authorization(
&mut self,
request: impl tonic::IntoRequest<super::GetAuthorizationRequest>,
) -> std::result::Result<
tonic::Response<super::AuthorizationSnapshot>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/GetAuthorization",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "GetAuthorization"));
self.inner.unary(req, path, codec).await
}
pub async fn set_timezone(
&mut self,
request: impl tonic::IntoRequest<super::SetTimezoneRequest>,
) -> std::result::Result<
tonic::Response<super::UserPreferences>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/SetTimezone",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "SetTimezone"));
self.inner.unary(req, path, codec).await
}
/// Ends the caller's own sessions. Every token issued to them before this
/// call, on every device, stops being accepted -- including the one used to
/// make the call, so the caller must log in again afterwards. Discarding a
/// token client-side is not a logout; this is.
pub async fn logout(
&mut self,
request: impl tonic::IntoRequest<super::LogoutRequest>,
) -> std::result::Result<tonic::Response<super::LogoutResponse>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/Logout",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "Logout"));
self.inner.unary(req, path, codec).await
}
/// Ends every session of another user, for a leaked token or a departing
/// account. Requires the struct:user area, and the target must rank strictly
/// below the caller.
pub async fn revoke_user_sessions(
&mut self,
request: impl tonic::IntoRequest<super::RevokeUserSessionsRequest>,
) -> std::result::Result<
tonic::Response<super::RevokeUserSessionsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/RevokeUserSessions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.auth.AuthService", "RevokeUserSessions"),
);
self.inner.unary(req, path, codec).await
}
/// Role administration. Every call requires the struct:role area, and every
/// target role must rank strictly below the caller's own role.
pub async fn list_roles(
&mut self,
request: impl tonic::IntoRequest<super::ListRolesRequest>,
) -> std::result::Result<
tonic::Response<super::ListRolesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/ListRoles",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "ListRoles"));
self.inner.unary(req, path, codec).await
}
pub async fn add_role(
&mut self,
request: impl tonic::IntoRequest<super::AddRoleRequest>,
) -> std::result::Result<tonic::Response<super::Role>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/AddRole",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "AddRole"));
self.inner.unary(req, path, codec).await
}
pub async fn remove_role(
&mut self,
request: impl tonic::IntoRequest<super::RemoveRoleRequest>,
) -> std::result::Result<tonic::Response<super::Role>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/RemoveRole",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "RemoveRole"));
self.inner.unary(req, path, codec).await
}
/// Grant administration on the data plane.
pub async fn grant_permission(
&mut self,
request: impl tonic::IntoRequest<super::GrantPermissionRequest>,
) -> std::result::Result<
tonic::Response<super::RolePermissions>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/GrantPermission",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "GrantPermission"));
self.inner.unary(req, path, codec).await
}
pub async fn revoke_permission(
&mut self,
request: impl tonic::IntoRequest<super::RevokePermissionRequest>,
) -> std::result::Result<
tonic::Response<super::RolePermissions>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/RevokePermission",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "RevokePermission"));
self.inner.unary(req, path, codec).await
}
pub async fn list_role_permissions(
&mut self,
request: impl tonic::IntoRequest<super::ListRolePermissionsRequest>,
) -> std::result::Result<
tonic::Response<super::RolePermissions>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/ListRolePermissions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.auth.AuthService", "ListRolePermissions"),
);
self.inner.unary(req, path, codec).await
}
pub async fn list_grantable_objects(
&mut self,
request: impl tonic::IntoRequest<super::ListGrantableObjectsRequest>,
) -> std::result::Result<
tonic::Response<super::ListGrantableObjectsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/ListGrantableObjects",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.auth.AuthService", "ListGrantableObjects"),
);
self.inner.unary(req, path, codec).await
}
/// Support diagnostics. Requires read on diagnostics:internal-errors.
pub async fn list_internal_errors(
&mut self,
request: impl tonic::IntoRequest<super::ListInternalErrorsRequest>,
) -> std::result::Result<
tonic::Response<super::ListInternalErrorsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/ListInternalErrors",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.auth.AuthService", "ListInternalErrors"),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_internal_error(
&mut self,
request: impl tonic::IntoRequest<super::GetInternalErrorRequest>,
) -> std::result::Result<tonic::Response<super::InternalError>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/GetInternalError",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "GetInternalError"));
self.inner.unary(req, path, codec).await
}
/// User administration.
pub async fn assign_user_role(
&mut self,
request: impl tonic::IntoRequest<super::AssignUserRoleRequest>,
) -> std::result::Result<tonic::Response<super::UserSummary>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/AssignUserRole",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "AssignUserRole"));
self.inner.unary(req, path, codec).await
}
/// Resets a lower-ranked user's password.
pub async fn reset_user_password(
&mut self,
request: impl tonic::IntoRequest<super::ResetUserPasswordRequest>,
) -> std::result::Result<
tonic::Response<super::PasswordOperationResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/ResetUserPassword",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("komp_ac.auth.AuthService", "ResetUserPassword"),
);
self.inner.unary(req, path, codec).await
}
pub async fn list_users(
&mut self,
request: impl tonic::IntoRequest<super::ListUsersRequest>,
) -> std::result::Result<
tonic::Response<super::ListUsersResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/komp_ac.auth.AuthService/ListUsers",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("komp_ac.auth.AuthService", "ListUsers"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod auth_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with AuthServiceServer.
#[async_trait]
pub trait AuthService: std::marker::Send + std::marker::Sync + 'static {
async fn register(
&self,
request: tonic::Request<super::RegisterRequest>,
) -> std::result::Result<tonic::Response<super::AuthResponse>, tonic::Status>;
async fn login(
&self,
request: tonic::Request<super::LoginRequest>,
) -> std::result::Result<tonic::Response<super::LoginResponse>, tonic::Status>;
/// Changes the authenticated user's password after verifying the current one.
async fn change_password(
&self,
request: tonic::Request<super::ChangePasswordRequest>,
) -> std::result::Result<
tonic::Response<super::PasswordOperationResponse>,
tonic::Status,
>;
async fn get_authorization(
&self,
request: tonic::Request<super::GetAuthorizationRequest>,
) -> std::result::Result<
tonic::Response<super::AuthorizationSnapshot>,
tonic::Status,
>;
async fn set_timezone(
&self,
request: tonic::Request<super::SetTimezoneRequest>,
) -> std::result::Result<tonic::Response<super::UserPreferences>, tonic::Status>;
/// Ends the caller's own sessions. Every token issued to them before this
/// call, on every device, stops being accepted -- including the one used to
/// make the call, so the caller must log in again afterwards. Discarding a
/// token client-side is not a logout; this is.
async fn logout(
&self,
request: tonic::Request<super::LogoutRequest>,
) -> std::result::Result<tonic::Response<super::LogoutResponse>, tonic::Status>;
/// Ends every session of another user, for a leaked token or a departing
/// account. Requires the struct:user area, and the target must rank strictly
/// below the caller.
async fn revoke_user_sessions(
&self,
request: tonic::Request<super::RevokeUserSessionsRequest>,
) -> std::result::Result<
tonic::Response<super::RevokeUserSessionsResponse>,
tonic::Status,
>;
/// Role administration. Every call requires the struct:role area, and every
/// target role must rank strictly below the caller's own role.
async fn list_roles(
&self,
request: tonic::Request<super::ListRolesRequest>,
) -> std::result::Result<
tonic::Response<super::ListRolesResponse>,
tonic::Status,
>;
async fn add_role(
&self,
request: tonic::Request<super::AddRoleRequest>,
) -> std::result::Result<tonic::Response<super::Role>, tonic::Status>;
async fn remove_role(
&self,
request: tonic::Request<super::RemoveRoleRequest>,
) -> std::result::Result<tonic::Response<super::Role>, tonic::Status>;
/// Grant administration on the data plane.
async fn grant_permission(
&self,
request: tonic::Request<super::GrantPermissionRequest>,
) -> std::result::Result<tonic::Response<super::RolePermissions>, tonic::Status>;
async fn revoke_permission(
&self,
request: tonic::Request<super::RevokePermissionRequest>,
) -> std::result::Result<tonic::Response<super::RolePermissions>, tonic::Status>;
async fn list_role_permissions(
&self,
request: tonic::Request<super::ListRolePermissionsRequest>,
) -> std::result::Result<tonic::Response<super::RolePermissions>, tonic::Status>;
async fn list_grantable_objects(
&self,
request: tonic::Request<super::ListGrantableObjectsRequest>,
) -> std::result::Result<
tonic::Response<super::ListGrantableObjectsResponse>,
tonic::Status,
>;
/// Support diagnostics. Requires read on diagnostics:internal-errors.
async fn list_internal_errors(
&self,
request: tonic::Request<super::ListInternalErrorsRequest>,
) -> std::result::Result<
tonic::Response<super::ListInternalErrorsResponse>,
tonic::Status,
>;
async fn get_internal_error(
&self,
request: tonic::Request<super::GetInternalErrorRequest>,
) -> std::result::Result<tonic::Response<super::InternalError>, tonic::Status>;
/// User administration.
async fn assign_user_role(
&self,
request: tonic::Request<super::AssignUserRoleRequest>,
) -> std::result::Result<tonic::Response<super::UserSummary>, tonic::Status>;
/// Resets a lower-ranked user's password.
async fn reset_user_password(
&self,
request: tonic::Request<super::ResetUserPasswordRequest>,
) -> std::result::Result<
tonic::Response<super::PasswordOperationResponse>,
tonic::Status,
>;
async fn list_users(
&self,
request: tonic::Request<super::ListUsersRequest>,
) -> std::result::Result<
tonic::Response<super::ListUsersResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct AuthServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> AuthServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for AuthServiceServer<T>
where
T: AuthService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/komp_ac.auth.AuthService/Register" => {
#[allow(non_camel_case_types)]
struct RegisterSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::RegisterRequest>
for RegisterSvc<T> {
type Response = super::AuthResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::RegisterRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::register(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = RegisterSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/Login" => {
#[allow(non_camel_case_types)]
struct LoginSvc<T: AuthService>(pub Arc<T>);
impl<T: AuthService> tonic::server::UnaryService<super::LoginRequest>
for LoginSvc<T> {
type Response = super::LoginResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::LoginRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::login(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = LoginSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/ChangePassword" => {
#[allow(non_camel_case_types)]
struct ChangePasswordSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::ChangePasswordRequest>
for ChangePasswordSvc<T> {
type Response = super::PasswordOperationResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ChangePasswordRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::change_password(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ChangePasswordSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/GetAuthorization" => {
#[allow(non_camel_case_types)]
struct GetAuthorizationSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::GetAuthorizationRequest>
for GetAuthorizationSvc<T> {
type Response = super::AuthorizationSnapshot;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetAuthorizationRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::get_authorization(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetAuthorizationSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/SetTimezone" => {
#[allow(non_camel_case_types)]
struct SetTimezoneSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::SetTimezoneRequest>
for SetTimezoneSvc<T> {
type Response = super::UserPreferences;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SetTimezoneRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::set_timezone(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SetTimezoneSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/Logout" => {
#[allow(non_camel_case_types)]
struct LogoutSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::LogoutRequest>
for LogoutSvc<T> {
type Response = super::LogoutResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::LogoutRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::logout(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = LogoutSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/RevokeUserSessions" => {
#[allow(non_camel_case_types)]
struct RevokeUserSessionsSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::RevokeUserSessionsRequest>
for RevokeUserSessionsSvc<T> {
type Response = super::RevokeUserSessionsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::RevokeUserSessionsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::revoke_user_sessions(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = RevokeUserSessionsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/ListRoles" => {
#[allow(non_camel_case_types)]
struct ListRolesSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::ListRolesRequest>
for ListRolesSvc<T> {
type Response = super::ListRolesResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListRolesRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::list_roles(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListRolesSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/AddRole" => {
#[allow(non_camel_case_types)]
struct AddRoleSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::AddRoleRequest>
for AddRoleSvc<T> {
type Response = super::Role;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AddRoleRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::add_role(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = AddRoleSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/RemoveRole" => {
#[allow(non_camel_case_types)]
struct RemoveRoleSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::RemoveRoleRequest>
for RemoveRoleSvc<T> {
type Response = super::Role;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::RemoveRoleRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::remove_role(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = RemoveRoleSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/GrantPermission" => {
#[allow(non_camel_case_types)]
struct GrantPermissionSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::GrantPermissionRequest>
for GrantPermissionSvc<T> {
type Response = super::RolePermissions;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GrantPermissionRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::grant_permission(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GrantPermissionSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/RevokePermission" => {
#[allow(non_camel_case_types)]
struct RevokePermissionSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::RevokePermissionRequest>
for RevokePermissionSvc<T> {
type Response = super::RolePermissions;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::RevokePermissionRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::revoke_permission(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = RevokePermissionSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/ListRolePermissions" => {
#[allow(non_camel_case_types)]
struct ListRolePermissionsSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::ListRolePermissionsRequest>
for ListRolePermissionsSvc<T> {
type Response = super::RolePermissions;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListRolePermissionsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::list_role_permissions(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListRolePermissionsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/ListGrantableObjects" => {
#[allow(non_camel_case_types)]
struct ListGrantableObjectsSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::ListGrantableObjectsRequest>
for ListGrantableObjectsSvc<T> {
type Response = super::ListGrantableObjectsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListGrantableObjectsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::list_grantable_objects(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListGrantableObjectsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/ListInternalErrors" => {
#[allow(non_camel_case_types)]
struct ListInternalErrorsSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::ListInternalErrorsRequest>
for ListInternalErrorsSvc<T> {
type Response = super::ListInternalErrorsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListInternalErrorsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::list_internal_errors(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListInternalErrorsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/GetInternalError" => {
#[allow(non_camel_case_types)]
struct GetInternalErrorSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::GetInternalErrorRequest>
for GetInternalErrorSvc<T> {
type Response = super::InternalError;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetInternalErrorRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::get_internal_error(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetInternalErrorSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/AssignUserRole" => {
#[allow(non_camel_case_types)]
struct AssignUserRoleSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::AssignUserRoleRequest>
for AssignUserRoleSvc<T> {
type Response = super::UserSummary;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AssignUserRoleRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::assign_user_role(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = AssignUserRoleSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/ResetUserPassword" => {
#[allow(non_camel_case_types)]
struct ResetUserPasswordSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::ResetUserPasswordRequest>
for ResetUserPasswordSvc<T> {
type Response = super::PasswordOperationResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ResetUserPasswordRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::reset_user_password(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ResetUserPasswordSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/komp_ac.auth.AuthService/ListUsers" => {
#[allow(non_camel_case_types)]
struct ListUsersSvc<T: AuthService>(pub Arc<T>);
impl<
T: AuthService,
> tonic::server::UnaryService<super::ListUsersRequest>
for ListUsersSvc<T> {
type Response = super::ListUsersResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListUsersRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as AuthService>::list_users(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListUsersSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for AuthServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "komp_ac.auth.AuthService";
impl<T> tonic::server::NamedService for AuthServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}