1pub mod auth_service_client {
4 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
5 use tonic::codegen::*;
6 use tonic::codegen::http::Uri;
7 #[derive(Debug, Clone)]
8 pub struct AuthServiceClient<T> {
9 inner: tonic::client::Grpc<T>,
10 }
11 impl AuthServiceClient<tonic::transport::Channel> {
12 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
14 where
15 D: TryInto<tonic::transport::Endpoint>,
16 D::Error: Into<StdError>,
17 {
18 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
19 Ok(Self::new(conn))
20 }
21 }
22 impl<T> AuthServiceClient<T>
23 where
24 T: tonic::client::GrpcService<tonic::body::BoxBody>,
25 T::Error: Into<StdError>,
26 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
27 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
28 {
29 pub fn new(inner: T) -> Self {
30 let inner = tonic::client::Grpc::new(inner);
31 Self { inner }
32 }
33 pub fn with_origin(inner: T, origin: Uri) -> Self {
34 let inner = tonic::client::Grpc::with_origin(inner, origin);
35 Self { inner }
36 }
37 pub fn with_interceptor<F>(
38 inner: T,
39 interceptor: F,
40 ) -> AuthServiceClient<InterceptedService<T, F>>
41 where
42 F: tonic::service::Interceptor,
43 T::ResponseBody: Default,
44 T: tonic::codegen::Service<
45 http::Request<tonic::body::BoxBody>,
46 Response = http::Response<
47 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
48 >,
49 >,
50 <T as tonic::codegen::Service<
51 http::Request<tonic::body::BoxBody>,
52 >>::Error: Into<StdError> + Send + Sync,
53 {
54 AuthServiceClient::new(InterceptedService::new(inner, interceptor))
55 }
56 #[must_use]
61 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
62 self.inner = self.inner.send_compressed(encoding);
63 self
64 }
65 #[must_use]
67 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
68 self.inner = self.inner.accept_compressed(encoding);
69 self
70 }
71 #[must_use]
75 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
76 self.inner = self.inner.max_decoding_message_size(limit);
77 self
78 }
79 #[must_use]
83 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
84 self.inner = self.inner.max_encoding_message_size(limit);
85 self
86 }
87 pub async fn authenticate(
88 &mut self,
89 request: impl tonic::IntoRequest<super::AuthenticateRequest>,
90 ) -> std::result::Result<
91 tonic::Response<super::AuthenticateResponse>,
92 tonic::Status,
93 > {
94 self.inner
95 .ready()
96 .await
97 .map_err(|e| {
98 tonic::Status::new(
99 tonic::Code::Unknown,
100 format!("Service was not ready: {}", e.into()),
101 )
102 })?;
103 let codec = tonic::codec::ProstCodec::default();
104 let path = http::uri::PathAndQuery::from_static(
105 "/proto.rpc.v1.AuthService/Authenticate",
106 );
107 let mut req = request.into_request();
108 req.extensions_mut()
109 .insert(GrpcMethod::new("proto.rpc.v1.AuthService", "Authenticate"));
110 self.inner.unary(req, path, codec).await
111 }
112 }
113}
114pub mod auth_service_server {
116 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
117 use tonic::codegen::*;
118 #[async_trait]
120 pub trait AuthService: Send + Sync + 'static {
121 async fn authenticate(
122 &self,
123 request: tonic::Request<super::AuthenticateRequest>,
124 ) -> std::result::Result<
125 tonic::Response<super::AuthenticateResponse>,
126 tonic::Status,
127 >;
128 }
129 #[derive(Debug)]
130 pub struct AuthServiceServer<T: AuthService> {
131 inner: _Inner<T>,
132 accept_compression_encodings: EnabledCompressionEncodings,
133 send_compression_encodings: EnabledCompressionEncodings,
134 max_decoding_message_size: Option<usize>,
135 max_encoding_message_size: Option<usize>,
136 }
137 struct _Inner<T>(Arc<T>);
138 impl<T: AuthService> AuthServiceServer<T> {
139 pub fn new(inner: T) -> Self {
140 Self::from_arc(Arc::new(inner))
141 }
142 pub fn from_arc(inner: Arc<T>) -> Self {
143 let inner = _Inner(inner);
144 Self {
145 inner,
146 accept_compression_encodings: Default::default(),
147 send_compression_encodings: Default::default(),
148 max_decoding_message_size: None,
149 max_encoding_message_size: None,
150 }
151 }
152 pub fn with_interceptor<F>(
153 inner: T,
154 interceptor: F,
155 ) -> InterceptedService<Self, F>
156 where
157 F: tonic::service::Interceptor,
158 {
159 InterceptedService::new(Self::new(inner), interceptor)
160 }
161 #[must_use]
163 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
164 self.accept_compression_encodings.enable(encoding);
165 self
166 }
167 #[must_use]
169 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
170 self.send_compression_encodings.enable(encoding);
171 self
172 }
173 #[must_use]
177 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
178 self.max_decoding_message_size = Some(limit);
179 self
180 }
181 #[must_use]
185 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
186 self.max_encoding_message_size = Some(limit);
187 self
188 }
189 }
190 impl<T, B> tonic::codegen::Service<http::Request<B>> for AuthServiceServer<T>
191 where
192 T: AuthService,
193 B: Body + Send + 'static,
194 B::Error: Into<StdError> + Send + 'static,
195 {
196 type Response = http::Response<tonic::body::BoxBody>;
197 type Error = std::convert::Infallible;
198 type Future = BoxFuture<Self::Response, Self::Error>;
199 fn poll_ready(
200 &mut self,
201 _cx: &mut Context<'_>,
202 ) -> Poll<std::result::Result<(), Self::Error>> {
203 Poll::Ready(Ok(()))
204 }
205 fn call(&mut self, req: http::Request<B>) -> Self::Future {
206 let inner = self.inner.clone();
207 match req.uri().path() {
208 "/proto.rpc.v1.AuthService/Authenticate" => {
209 #[allow(non_camel_case_types)]
210 struct AuthenticateSvc<T: AuthService>(pub Arc<T>);
211 impl<
212 T: AuthService,
213 > tonic::server::UnaryService<super::AuthenticateRequest>
214 for AuthenticateSvc<T> {
215 type Response = super::AuthenticateResponse;
216 type Future = BoxFuture<
217 tonic::Response<Self::Response>,
218 tonic::Status,
219 >;
220 fn call(
221 &mut self,
222 request: tonic::Request<super::AuthenticateRequest>,
223 ) -> Self::Future {
224 let inner = Arc::clone(&self.0);
225 let fut = async move {
226 (*inner).authenticate(request).await
227 };
228 Box::pin(fut)
229 }
230 }
231 let accept_compression_encodings = self.accept_compression_encodings;
232 let send_compression_encodings = self.send_compression_encodings;
233 let max_decoding_message_size = self.max_decoding_message_size;
234 let max_encoding_message_size = self.max_encoding_message_size;
235 let inner = self.inner.clone();
236 let fut = async move {
237 let inner = inner.0;
238 let method = AuthenticateSvc(inner);
239 let codec = tonic::codec::ProstCodec::default();
240 let mut grpc = tonic::server::Grpc::new(codec)
241 .apply_compression_config(
242 accept_compression_encodings,
243 send_compression_encodings,
244 )
245 .apply_max_message_size_config(
246 max_decoding_message_size,
247 max_encoding_message_size,
248 );
249 let res = grpc.unary(method, req).await;
250 Ok(res)
251 };
252 Box::pin(fut)
253 }
254 _ => {
255 Box::pin(async move {
256 Ok(
257 http::Response::builder()
258 .status(200)
259 .header("grpc-status", "12")
260 .header("content-type", "application/grpc")
261 .body(empty_body())
262 .unwrap(),
263 )
264 })
265 }
266 }
267 }
268 }
269 impl<T: AuthService> Clone for AuthServiceServer<T> {
270 fn clone(&self) -> Self {
271 let inner = self.inner.clone();
272 Self {
273 inner,
274 accept_compression_encodings: self.accept_compression_encodings,
275 send_compression_encodings: self.send_compression_encodings,
276 max_decoding_message_size: self.max_decoding_message_size,
277 max_encoding_message_size: self.max_encoding_message_size,
278 }
279 }
280 }
281 impl<T: AuthService> Clone for _Inner<T> {
282 fn clone(&self) -> Self {
283 Self(Arc::clone(&self.0))
284 }
285 }
286 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
287 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
288 write!(f, "{:?}", self.0)
289 }
290 }
291 impl<T: AuthService> tonic::server::NamedService for AuthServiceServer<T> {
292 const NAME: &'static str = "proto.rpc.v1.AuthService";
293 }
294}
295pub mod external_auth_service_client {
297 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
298 use tonic::codegen::*;
299 use tonic::codegen::http::Uri;
300 #[derive(Debug, Clone)]
301 pub struct ExternalAuthServiceClient<T> {
302 inner: tonic::client::Grpc<T>,
303 }
304 impl ExternalAuthServiceClient<tonic::transport::Channel> {
305 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
307 where
308 D: TryInto<tonic::transport::Endpoint>,
309 D::Error: Into<StdError>,
310 {
311 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
312 Ok(Self::new(conn))
313 }
314 }
315 impl<T> ExternalAuthServiceClient<T>
316 where
317 T: tonic::client::GrpcService<tonic::body::BoxBody>,
318 T::Error: Into<StdError>,
319 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
320 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
321 {
322 pub fn new(inner: T) -> Self {
323 let inner = tonic::client::Grpc::new(inner);
324 Self { inner }
325 }
326 pub fn with_origin(inner: T, origin: Uri) -> Self {
327 let inner = tonic::client::Grpc::with_origin(inner, origin);
328 Self { inner }
329 }
330 pub fn with_interceptor<F>(
331 inner: T,
332 interceptor: F,
333 ) -> ExternalAuthServiceClient<InterceptedService<T, F>>
334 where
335 F: tonic::service::Interceptor,
336 T::ResponseBody: Default,
337 T: tonic::codegen::Service<
338 http::Request<tonic::body::BoxBody>,
339 Response = http::Response<
340 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
341 >,
342 >,
343 <T as tonic::codegen::Service<
344 http::Request<tonic::body::BoxBody>,
345 >>::Error: Into<StdError> + Send + Sync,
346 {
347 ExternalAuthServiceClient::new(InterceptedService::new(inner, interceptor))
348 }
349 #[must_use]
354 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
355 self.inner = self.inner.send_compressed(encoding);
356 self
357 }
358 #[must_use]
360 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
361 self.inner = self.inner.accept_compressed(encoding);
362 self
363 }
364 #[must_use]
368 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
369 self.inner = self.inner.max_decoding_message_size(limit);
370 self
371 }
372 #[must_use]
376 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
377 self.inner = self.inner.max_encoding_message_size(limit);
378 self
379 }
380 pub async fn authenticate_to(
381 &mut self,
382 request: impl tonic::IntoRequest<super::AuthenticateToRequest>,
383 ) -> std::result::Result<
384 tonic::Response<super::AuthenticateToResponse>,
385 tonic::Status,
386 > {
387 self.inner
388 .ready()
389 .await
390 .map_err(|e| {
391 tonic::Status::new(
392 tonic::Code::Unknown,
393 format!("Service was not ready: {}", e.into()),
394 )
395 })?;
396 let codec = tonic::codec::ProstCodec::default();
397 let path = http::uri::PathAndQuery::from_static(
398 "/proto.rpc.v1.ExternalAuthService/AuthenticateTo",
399 );
400 let mut req = request.into_request();
401 req.extensions_mut()
402 .insert(
403 GrpcMethod::new("proto.rpc.v1.ExternalAuthService", "AuthenticateTo"),
404 );
405 self.inner.unary(req, path, codec).await
406 }
407 }
408}
409pub mod external_auth_service_server {
411 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
412 use tonic::codegen::*;
413 #[async_trait]
415 pub trait ExternalAuthService: Send + Sync + 'static {
416 async fn authenticate_to(
417 &self,
418 request: tonic::Request<super::AuthenticateToRequest>,
419 ) -> std::result::Result<
420 tonic::Response<super::AuthenticateToResponse>,
421 tonic::Status,
422 >;
423 }
424 #[derive(Debug)]
425 pub struct ExternalAuthServiceServer<T: ExternalAuthService> {
426 inner: _Inner<T>,
427 accept_compression_encodings: EnabledCompressionEncodings,
428 send_compression_encodings: EnabledCompressionEncodings,
429 max_decoding_message_size: Option<usize>,
430 max_encoding_message_size: Option<usize>,
431 }
432 struct _Inner<T>(Arc<T>);
433 impl<T: ExternalAuthService> ExternalAuthServiceServer<T> {
434 pub fn new(inner: T) -> Self {
435 Self::from_arc(Arc::new(inner))
436 }
437 pub fn from_arc(inner: Arc<T>) -> Self {
438 let inner = _Inner(inner);
439 Self {
440 inner,
441 accept_compression_encodings: Default::default(),
442 send_compression_encodings: Default::default(),
443 max_decoding_message_size: None,
444 max_encoding_message_size: None,
445 }
446 }
447 pub fn with_interceptor<F>(
448 inner: T,
449 interceptor: F,
450 ) -> InterceptedService<Self, F>
451 where
452 F: tonic::service::Interceptor,
453 {
454 InterceptedService::new(Self::new(inner), interceptor)
455 }
456 #[must_use]
458 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
459 self.accept_compression_encodings.enable(encoding);
460 self
461 }
462 #[must_use]
464 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
465 self.send_compression_encodings.enable(encoding);
466 self
467 }
468 #[must_use]
472 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
473 self.max_decoding_message_size = Some(limit);
474 self
475 }
476 #[must_use]
480 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
481 self.max_encoding_message_size = Some(limit);
482 self
483 }
484 }
485 impl<T, B> tonic::codegen::Service<http::Request<B>> for ExternalAuthServiceServer<T>
486 where
487 T: ExternalAuthService,
488 B: Body + Send + 'static,
489 B::Error: Into<StdError> + Send + 'static,
490 {
491 type Response = http::Response<tonic::body::BoxBody>;
492 type Error = std::convert::Infallible;
493 type Future = BoxFuture<Self::Response, Self::Error>;
494 fn poll_ready(
495 &mut self,
496 _cx: &mut Context<'_>,
497 ) -> Poll<std::result::Result<(), Self::Error>> {
498 Poll::Ready(Ok(()))
499 }
500 fn call(&mut self, req: http::Request<B>) -> Self::Future {
501 let inner = self.inner.clone();
502 match req.uri().path() {
503 "/proto.rpc.v1.ExternalAuthService/AuthenticateTo" => {
504 #[allow(non_camel_case_types)]
505 struct AuthenticateToSvc<T: ExternalAuthService>(pub Arc<T>);
506 impl<
507 T: ExternalAuthService,
508 > tonic::server::UnaryService<super::AuthenticateToRequest>
509 for AuthenticateToSvc<T> {
510 type Response = super::AuthenticateToResponse;
511 type Future = BoxFuture<
512 tonic::Response<Self::Response>,
513 tonic::Status,
514 >;
515 fn call(
516 &mut self,
517 request: tonic::Request<super::AuthenticateToRequest>,
518 ) -> Self::Future {
519 let inner = Arc::clone(&self.0);
520 let fut = async move {
521 (*inner).authenticate_to(request).await
522 };
523 Box::pin(fut)
524 }
525 }
526 let accept_compression_encodings = self.accept_compression_encodings;
527 let send_compression_encodings = self.send_compression_encodings;
528 let max_decoding_message_size = self.max_decoding_message_size;
529 let max_encoding_message_size = self.max_encoding_message_size;
530 let inner = self.inner.clone();
531 let fut = async move {
532 let inner = inner.0;
533 let method = AuthenticateToSvc(inner);
534 let codec = tonic::codec::ProstCodec::default();
535 let mut grpc = tonic::server::Grpc::new(codec)
536 .apply_compression_config(
537 accept_compression_encodings,
538 send_compression_encodings,
539 )
540 .apply_max_message_size_config(
541 max_decoding_message_size,
542 max_encoding_message_size,
543 );
544 let res = grpc.unary(method, req).await;
545 Ok(res)
546 };
547 Box::pin(fut)
548 }
549 _ => {
550 Box::pin(async move {
551 Ok(
552 http::Response::builder()
553 .status(200)
554 .header("grpc-status", "12")
555 .header("content-type", "application/grpc")
556 .body(empty_body())
557 .unwrap(),
558 )
559 })
560 }
561 }
562 }
563 }
564 impl<T: ExternalAuthService> Clone for ExternalAuthServiceServer<T> {
565 fn clone(&self) -> Self {
566 let inner = self.inner.clone();
567 Self {
568 inner,
569 accept_compression_encodings: self.accept_compression_encodings,
570 send_compression_encodings: self.send_compression_encodings,
571 max_decoding_message_size: self.max_decoding_message_size,
572 max_encoding_message_size: self.max_encoding_message_size,
573 }
574 }
575 }
576 impl<T: ExternalAuthService> Clone for _Inner<T> {
577 fn clone(&self) -> Self {
578 Self(Arc::clone(&self.0))
579 }
580 }
581 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
582 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
583 write!(f, "{:?}", self.0)
584 }
585 }
586 impl<T: ExternalAuthService> tonic::server::NamedService
587 for ExternalAuthServiceServer<T> {
588 const NAME: &'static str = "proto.rpc.v1.ExternalAuthService";
589 }
590}