pub enum AuthN {
Disabled,
Enabled {
openid: Option<Authenticator>,
token: Option<Authenticator>,
},
}Expand description
An Authentication middleware for actix-web relying on drogue-cloud user-auth-service and an openID service
This middleware will act on each request and try to authenticate the request with :
- The
Authorisation: Bearerheader, which should contain an openID token. - The
Authorisation: Basicheader, which should contain a username and an access token issued by the drogue-cloud API. - The
tokenquery parameter, which should contain am openID token.
If more than one of the above is provided, the request will be responded with 400: Bad request.
After the authentication is successful, this middleware will inject the UserInformation in the request object and forward it.
§Fields
open_id- An instance ofopenid::AuthenticatorIt’s an openID client. It is used to verify OpenID tokens.token- An instance ofpat::Authenticator. It’s a client for drogue-cloud-user-auth-service. It is used to verify API keys.enable_access_token- Whether to allow access tokens for authentication.
Variants§
Disabled
Authentication is disabled, all requests will be using UserInformation::Anonymous.
Enabled
Authentication is enabled, using openid or API tokens.
NOTE: If neither is provided, all requests will fail.
Trait Implementations§
Source§impl From<(Option<Authenticator>, Option<Authenticator>)> for AuthN
Map a combination of openid and PAT authenticator
impl From<(Option<Authenticator>, Option<Authenticator>)> for AuthN
Map a combination of openid and PAT authenticator
Source§fn from(auth: (Option<Authenticator>, Option<Authenticator>)) -> Self
fn from(auth: (Option<Authenticator>, Option<Authenticator>)) -> Self
Converts to this type from the input type.
Source§impl<S, B> Transform<S, ServiceRequest> for AuthNwhere
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,
S::Future: 'static,
B: 'static,
impl<S, B> Transform<S, ServiceRequest> for AuthNwhere
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,
S::Future: 'static,
B: 'static,
Source§type Response = ServiceResponse<EitherBody<B>>
type Response = ServiceResponse<EitherBody<B>>
Responses produced by the service.
Source§type Future = Ready<Result<<AuthN as Transform<S, ServiceRequest>>::Transform, <AuthN as Transform<S, ServiceRequest>>::InitError>>
type Future = Ready<Result<<AuthN as Transform<S, ServiceRequest>>::Transform, <AuthN as Transform<S, ServiceRequest>>::InitError>>
The future response value.
Source§fn new_transform(&self, service: S) -> Self::Future
fn new_transform(&self, service: S) -> Self::Future
Creates and returns a new Transform component, asynchronously
Auto Trait Implementations§
impl Freeze for AuthN
impl !RefUnwindSafe for AuthN
impl !Send for AuthN
impl !Sync for AuthN
impl Unpin for AuthN
impl !UnwindSafe for AuthN
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more