Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
aloise committed Jun 7, 2022
1 parent dc7d19e commit f986e24
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/auth_middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ use std::task::{Context, Poll};

#[derive(Clone, Debug)]
pub struct AuthContext {
subject: Subject,
token: String,
organization: Option<String>,
scopes: BTreeMap<String, Vec<String>>,
pub subject: Subject,
pub token: String,
pub organization: Option<String>,
pub scopes: BTreeMap<String, Vec<String>>,
}

impl AuthContext {
Expand Down Expand Up @@ -127,6 +127,7 @@ fn extract_organization(maybe_organization: Option<&HeaderValue>) -> Option<Stri
}
}

#[derive(Default)]
pub struct AuthMiddlewareFactory();

impl<S, B> Transform<S> for AuthMiddlewareFactory
Expand All @@ -146,12 +147,6 @@ where
}
}

impl Default for AuthMiddlewareFactory {
fn default() -> AuthMiddlewareFactory {
AuthMiddlewareFactory()
}
}

pub struct AuthMiddleware<S> {
service: S,
}
Expand Down

0 comments on commit f986e24

Please sign in to comment.