summaryrefslogtreecommitdiffstats
path: root/rust/fatcat-api/src/server/auth.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-15 00:33:33 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-15 00:33:36 -0700
commit33a4cce0b97832f5f0301b318a0a50073ce6b615 (patch)
tree1b6ba7ec5944d2be2d746510e743a7934f453cd0 /rust/fatcat-api/src/server/auth.rs
parent4a1d8f20ab91fda0f4794131144915d0c5214268 (diff)
downloadfatcat-33a4cce0b97832f5f0301b318a0a50073ce6b615.tar.gz
fatcat-33a4cce0b97832f5f0301b318a0a50073ce6b615.zip
revert to v2.3.1 codegen
This reverts back to something compatible with Iron and simple (blocking) parallelism, instead of the new async hyper 0.11 stuff.
Diffstat (limited to 'rust/fatcat-api/src/server/auth.rs')
-rw-r--r--rust/fatcat-api/src/server/auth.rs93
1 files changed, 0 insertions, 93 deletions
diff --git a/rust/fatcat-api/src/server/auth.rs b/rust/fatcat-api/src/server/auth.rs
deleted file mode 100644
index 48dfd7d6..00000000
--- a/rust/fatcat-api/src/server/auth.rs
+++ /dev/null
@@ -1,93 +0,0 @@
-use Api;
-use hyper;
-use hyper::{Error, Request, Response, StatusCode};
-use server::url::form_urlencoded;
-use std::io;
-use swagger::auth::{AuthData, Authorization, Scopes};
-
-pub struct NewService<T>
-where
- T: hyper::server::NewService<
- Request = (Request, Option<AuthData>),
- Response = Response,
- Error = Error,
- >,
-{
- inner: T,
-}
-
-impl<T> NewService<T>
-where
- T: hyper::server::NewService<
- Request = (Request, Option<AuthData>),
- Response = Response,
- Error = Error,
- >
- + 'static,
-{
- pub fn new(inner: T) -> NewService<T> {
- NewService { inner }
- }
-}
-
-impl<T> hyper::server::NewService for NewService<T>
-where
- T: hyper::server::NewService<
- Request = (Request, Option<AuthData>),
- Response = Response,
- Error = Error,
- >
- + 'static,
-{
- type Request = Request;
- type Response = Response;
- type Error = Error;
- type Instance = Service<T::Instance>;
-
- fn new_service(&self) -> Result<Self::Instance, io::Error> {
- self.inner.new_service().map(|s| Service::new(s))
- }
-}
-
-/// Middleware to extract authentication data from request
-pub struct Service<T>
-where
- T: hyper::server::Service<
- Request = (Request, Option<AuthData>),
- Response = Response,
- Error = Error,
- >,
-{
- inner: T,
-}
-
-impl<T> Service<T>
-where
- T: hyper::server::Service<
- Request = (Request, Option<AuthData>),
- Response = Response,
- Error = Error,
- >,
-{
- pub fn new(inner: T) -> Service<T> {
- Service { inner }
- }
-}
-
-impl<T> hyper::server::Service for Service<T>
-where
- T: hyper::server::Service<
- Request = (Request, Option<AuthData>),
- Response = Response,
- Error = Error,
- >,
-{
- type Request = Request;
- type Response = Response;
- type Error = Error;
- type Future = T::Future;
-
- fn call(&self, req: Self::Request) -> Self::Future {
- return self.inner.call((req, None));
- }
-}