diff --git a/actix_cors/all.html b/actix_cors/all.html index f3b58d676..4e8394345 100644 --- a/actix_cors/all.html +++ b/actix_cors/all.html @@ -1,3 +1,3 @@ -
#[non_exhaustive] pub enum CorsError { @@ -19,40 +19,40 @@ pub enum CorsError {
OriginNotAllowed
Origin is not allowed to make this request.
MethodNotAllowed
Request method is not allowed.
HeadersNotAllowed
One or more request headers are not allowed.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
source
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
use the Display impl or to_string()
replaced by Error::source, which can support downcasting
error_generic_member_access
Provides type based access to context intended for error reports. Read more
Returns appropriate status code for error. Read more
Creates full response for error. Read more
Gets the TypeId of self. Read more
TypeId
self
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Returns the argument unchanged.
Instruments this type with the provided Span, returning an +
Span
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instrumented
Instruments this type with the current Span, returning an +
Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Calls U::from(self).
U::from(self)
That is, this conversion is whatever the implementation of From<T> for U chooses to do.
From<T> for U
provide_any
Data providers should implement this method to provide all values they are able to +
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
demand
Should always be Self
Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
String
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a +
Subscriber
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
WithDispatch
Attaches the current default Subscriber to this type, returning a +
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Cross-Origin Resource Sharing (CORS) controls for Actix Web.
This middleware can be applied to both applications and resources. Once built, a @@ -39,4 +39,4 @@ }
Builder for CORS middleware.
Errors that can occur when processing CORS guarded requests.
pub struct Cors { /* private fields */ }
To construct a CORS middleware, call Cors::default() to create a blank, restrictive builder. @@ -22,12 +22,12 @@ server will fail to start up or serve requests.
Cors::default()
A very permissive set of default for quick development. Not recommended for production use.
All origins, methods, request headers and exposed headers allowed. Credentials supported. Max age 1 hour. Does not send wildcard.
Resets allowed origin list to a state where any origin is accepted.
See Cors::allowed_origin for more info on allowed origins.
Cors::allowed_origin
Add an origin that is allowed to make requests.
By default, requests from all origins are accepted by CORS logic. This method allows to specify a finite set of origins to verify the value of the Origin request header.
Origin
These are origin-or-null types in the Fetch Standard.
origin-or-null
*
Cors::send_wildcard
Determinate allowed origins by processing requests which didn’t match any origins specified +
Determinate allowed origins by processing requests which didn’t match any origins specified in the allowed_origin.
allowed_origin
The function will receive two parameters, the Origin header value, and the RequestHead of each request, which can be used to determine whether to allow the request or not.
RequestHead
If the function returns true, the client’s Origin request header will be echoed back into the Access-Control-Allow-Origin response header.
true
Access-Control-Allow-Origin
Resets allowed methods list to all methods.
See Cors::allowed_methods for more info on allowed methods.
Cors::allowed_methods
Set a list of methods which allowed origins can perform.
These will be sent in the Access-Control-Allow-Methods response header as specified in the Fetch Standard CORS protocol.
Access-Control-Allow-Methods
Defaults to [GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE]
[GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE]
Resets allowed request header list to a state where any header is accepted.
See Cors::allowed_headers for more info on allowed request headers.
Cors::allowed_headers
Add an allowed request header.
Set a list of request header field names which can be used when this resource is accessed by +
Set a list of request header field names which can be used when this resource is accessed by allowed origins.
If All is set, whatever is requested by the client in Access-Control-Request-Headers will be echoed back in the Access-Control-Allow-Headers header as specified in the Fetch Standard CORS protocol.
All
Access-Control-Request-Headers
Access-Control-Allow-Headers
Defaults to All.
Resets exposed response header list to a state where all headers are exposed.
See Cors::expose_headers for more info on exposed response headers.
Cors::expose_headers
Set a list of headers which are safe to expose to the API of a CORS API specification. +
Set a list of headers which are safe to expose to the API of a CORS API specification. This corresponds to the Access-Control-Expose-Headers response header as specified in the Fetch Standard CORS protocol.
Access-Control-Expose-Headers
This defaults to an empty set.
Set a maximum time (in seconds) for which this CORS request may be cached. This value is set +
Set a maximum time (in seconds) for which this CORS request may be cached. This value is set as the Access-Control-Max-Age header as specified in the Fetch Standard CORS protocol.
Access-Control-Max-Age
Pass a number (of seconds) or use None to disable sending max age header.
Set to use wildcard origins.
If send wildcard is set and the allowed_origins parameter is All, a wildcard Access-Control-Allow-Origin response header is sent, rather than the request’s Origin header.
allowed_origins
Allows users to make authenticated requests
If true, injects the Access-Control-Allow-Credentials header in responses. This allows cookies and credentials to be submitted across domains as specified in the Fetch Standard CORS protocol.
Access-Control-Allow-Credentials
Defaults to false.
false
A server initialization error will occur if credentials are allowed, but the Origin is set to send wildcards (*); this is not allowed by the CORS protocol.
Disable Vary header support.
Vary
When enabled the header Vary: Origin will be returned as per the Fetch Standard implementation guidelines.
Vary: Origin
Setting this header when the Access-Control-Allow-Origin is dynamically generated (eg. when there is more than one allowed origin, and an Origin other than ‘*’ is returned) informs CDNs and other caches that the CORS headers are dynamic, and cannot be cached.
By default, Vary header support is enabled.
Disable support for preflight requests.
When enabled CORS middleware automatically handles OPTIONS requests. This is useful for application level middleware.
OPTIONS
By default preflight support is enabled.
A restrictive (security paranoid) set of defaults.
No allowed origins, methods, request headers or exposed headers. Credentials not supported. No max age (will use browser’s default).
Responses produced by the service.
Errors produced by the service.
Errors produced while building a transform service.
The TransformService value created by this factory
TransformService
The future response value.
Creates and returns a new Transform component, asynchronously
#[non_exhaustive] +LogoutBehaviour in actix_identity::config - Rust☰LogoutBehaviourVariantsDeleteIdentityKeysPurgeSessionTrait ImplementationsCloneDebugAuto Trait ImplementationsRefUnwindSafeSendSyncUnpinUnwindSafeBlanket ImplementationsAnyBorrow<T>BorrowMut<T>From<T>InstrumentInto<U>Same<T>ToOwnedTryFrom<U>TryInto<U>VZip<V>WithSubscriberIn actix_identity::config?Enum actix_identity::config::LogoutBehavioursource · [−]#[non_exhaustive] pub enum LogoutBehaviour { PurgeSession, DeleteIdentityKeys, @@ -11,30 +11,30 @@ session state that are tied to the user’s identity and should not be retained information from the current session state. The session itself is not destroyed. This behaviour might be desirable when you have stored information in the session state that is not tied to the user’s identity and should be retained after logout. -Trait Implementationssourceimpl Clone for LogoutBehavioursourcefn clone(&self) -> LogoutBehaviourReturns a copy of the value. Read more +Trait Implementationssourceimpl Clone for LogoutBehavioursourcefn clone(&self) -> LogoutBehaviourReturns a copy of the value. Read more 1.0.0 · sourcefn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more -sourceimpl Debug for LogoutBehavioursourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more -Auto Trait Implementationsimpl RefUnwindSafe for LogoutBehaviourimpl Send for LogoutBehaviourimpl Sync for LogoutBehaviourimpl Unpin for LogoutBehaviourimpl UnwindSafe for LogoutBehaviourBlanket Implementationssourceimpl<T> Any for T where T: 'static + ?Sized, sourcefn type_id(&self) -> TypeIdGets the TypeId of self. Read more -sourceimpl<T> Borrow<T> for T where T: ?Sized, const: unstable · sourcefn borrow(&self) -> &TImmutably borrows from an owned value. Read more -sourceimpl<T> BorrowMut<T> for T where T: ?Sized, const: unstable · sourcefn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more -sourceimpl<T> From<T> for Tconst: unstable · sourcefn from(t: T) -> TReturns the argument unchanged. -sourceimpl<T> Instrument for Tsourcefn instrument(self, span: Span) -> Instrumented<Self>Instruments this type with the provided Span, returning an +sourceimpl Debug for LogoutBehavioursourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more +Auto Trait Implementationsimpl RefUnwindSafe for LogoutBehaviourimpl Send for LogoutBehaviourimpl Sync for LogoutBehaviourimpl Unpin for LogoutBehaviourimpl UnwindSafe for LogoutBehaviourBlanket Implementationssourceimpl<T> Any for T where T: 'static + ?Sized, sourcefn type_id(&self) -> TypeIdGets the TypeId of self. Read more +sourceimpl<T> Borrow<T> for T where T: ?Sized, const: unstable · sourcefn borrow(&self) -> &TImmutably borrows from an owned value. Read more +sourceimpl<T> BorrowMut<T> for T where T: ?Sized, const: unstable · sourcefn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more +sourceimpl<T> From<T> for Tconst: unstable · sourcefn from(t: T) -> TReturns the argument unchanged. +sourceimpl<T> Instrument for Tsourcefn instrument(self, span: Span) -> Instrumented<Self>Instruments this type with the provided Span, returning an Instrumented wrapper. Read more -sourcefn in_current_span(self) -> Instrumented<Self>Instruments this type with the current Span, returning an +sourcefn in_current_span(self) -> Instrumented<Self>Instruments this type with the current Span, returning an Instrumented wrapper. Read more -sourceimpl<T, U> Into<U> for T where U: From<T>, const: unstable · sourcefn into(self) -> UCalls U::from(self). +sourceimpl<T, U> Into<U> for T where U: From<T>, const: unstable · sourcefn into(self) -> UCalls U::from(self). That is, this conversion is whatever the implementation of From<T> for U chooses to do. -sourceimpl<T> Same<T> for Ttype Output = TShould always be Self -sourceimpl<T> ToOwned for T where T: Clone, type Owned = TThe resulting type after obtaining ownership. -sourcefn to_owned(&self) -> TCreates owned data from borrowed data, usually by cloning. Read more -sourcefn clone_into(&self, target: &mut T)Uses borrowed data to replace owned data, usually by cloning. Read more -sourceimpl<T, U> TryFrom<U> for T where U: Into<T>, type Error = InfallibleThe type returned in the event of a conversion error. +sourceimpl<T> Same<T> for Ttype Output = TShould always be Self +sourceimpl<T> ToOwned for T where T: Clone, type Owned = TThe resulting type after obtaining ownership. +sourcefn to_owned(&self) -> TCreates owned data from borrowed data, usually by cloning. Read more +sourcefn clone_into(&self, target: &mut T)Uses borrowed data to replace owned data, usually by cloning. Read more +sourceimpl<T, U> TryFrom<U> for T where U: Into<T>, type Error = InfallibleThe type returned in the event of a conversion error. const: unstable · sourcefn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>Performs the conversion. -sourceimpl<T, U> TryInto<U> for T where U: TryFrom<T>, type Error = <U as TryFrom<T>>::ErrorThe type returned in the event of a conversion error. +sourceimpl<T, U> TryInto<U> for T where U: TryFrom<T>, type Error = <U as TryFrom<T>>::ErrorThe type returned in the event of a conversion error. const: unstable · sourcefn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>Performs the conversion. -impl<V, T> VZip<V> for T where V: MultiLane<T>, fn vzip(self) -> Vsourceimpl<T> WithSubscriber for Tsourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>, Attaches the provided Subscriber to this type, returning a +impl<V, T> VZip<V> for T where V: MultiLane<T>, fn vzip(self) -> Vsourceimpl<T> WithSubscriber for Tsourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>, Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more -sourcefn with_current_subscriber(self) -> WithDispatch<Self>Attaches the current default Subscriber to this type, returning a +sourcefn with_current_subscriber(self) -> WithDispatch<Self>Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more - \ No newline at end of file +
#[non_exhaustive] pub enum LogoutBehaviour { PurgeSession, DeleteIdentityKeys, @@ -11,30 +11,30 @@ session state that are tied to the user’s identity and should not be retained information from the current session state. The session itself is not destroyed. This behaviour might be desirable when you have stored information in the session state that is not tied to the user’s identity and should be retained after logout. -
This behaviour might be desirable when you have stored information in the session state that is not tied to the user’s identity and should be retained after logout.
Configuration options to tune the behaviour of IdentityMiddleware.
IdentityMiddleware
A fluent builder to construct an IdentityMiddleware instance with custom configuration parameters.
LogoutBehaviour controls what actions are going to be performed when Identity::logout is invoked.
LogoutBehaviour
Identity::logout
pub struct IdentityMiddlewareBuilder { /* private fields */ }
A fluent builder to construct an IdentityMiddleware instance with custom configuration +
Use IdentityMiddleware::builder to get started!
IdentityMiddleware::builder
Determines how Identity::logout affects the current session.
By default, the current session is purged (LogoutBehaviour::PurgeSession).
LogoutBehaviour::PurgeSession
Automatically logs out users after a certain amount of time has passed since they logged in, +
Automatically logs out users after a certain amount of time has passed since they logged in, regardless of their activity pattern.
If set to:
By default, login deadline is disabled.
Automatically logs out users after a certain amount of time has passed since their last +
Automatically logs out users after a certain amount of time has passed since their last visit.
By default, visit deadline is disabled.
Finalises the builder and returns an IdentityMiddleware instance.
Identity management for Actix Web.
actix-identity can be used to track identity of a user across multiple requests. It is built on top of HTTP sessions, via actix-session.
actix-identity
actix-session
A verified user identity. It can be used as a request extractor.
Identity management middleware.
Helper trait to retrieve an Identity instance from various actix-web’s types.
Identity
actix-web
pub struct Identity(_);
The lifecycle of a user identity is tied to the lifecycle of the underlying session. If the session is destroyed (e.g. the session expired), the user identity will be forgotten, de-facto forcing a user log out.
Return the user id associated to the current session.
use actix_web::{get, Responder}; use actix_identity::Identity; @@ -62,7 +62,7 @@ control of the error path. "Welcome Anonymous!".to_owned() } }
Attach a valid user identity to the current session.
This method should be called after you have successfully authenticated the user. After login has been called, the user will be able to access all routes that require a valid Identity.
login
Remove the user identity from the current session.
After logout has been called, the user will no longer be able to access routes that require a valid Identity.
logout
The behaviour on logout is determined by IdentityMiddlewareBuilder::logout_behaviour.
IdentityMiddlewareBuilder::logout_behaviour
Identity user.logout(); HttpResponse::Ok() }
Extractor implementation for Identity.
use actix_web::{get, Responder}; use actix_identity::Identity; @@ -103,26 +103,26 @@ require a valid Identity }
Identity }
The associated error which can be returned.
Future that resolves to a Self. Read more
Create a Self from request parts asynchronously.
Create a Self from request head asynchronously. Read more
pub struct IdentityMiddleware { /* private fields */ }
use actix_web::{cookie::Key, App, HttpServer}; use actix_session::storage::RedisSessionStore; @@ -19,37 +19,37 @@ .wrap(SessionMiddleware::new(redis_store.clone(), secret_key.clone())) }) }
A fluent API to configure IdentityMiddleware.
Returns the “default value” for a type. Read more
pub trait IdentityExt { +IdentityExt in actix_identity - Rust☰IdentityExtRequired Methodsget_identityImplementations on Foreign TypesGuardContext<'a>HttpRequestServiceRequestImplementorsIn actix_identity?Trait actix_identity::IdentityExtsource · [−]pub trait IdentityExt { fn get_identity(&self) -> Result<Identity, Error>; }Expand descriptionHelper trait to retrieve an Identity instance from various actix-web’s types. -Required Methodssourcefn get_identity(&self) -> Result<Identity, Error>Retrieve the identity attached to the current session, if available. -Implementations on Foreign Typessourceimpl IdentityExt for HttpRequestsourcefn get_identity(&self) -> Result<Identity, Error>sourceimpl IdentityExt for ServiceRequestsourcefn get_identity(&self) -> Result<Identity, Error>sourceimpl<'a> IdentityExt for GuardContext<'a>sourcefn get_identity(&self) -> Result<Identity, Error>Implementors \ No newline at end of file +
pub trait IdentityExt { fn get_identity(&self) -> Result<Identity, Error>; }
Retrieve the identity attached to the current session, if available.
pub const DEFAULT_COOKIE_NAME: &'static str = "sid";
Default cookie name.
pub const DEFAULT_PERIOD_SECS: u64 = 3600;
Default period (in seconds).
pub const DEFAULT_REQUEST_LIMIT: usize = 5000;
Default request limit.
pub const DEFAULT_SESSION_KEY: &'static str = "rate-api-id";
Default session key.
pub enum Error { Client(RedisError), @@ -10,35 +10,35 @@
LimitExceeded(Status)
Limit is exceeded for a key.
Time(ComponentRange)
Time conversion failed.
Other(String)
Generic error.
Converts to this type from the input type.
Rate limiter using a fixed window counter for arbitrary keys, backed by Redis for Actix Web.
[dependencies] @@ -44,4 +44,4 @@ actix-limitation = "0.3"
pub struct Builder { /* private fields */ }
Rate limiter builder.
Set upper limit.
Set limit window/period.
Set name of cookie to be sent.
Set session key to be used in backend.
Finalizes and returns a Limiter.
Limiter
Note that this method will connect to the Redis server to test its connection which is a synchronous operation.
pub struct Limiter { /* private fields */ }
Rate limiter.
Construct rate limiter builder with defaults.
See redis-rs docs on connection parameters for how to set the Redis URL.
redis-rs
Consumes one rate limit unit, returning the status.
#[non_exhaustive]pub struct RateLimiter;
Rate limit middleware.
pub struct Status { /* private fields */ }
A report for a given key containing the limit status.
Returns the maximum number of requests allowed in the current period.
Returns how many requests are left in the current period.
Returns a UNIX timestamp in UTC approximately when the next period will begin.
pub enum ProtoBufPayloadError { +ProtoBufPayloadError in actix_protobuf - Rust☰ProtoBufPayloadErrorVariantsContentTypeDeserializeOverflowPayloadSerializeTrait ImplementationsDebugDisplayFrom<DecodeError>From<PayloadError>ResponseErrorAuto Trait Implementations!RefUnwindSafeSendSyncUnpin!UnwindSafeBlanket ImplementationsAnyBorrow<T>BorrowMut<T>From<T>InstrumentInto<U>Same<T>ToStringTryFrom<U>TryInto<U>VZip<V>WithSubscriberIn actix_protobuf?Enum actix_protobuf::ProtoBufPayloadErrorsource · [−]pub enum ProtoBufPayloadError { Overflow, ContentType, Serialize(ProtoBufEncodeError), @@ -9,31 +9,31 @@ Serialize(ProtoBufEncodeError)Serialize error Deserialize(ProtoBufDecodeError)Deserialize error Payload(PayloadError)Payload error -Trait Implementationssourceimpl Debug for ProtoBufPayloadErrorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more -sourceimpl Display for ProtoBufPayloadErrorsourcefn fmt(&self, _derive_more_display_formatter: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more -sourceimpl From<DecodeError> for ProtoBufPayloadErrorsourcefn from(err: ProtoBufDecodeError) -> ProtoBufPayloadErrorConverts to this type from the input type. -sourceimpl From<PayloadError> for ProtoBufPayloadErrorsourcefn from(err: PayloadError) -> ProtoBufPayloadErrorConverts to this type from the input type. -sourceimpl ResponseError for ProtoBufPayloadErrorsourcefn error_response(&self) -> HttpResponseCreates full response for error. Read more +Trait Implementationssourceimpl Debug for ProtoBufPayloadErrorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more +sourceimpl Display for ProtoBufPayloadErrorsourcefn fmt(&self, _derive_more_display_formatter: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more +sourceimpl From<DecodeError> for ProtoBufPayloadErrorsourcefn from(err: ProtoBufDecodeError) -> ProtoBufPayloadErrorConverts to this type from the input type. +sourceimpl From<PayloadError> for ProtoBufPayloadErrorsourcefn from(err: PayloadError) -> ProtoBufPayloadErrorConverts to this type from the input type. +sourceimpl ResponseError for ProtoBufPayloadErrorsourcefn error_response(&self) -> HttpResponseCreates full response for error. Read more fn status_code(&self) -> StatusCodeReturns appropriate status code for error. Read more -Auto Trait Implementationsimpl !RefUnwindSafe for ProtoBufPayloadErrorimpl Send for ProtoBufPayloadErrorimpl Sync for ProtoBufPayloadErrorimpl Unpin for ProtoBufPayloadErrorimpl !UnwindSafe for ProtoBufPayloadErrorBlanket Implementationssourceimpl<T> Any for T where T: 'static + ?Sized, sourcefn type_id(&self) -> TypeIdGets the TypeId of self. Read more -sourceimpl<T> Borrow<T> for T where T: ?Sized, const: unstable · sourcefn borrow(&self) -> &TImmutably borrows from an owned value. Read more -sourceimpl<T> BorrowMut<T> for T where T: ?Sized, const: unstable · sourcefn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more -sourceimpl<T> From<T> for Tconst: unstable · sourcefn from(t: T) -> TReturns the argument unchanged. -sourceimpl<T> Instrument for Tsourcefn instrument(self, span: Span) -> Instrumented<Self>Instruments this type with the provided Span, returning an +Auto Trait Implementationsimpl !RefUnwindSafe for ProtoBufPayloadErrorimpl Send for ProtoBufPayloadErrorimpl Sync for ProtoBufPayloadErrorimpl Unpin for ProtoBufPayloadErrorimpl !UnwindSafe for ProtoBufPayloadErrorBlanket Implementationssourceimpl<T> Any for T where T: 'static + ?Sized, sourcefn type_id(&self) -> TypeIdGets the TypeId of self. Read more +sourceimpl<T> Borrow<T> for T where T: ?Sized, const: unstable · sourcefn borrow(&self) -> &TImmutably borrows from an owned value. Read more +sourceimpl<T> BorrowMut<T> for T where T: ?Sized, const: unstable · sourcefn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more +sourceimpl<T> From<T> for Tconst: unstable · sourcefn from(t: T) -> TReturns the argument unchanged. +sourceimpl<T> Instrument for Tsourcefn instrument(self, span: Span) -> Instrumented<Self>Instruments this type with the provided Span, returning an Instrumented wrapper. Read more -sourcefn in_current_span(self) -> Instrumented<Self>Instruments this type with the current Span, returning an +sourcefn in_current_span(self) -> Instrumented<Self>Instruments this type with the current Span, returning an Instrumented wrapper. Read more -sourceimpl<T, U> Into<U> for T where U: From<T>, const: unstable · sourcefn into(self) -> UCalls U::from(self). +sourceimpl<T, U> Into<U> for T where U: From<T>, const: unstable · sourcefn into(self) -> UCalls U::from(self). That is, this conversion is whatever the implementation of From<T> for U chooses to do. -sourceimpl<T> Same<T> for Ttype Output = TShould always be Self -sourceimpl<T> ToString for T where T: Display + ?Sized, sourcedefault fn to_string(&self) -> StringConverts the given value to a String. Read more -sourceimpl<T, U> TryFrom<U> for T where U: Into<T>, type Error = InfallibleThe type returned in the event of a conversion error. +sourceimpl<T> Same<T> for Ttype Output = TShould always be Self +sourceimpl<T> ToString for T where T: Display + ?Sized, sourcedefault fn to_string(&self) -> StringConverts the given value to a String. Read more +sourceimpl<T, U> TryFrom<U> for T where U: Into<T>, type Error = InfallibleThe type returned in the event of a conversion error. const: unstable · sourcefn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>Performs the conversion. -sourceimpl<T, U> TryInto<U> for T where U: TryFrom<T>, type Error = <U as TryFrom<T>>::ErrorThe type returned in the event of a conversion error. +sourceimpl<T, U> TryInto<U> for T where U: TryFrom<T>, type Error = <U as TryFrom<T>>::ErrorThe type returned in the event of a conversion error. const: unstable · sourcefn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>Performs the conversion. -impl<V, T> VZip<V> for T where V: MultiLane<T>, fn vzip(self) -> Vsourceimpl<T> WithSubscriber for Tsourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>, Attaches the provided Subscriber to this type, returning a +impl<V, T> VZip<V> for T where V: MultiLane<T>, fn vzip(self) -> Vsourceimpl<T> WithSubscriber for Tsourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>, Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more -sourcefn with_current_subscriber(self) -> WithDispatch<Self>Attaches the current default Subscriber to this type, returning a +sourcefn with_current_subscriber(self) -> WithDispatch<Self>Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more - \ No newline at end of file +
pub enum ProtoBufPayloadError { Overflow, ContentType, Serialize(ProtoBufEncodeError), @@ -9,31 +9,31 @@
Serialize(ProtoBufEncodeError)
Serialize error
Deserialize(ProtoBufDecodeError)
Deserialize error
Payload(PayloadError)
Payload error
Protobuf payload extractor for Actix Web.
pub struct ProtoBuf<T: Message>(pub T);
0: T
The resulting type after dereferencing.
Dereferences the value.
Mutably dereferences the value.
Convert self to HttpResponse.
HttpResponse
Wraps responder to allow alteration of its response. Read more
Type of resource’s path returned in resource_path.
resource_path
pub struct ProtoBufConfig { /* private fields */ }
Change max size of payload. By default max size is 256Kb
pub struct ProtoBufMessage<T: Message + Default> { /* private fields */ }
Create ProtoBufMessage for request.
ProtoBufMessage
The type of value produced on completion.
Attempt to resolve the future to a final value, registering +
Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more
Map this future’s output to a different type, returning a new future of the resulting type. Read more
Map this future’s output to a different type, returning a new future of @@ -40,18 +40,18 @@ its output to another future on a separate task. Read more
A convenience for calling Future::poll on Unpin future types.
Future::poll
Unpin
Evaluates and consumes the future, returning the resulting output if the future is ready after the first call to Future::poll. Read more
The output that the future will produce on completion.
Which kind of future are we turning this into?
Creates a future from a value. Read more
The type of successful values yielded by this future
The type of failures yielded by this future
Future
A convenience method for calling [TryFuture::try_poll] on Unpin future types. Read more
TryFuture::try_poll
pub trait ProtoBufResponseBuilder { +ProtoBufResponseBuilder in actix_protobuf - Rust☰ProtoBufResponseBuilderRequired MethodsprotobufImplementations on Foreign TypesHttpResponseBuilderImplementorsIn actix_protobuf?Trait actix_protobuf::ProtoBufResponseBuildersource · [−]pub trait ProtoBufResponseBuilder { fn protobuf<T: Message>(&mut self, value: T) -> Result<HttpResponse, Error>; -}Required Methodssourcefn protobuf<T: Message>(&mut self, value: T) -> Result<HttpResponse, Error>Implementations on Foreign Typessourceimpl ProtoBufResponseBuilder for HttpResponseBuildersourcefn protobuf<T: Message>(&mut self, value: T) -> Result<HttpResponse, Error>Implementors \ No newline at end of file +}
pub trait ProtoBufResponseBuilder { fn protobuf<T: Message>(&mut self, value: T) -> Result<HttpResponse, Error>; -}
pub enum Error { +Error in actix_redis - Rust☰ErrorVariantsDisconnectedNotConnectedRedisTrait ImplementationsDebugDisplayErrorFrom<Error>ResponseErrorAuto Trait Implementations!RefUnwindSafeSendSyncUnpin!UnwindSafeBlanket ImplementationsAnyBorrow<T>BorrowMut<T>From<T>InstrumentInto<U>ProviderSame<T>ToStringTryFrom<U>TryInto<U>VZip<V>WithSubscriberIn actix_redis?Enum actix_redis::Errorsource · [−]pub enum Error { Redis(Error), NotConnected, Disconnected, }Expand descriptionGeneral purpose actix-redis error. VariantsRedis(Error)NotConnectedReceiving message during reconnecting. DisconnectedCancel all waiters when connection is dropped. -Trait Implementationssourceimpl Debug for Errorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more -sourceimpl Display for Errorsourcefn fmt(&self, _derive_more_display_formatter: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more -sourceimpl Error for Errorsourcefn source(&self) -> Option<&(dyn Error + 'static)>The lower-level source of this error, if any. Read more +Trait Implementationssourceimpl Debug for Errorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more +sourceimpl Display for Errorsourcefn fmt(&self, _derive_more_display_formatter: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more +sourceimpl Error for Errorsourcefn source(&self) -> Option<&(dyn Error + 'static)>The lower-level source of this error, if any. Read more 1.0.0 · sourcefn description(&self) -> &str👎Deprecated since 1.42.0: use the Display impl or to_string() Read more1.0.0 · sourcefn cause(&self) -> Option<&dyn Error>👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting -sourcefn provide(&'a self, req: &mut Demand<'a>)🔬This is a nightly-only experimental API. (error_generic_member_access)Provides type based access to context intended for error reports. Read more -sourceimpl From<Error> for Errorsourcefn from(original: Error) -> ErrorConverts to this type from the input type. -sourceimpl ResponseError for Errorfn status_code(&self) -> StatusCodeReturns appropriate status code for error. Read more +sourcefn provide(&'a self, req: &mut Demand<'a>)🔬This is a nightly-only experimental API. (error_generic_member_access)Provides type based access to context intended for error reports. Read more +sourceimpl From<Error> for Errorsourcefn from(original: Error) -> ErrorConverts to this type from the input type. +sourceimpl ResponseError for Errorfn status_code(&self) -> StatusCodeReturns appropriate status code for error. Read more fn error_response(&self) -> HttpResponse<BoxBody>Creates full response for error. Read more -Auto Trait Implementationsimpl !RefUnwindSafe for Errorimpl Send for Errorimpl Sync for Errorimpl Unpin for Errorimpl !UnwindSafe for ErrorBlanket Implementationssourceimpl<T> Any for T where T: 'static + ?Sized, sourcefn type_id(&self) -> TypeIdGets the TypeId of self. Read more -sourceimpl<T> Borrow<T> for T where T: ?Sized, const: unstable · sourcefn borrow(&self) -> &TImmutably borrows from an owned value. Read more -sourceimpl<T> BorrowMut<T> for T where T: ?Sized, const: unstable · sourcefn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more -sourceimpl<T> From<T> for Tconst: unstable · sourcefn from(t: T) -> TReturns the argument unchanged. -sourceimpl<T> Instrument for Tsourcefn instrument(self, span: Span) -> Instrumented<Self>Instruments this type with the provided Span, returning an +Auto Trait Implementationsimpl !RefUnwindSafe for Errorimpl Send for Errorimpl Sync for Errorimpl Unpin for Errorimpl !UnwindSafe for ErrorBlanket Implementationssourceimpl<T> Any for T where T: 'static + ?Sized, sourcefn type_id(&self) -> TypeIdGets the TypeId of self. Read more +sourceimpl<T> Borrow<T> for T where T: ?Sized, const: unstable · sourcefn borrow(&self) -> &TImmutably borrows from an owned value. Read more +sourceimpl<T> BorrowMut<T> for T where T: ?Sized, const: unstable · sourcefn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more +sourceimpl<T> From<T> for Tconst: unstable · sourcefn from(t: T) -> TReturns the argument unchanged. +sourceimpl<T> Instrument for Tsourcefn instrument(self, span: Span) -> Instrumented<Self>Instruments this type with the provided Span, returning an Instrumented wrapper. Read more -sourcefn in_current_span(self) -> Instrumented<Self>Instruments this type with the current Span, returning an +sourcefn in_current_span(self) -> Instrumented<Self>Instruments this type with the current Span, returning an Instrumented wrapper. Read more -sourceimpl<T, U> Into<U> for T where U: From<T>, const: unstable · sourcefn into(self) -> UCalls U::from(self). +sourceimpl<T, U> Into<U> for T where U: From<T>, const: unstable · sourcefn into(self) -> UCalls U::from(self). That is, this conversion is whatever the implementation of From<T> for U chooses to do. -sourceimpl<E> Provider for E where E: Error + ?Sized, sourcefn provide(&'a self, req: &mut Demand<'a>)🔬This is a nightly-only experimental API. (provide_any)Data providers should implement this method to provide all values they are able to +sourceimpl<E> Provider for E where E: Error + ?Sized, sourcefn provide(&'a self, req: &mut Demand<'a>)🔬This is a nightly-only experimental API. (provide_any)Data providers should implement this method to provide all values they are able to provide by using demand. Read more -sourceimpl<T> Same<T> for Ttype Output = TShould always be Self -sourceimpl<T> ToString for T where T: Display + ?Sized, sourcedefault fn to_string(&self) -> StringConverts the given value to a String. Read more -sourceimpl<T, U> TryFrom<U> for T where U: Into<T>, type Error = InfallibleThe type returned in the event of a conversion error. +sourceimpl<T> Same<T> for Ttype Output = TShould always be Self +sourceimpl<T> ToString for T where T: Display + ?Sized, sourcedefault fn to_string(&self) -> StringConverts the given value to a String. Read more +sourceimpl<T, U> TryFrom<U> for T where U: Into<T>, type Error = InfallibleThe type returned in the event of a conversion error. const: unstable · sourcefn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>Performs the conversion. -sourceimpl<T, U> TryInto<U> for T where U: TryFrom<T>, type Error = <U as TryFrom<T>>::ErrorThe type returned in the event of a conversion error. +sourceimpl<T, U> TryInto<U> for T where U: TryFrom<T>, type Error = <U as TryFrom<T>>::ErrorThe type returned in the event of a conversion error. const: unstable · sourcefn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>Performs the conversion. -impl<V, T> VZip<V> for T where V: MultiLane<T>, fn vzip(self) -> Vsourceimpl<T> WithSubscriber for Tsourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>, Attaches the provided Subscriber to this type, returning a +impl<V, T> VZip<V> for T where V: MultiLane<T>, fn vzip(self) -> Vsourceimpl<T> WithSubscriber for Tsourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>, Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more -sourcefn with_current_subscriber(self) -> WithDispatch<Self>Attaches the current default Subscriber to this type, returning a +sourcefn with_current_subscriber(self) -> WithDispatch<Self>Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more - \ No newline at end of file +
pub enum Error { Redis(Error), NotConnected, Disconnected, }
General purpose actix-redis error.
actix-redis
Redis(Error)
NotConnected
Receiving message during reconnecting.
Disconnected
Cancel all waiters when connection is dropped.
pub enum RespError { +RespError in actix_redis - Rust☰RespErrorVariantsConnectionIOInternalRemoteRespUnexpectedTrait ImplementationsDebugDisplayErrorFrom<Error>From<Error>From<TrySendError<T>>Auto Trait Implementations!RefUnwindSafeSendSyncUnpin!UnwindSafeBlanket ImplementationsAnyBorrow<T>BorrowMut<T>From<T>InstrumentInto<U>ProviderSame<T>ToStringTryFrom<U>TryInto<U>VZip<V>WithSubscriberIn actix_redis?Enum actix_redis::RespError[−]pub enum RespError { Internal(String), IO(Error), Resp(String, Option<RespValue>), @@ -21,31 +21,31 @@ a proper option. impl Error for Errorfn source(&self) -> Option<&(dyn Error + 'static)>The lower-level source of this error, if any. Read more 1.0.0 · sourcefn description(&self) -> &str👎Deprecated since 1.42.0: use the Display impl or to_string() Read more1.0.0 · sourcefn cause(&self) -> Option<&dyn Error>👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting -sourcefn provide(&'a self, req: &mut Demand<'a>)🔬This is a nightly-only experimental API. (error_generic_member_access)Provides type based access to context intended for error reports. Read more -impl From<Error> for Errorfn from(err: Error) -> ErrorConverts to this type from the input type. -sourceimpl From<Error> for Errorsourcefn from(original: Error) -> ErrorConverts to this type from the input type. -impl<T> From<TrySendError<T>> for Error where T: 'static + Send, fn from(err: TrySendError<T>) -> ErrorConverts to this type from the input type. -
pub enum RespError { Internal(String), IO(Error), Resp(String, Option<RespValue>), @@ -21,31 +21,31 @@ a proper option.
pub enum RespValue { +RespValue in actix_redis - Rust☰RespValueVariantsArrayBulkStringErrorIntegerNilSimpleStringMethodsappendpushTrait ImplementationsCloneDebugEqFrom<&'a [u8]>From<&'a String>From<&'a str>From<Arc<str>>From<String>From<Vec<u8, Global>>From<usize>FromRespPartialEq<RespValue>StructuralEqStructuralPartialEqAuto Trait ImplementationsRefUnwindSafeSendSyncUnpinUnwindSafeBlanket ImplementationsAnyBorrow<T>BorrowMut<T>Equivalent<K>From<T>InstrumentInto<U>Same<T>ToOwnedTryFrom<U>TryInto<U>VZip<V>WithSubscriberIn actix_redis?Enum actix_redis::RespValue[−]pub enum RespValue { Nil, Array(Vec<RespValue, Global>), BulkString(Vec<u8, Global>), @@ -23,40 +23,40 @@ arguments, e.g. RPUSH 1.0.0 · sourcefn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more impl Debug for RespValuefn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>Formats the value using the given formatter. Read more impl<'a> From<&'a [u8]> for RespValuefn from(from: &'a [u8]) -> RespValueConverts to this type from the input type. -impl<'a> From<&'a String> for RespValuefn from(from: &'a String) -> RespValueConverts to this type from the input type. -impl<'a> From<&'a str> for RespValuefn from(from: &'a str) -> RespValueConverts to this type from the input type. -impl<'a> From<Arc<str>> for RespValuefn from(from: Arc<str>) -> RespValueConverts to this type from the input type. -impl<'a> From<String> for RespValuefn from(from: String) -> RespValueConverts to this type from the input type. -impl<'a> From<Vec<u8, Global>> for RespValuefn from(from: Vec<u8, Global>) -> RespValueConverts to this type from the input type. -impl<'a> From<usize> for RespValuefn from(from: usize) -> RespValueConverts to this type from the input type. +impl<'a> From<&'a String> for RespValuefn from(from: &'a String) -> RespValueConverts to this type from the input type. +impl<'a> From<&'a str> for RespValuefn from(from: &'a str) -> RespValueConverts to this type from the input type. +impl<'a> From<Arc<str>> for RespValuefn from(from: Arc<str>) -> RespValueConverts to this type from the input type. +impl<'a> From<String> for RespValuefn from(from: String) -> RespValueConverts to this type from the input type. +impl<'a> From<Vec<u8, Global>> for RespValuefn from(from: Vec<u8, Global>) -> RespValueConverts to this type from the input type. +impl<'a> From<usize> for RespValuefn from(from: usize) -> RespValueConverts to this type from the input type. impl FromResp for RespValuefn from_resp_int(resp: RespValue) -> Result<RespValue, Error>fn from_resp(resp: RespValue) -> Result<Self, Error>Return a Result containing either Self or Error. Errors can occur due to either: a) the particular RespValue being incompatible with the required type, or b) a remote Redis error occuring. Read more impl PartialEq<RespValue> for RespValuefn eq(&self, other: &RespValue) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more 1.0.0 · sourcefn ne(&self, other: &Rhs) -> boolThis method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more -impl Eq for RespValueimpl StructuralEq for RespValueimpl StructuralPartialEq for RespValue
pub enum RespValue { Nil, Array(Vec<RespValue, Global>), BulkString(Vec<u8, Global>), @@ -23,40 +23,40 @@ arguments, e.g. RPUSH
Return a Result containing either Self or Error. Errors can occur due to either: a) the particular RespValue being incompatible with the required type, or b) a remote Redis error occuring. Read more
Result
Error
RespValue
This method tests for self and other values to be equal, and is used by ==. Read more
other
==
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
!=
Compare self to key and return true if they are equal.
key
Redis integration for actix.
actix
Macro to create a RESP array, useful for preparing commands to send. Elements can be any type, or a mixture of types, that satisfy Into<RespValue>.
Into<RespValue>
Command for sending data to Redis.
Redis communication actor.
A single RESP value, this owns the data that is read/to-be written to Redis.
macro_rules! resp_array { +resp_array in actix_redis - Rust☰In actix_redis?Macro actix_redis::resp_array[−]macro_rules! resp_array { ($($e:expr),* $(,)?) => { ... }; } Expand descriptionMacro to create a RESP array, useful for preparing commands to send. Elements can be any type, or a mixture @@ -22,4 +22,4 @@ data moved into the corresponding RespValue. If a reference is pro let data = vec!["data", "from", "somewhere", "else"]; let command = resp_array!["RPUSH", "mykey"].append(data); } -
macro_rules! resp_array { ($($e:expr),* $(,)?) => { ... }; }
Macro to create a RESP array, useful for preparing commands to send. Elements can be any type, or a mixture @@ -22,4 +22,4 @@ data moved into the corresponding RespValue. If a reference is pro let data = vec!["data", "from", "somewhere", "else"]; let command = resp_array!["RPUSH", "mykey"].append(data); }
pub struct Command(pub RespValue);
0: RespValue
The type of value that this handler will return. Read more
This method is called for every message received by this actor.
The type of value that this message will resolved with if it is +
The type of value that this message will resolved with if it is successful. Read more
pub struct RedisActor { /* private fields */ }
Start new Supervisor with RedisActor.
Supervisor
RedisActor
Actor execution context type
Called when an actor gets polled the first time.
Called after an actor is in Actor::Stopping state. Read more
Actor::Stopping
Called after an actor is stopped. Read more
Start a new asynchronous actor, returning its address. Read more
Start new actor in arbiter’s thread.
Start a new asynchronous actor given a Context. Read more
Context
Called for every message emitted by the stream.
Called when stream emits first item. Read more
Called when stream finishes. Read more
Register a Stream to the actor context.
Called when the supervisor restarts a failed actor.
Called when the writer emits error. Read more
Called when the writer finishes. Read more
pub enum CookieContentSecurity { Private, @@ -11,30 +11,30 @@ cookie content nor decode it, as long as the encryption key remains confidential
Signed
The cookie content is signed when using CookieContentSecurity::Signed.
CookieContentSecurity::Signed
Signing guarantees integrity, but it doesn’t ensure confidentiality: the client cannot tamper with the cookie content, but they can read it.
#[non_exhaustive] pub enum SessionLifecycle { @@ -14,32 +14,32 @@ Check the documentation of the browsers you are targeting for up-to-date informa
PersistentSession(PersistentSession)
The session cookie will be a persistent cookie.
Persistent cookies have a pre-determined lifetime, specified via the Max-Age or Expires attribute. They do not disappear when the current browser session ends.
Max-Age
Expires
#[non_exhaustive] pub enum TtlExtensionPolicy { @@ -18,30 +18,30 @@ system as storage backend (e.g. Redis). This impacts both the total load on your backend (i.e. number of queries it has to handle) and the latency of the requests served by your server.
OnStateChanges
The TTL is refreshed every time the session state changes or the session key is renewed.
Configuration options to tune the behaviour of SessionMiddleware.
SessionMiddleware
A session lifecycle strategy where the session cookie expires when the @@ -8,4 +8,4 @@ browser’s current session ends.
Determines how to secure the content of the session cookie.
Determines what type of session cookie should be used and how its lifecycle should be managed.
Configuration for which events should trigger an extension of the time-to-live for your session.
pub struct BrowserSession { /* private fields */ }
A session lifecycle strategy where the session cookie expires when the browser’s current session ends.
Due to its Into<SessionLifecycle> implementation, a BrowserSession can be passed directly to SessionMiddlewareBuilder::session_lifecycle().
Into<SessionLifecycle>
BrowserSession
SessionMiddlewareBuilder::session_lifecycle()
Sets a time-to-live (TTL) when storing the session state in the storage backend.
We do not want to store session states indefinitely, otherwise we will inevitably run out of storage by holding on to the state of countless abandoned or expired sessions!
We are dealing with the lifecycle of two uncorrelated object here: the session cookie @@ -24,35 +24,35 @@ tied to the browser session length. You can mitigate the risk of the session cookie outliving the session state by specifying a more aggressive state TTL extension policy - check out BrowserSession::state_ttl_extension_policy for more details.
BrowserSession::state_ttl_extension_policy
Determine under what circumstances the TTL of your session state should be extended.
Defaults to TtlExtensionPolicy::OnStateChanges if left unspecified.
TtlExtensionPolicy::OnStateChanges
See TtlExtensionPolicy for more details.
TtlExtensionPolicy
pub struct PersistentSession { /* private fields */ }
A session lifecycle strategy where the session cookie will be persistent.
Persistent cookies have a pre-determined expiration, specified via the Max-Age or Expires @@ -19,40 +19,40 @@ to PersistentSession::default() // this policy causes the session state's TTL to be refreshed on every request .session_ttl_extension_policy(TtlExtensionPolicy::OnEveryRequest);
Specifies how long the session cookie should live.
The session TTL is also used as the TTL for the session state in the storage backend.
Defaults to 1 day.
A persistent session can live more than the specified TTL if the TTL is extended. See session_ttl_extension_policy for more details.
session_ttl_extension_policy
Determines under what circumstances the TTL of your session should be extended. +
Determines under what circumstances the TTL of your session should be extended. See TtlExtensionPolicy for more details.
Defaults to TtlExtensionPolicy::OnStateChanges.
pub struct SessionMiddlewareBuilder<Store: SessionStore> { /* private fields */ }
A fluent, customized SessionMiddleware builder.
Set the name of the cookie used to store the session ID.
Defaults to id.
id
Set the Secure attribute for the cookie used to store the session ID.
Secure
If the cookie is set as secure, it will only be transmitted when the connection is secure (using https).
https
Default is true.
Determines what type of session cookie should be used and how its lifecycle should be managed. +
Determines what type of session cookie should be used and how its lifecycle should be managed. Check out SessionLifecycle’s documentation for more details on the available options.
SessionLifecycle
Default is SessionLifecycle::BrowserSession.
SessionLifecycle::BrowserSession
Se PersistentSession::default().session_ttl(Duration::seconds(SECS_IN_WEEK)) ) .build();
Set the SameSite attribute for the cookie used to store the session ID.
SameSite
By default, the attribute is set to Lax.
Lax
Set the Path attribute for the cookie used to store the session ID.
Path
By default, the attribute is set to /.
/
Set the Domain attribute for the cookie used to store the session ID.
Domain
Use None to leave the attribute unspecified. If unspecified, the attribute defaults to the same host that set the cookie, excluding subdomains.
None
By default, the attribute is left unspecified.
Choose how the session cookie content should be secured.
CookieContentSecurity::Private
Set the HttpOnly attribute for the cookie used to store the session ID.
HttpOnly
If the cookie is set as HttpOnly, it will not be visible to any JavaScript snippets running in the browser.
Finalise the builder and return a SessionMiddleware instance.
pub enum SessionStatus { Changed, @@ -14,36 +14,36 @@ the client and the session state will be deleted from the session store. The session key will be regenerated and the time-to-live of the session state will be extended.
The session key will be regenerated and the time-to-live of the session state will be extended.
Unchanged
The session state has not been modified since its creation/retrieval.
This method tests for self and other values to be equal, and is used +
Session management for Actix Web.
The HTTP protocol, at a first glance, is stateless: the client sends a request, the server @@ -109,4 +109,4 @@ actix-session = { version = "...", features = ["redis-rs-session&
Status of a Session.
Session
Extract a Session object from various actix-web types (e.g. HttpRequest, ServiceRequest, ServiceResponse).
HttpRequest
ServiceRequest
ServiceResponse
pub enum LoadError { Deserialization(Error), @@ -6,33 +6,33 @@ }
Possible failures modes for SessionStore::load.
SessionStore::load
Deserialization(Error)
Failed to deserialize session state.
Other(Error)
Something went wrong when retrieving the session state.
pub enum SaveError { Serialization(Error), @@ -6,33 +6,33 @@ }
Possible failures modes for SessionStore::save.
SessionStore::save
Serialization(Error)
Failed to serialize session state.
Something went wrong when persisting the session state.
pub enum UpdateError { Serialization(Error), @@ -6,33 +6,33 @@ }
Possible failures modes for SessionStore::update.
SessionStore::update
Something went wrong when updating the session state.
Pluggable storage backends for session state.
Use the session key, stored in the session cookie, as storage backend for the session state.
The interface to retrieve and save the current session data from/to the chosen storage backend.
#[non_exhaustive]pub struct CookieSessionStore;
Loads the session state associated to a session key.
Persist the session state for a newly created session. Read more
Updates the session state associated to a pre-existing session key.
Updates the TTL of the session state associated to a pre-existing session key.
Deletes a session from the store.
pub struct RedisActorSessionStore { /* private fields */ }
Use Redis as session storage backend.
RedisActorSessionStore does not currently support establishing authenticated connections to Redis. Use RedisSessionStore if you need TLS support.
RedisActorSessionStore
RedisSessionStore
A fluent API to configure RedisActorSessionStore.
It takes as input the only required input to create a new instance of RedisActorSessionStore—a connection string for Redis.
Create a new instance of RedisActorSessionStore using the default configuration. +
Create a new instance of RedisActorSessionStore using the default configuration. It takes as input the only required input to create a new instance of RedisActorSessionStore - a connection string for Redis.
pub struct RedisActorSessionStoreBuilder { /* private fields */ }
A fluent builder to construct a RedisActorSessionStore instance with custom configuration parameters.
Set a custom cache key generation strategy, expecting a session key as input.
Finalise the builder and return a RedisActorSessionStore instance.
pub struct RedisSessionStore { /* private fields */ }
rediss://
RedisSessionStore leverages redis-rs as Redis client.
A fluent API to configure RedisSessionStore. +
A fluent API to configure RedisSessionStore. It takes as input the only required input to create a new instance of RedisSessionStore - a connection string for Redis.
Create a new instance of RedisSessionStore using the default configuration. +
Create a new instance of RedisSessionStore using the default configuration. It takes as input the only required input to create a new instance of RedisSessionStore - a connection string for Redis.
pub struct RedisSessionStoreBuilder { /* private fields */ }
A fluent builder to construct a RedisSessionStore instance with custom configuration parameters.
pub struct SessionKey(_);
A session key, the string stored in a client-side cookie to associate a user with its session state on the backend.
Converts this type into a shared reference of the (usually inferred) input type.
pub trait SessionStore { fn load<'life0, 'life1, 'async_trait>( &'life0 self, session_key: &'life1 SessionKey ) -> Pin<Box<dyn Future<Output = Result<Option<HashMap<String, String>>, LoadError>> + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; @@ -11,10 +11,10 @@ async-trait is used for this trait’s definition. Therefore, it is required for implementations, too. In particular, we use the send-optional variant: #[async_trait(?Send)]. -
async-trait is used for this trait’s definition. Therefore, it is required for implementations, too. In particular, we use the send-optional variant: #[async_trait(?Send)].
async-trait
#[async_trait(?Send)]
Persist the session state for a newly created session.
Returns the corresponding session key.
pub struct Session(_);
The primary interface to access and modify session state.
Session is an extractor—you can specify it as an input type for your @@ -18,26 +18,26 @@ request handlers and it will be automatically extracted from the incoming reques }
You can also retrieve a Session object from an HttpRequest or a ServiceRequest using SessionExt.
SessionExt
Get a value from the session.
value
It returns an error if it fails to deserialize as T the JSON value associated with key.
T
Get all raw key-value data from the session.
Note that values are JSON encoded.
Returns session status.
Inserts a key-value pair into the session.
Any serializable value can be used and will be encoded as JSON in session data, hence why only a reference to the value is taken.
It returns an error if it fails to serialize value to JSON.
Remove value from the session.
If present, the JSON encoded value is returned.
Remove value from the session and deserialize.
Returns None if key was not present in session. Returns T if deserialization succeeds, otherwise returns un-deserialized JSON string.
Clear the session.
Removes session both client and server side.
Renews the session key, assigning existing session state to new key.
Extractor implementation for Sessions.
use actix_session::Session; @@ -55,29 +55,29 @@ otherwise returns un-deserialized JSON string. }
pub struct SessionGetError(_);
Error returned by Session::get.
Session::get
pub struct SessionInsertError(_);
Error returned by Session::insert.
Session::insert
pub struct SessionMiddleware<Store: SessionStore> { /* private fields */ }
A middleware for session management in Actix Web applications.
SessionMiddleware takes care of a few jobs:
Use SessionMiddleware::new to initialize the session framework using the default +
SessionMiddleware::new
Use SessionMiddleware::new to initialize the session framework using the default parameters.
To create a new instance of SessionMiddleware you need to provide:
SessionStore
A fluent API to configure SessionMiddleware.
It takes as input the two required inputs to create a new instance of SessionMiddleware:
pub trait SessionExt { fn get_session(&self) -> Session; }
Extract a Session object.
pub enum Backlog { Default, @@ -11,39 +11,39 @@ under significant load. “default”, or an integer N > 0 e.g. “6”.
Default
The default number of connections. See struct docs.
Manual(usize)
A specific number of connections.
Deserialize this value from the given Serde deserializer. Read more
Feeds this value into the given Hasher. Read more
Hasher
Feeds a slice of this type into the given Hasher. Read more
Parse Self from string.
string
pub enum Error { EnvVarError(VarError), @@ -24,37 +24,37 @@
ParseIntError(ParseIntError)
Value is not an integer.
ParseAddressError(String)
Value is not an address.
TomlError(TomlError)
Error deserializing as TOML.
pub enum KeepAlive { Default, @@ -13,39 +13,39 @@
Os
Let the OS determine keep-alive duration.
Note: this is usually quite long.
Seconds(usize)
A specific keep-alive duration (in seconds).
pub enum MaxConnectionRate { Default, @@ -9,39 +9,39 @@ limit the global TLS CPU usage. By default max connections is set to a 256. Take value: Either “default”, or an integer N > 0 e.g. “6”.
The default connection limit. See struct docs.
A specific connection limit.
pub enum MaxConnections { Default, @@ -9,39 +9,39 @@ By default max connections is set to a 25k. Takes a string value: Either “defa integer N > 0 e.g. “6”.
pub enum Mode { Development, @@ -6,39 +6,39 @@ }
Marker of intended deployment environment.
Development
Marks development environment.
Production
Marks production environment.
pub enum NumWorkers { Default, @@ -8,39 +8,39 @@ “default”, or an integer N > 0 e.g. “6”.
The default number of workers. See struct docs.
A specific number of workers.
pub enum Timeout { Default, @@ -8,39 +8,39 @@
The default timeout. Depends on context.
Milliseconds(usize)
Timeout in milliseconds.
Timeout in seconds.
Easily manage Actix Web’s settings from a TOML file and environment variables.
To get started add a Settings::parse_toml("./Server.toml") call to the @@ -66,4 +66,4 @@ the environment using Traits
Settings::parse_toml("./Server.toml")
Extension trait for applying parsed settings to the server object.
A specialized FromStr trait that returns [AtError] errors
FromStr
AtError
Convenience type alias for BasicSettings with no defined application-specific settings.
BasicSettings
pub struct ActixSettings {Show 13 fields pub hosts: Vec<Address>, @@ -28,38 +28,38 @@
client_shutdown: Timeout
Timeout duration for connection shutdown.
shutdown_timeout: Timeout
Timeout duration for graceful worker shutdown.
tls: Tls
TLS (HTTPS) configuration.
pub struct Address { pub host: String, @@ -6,39 +6,39 @@ }
A host/port pair for the server to bind to.
host: String
Host part of address.
port: u16
Port part of address.
pub struct BasicSettings<A> { pub actix: ActixSettings, @@ -6,16 +6,16 @@ }
Wrapper for server and application-specific settings.
actix: ActixSettings
Actix Web server settings.
application: A
Application-specific settings.
Parse an instance of Self from a TOML file located at filepath.
filepath
If the file doesn’t exist, it is generated from the default TOML template, after which the newly generated file is read in and parsed.
Parse an instance of Self straight from the default TOML template.
Writes the default TOML template to a new file, located at filepath.
Returns a FileExists error if a file already exists at that location.
FileExists
Attempts to parse value and override the referenced field.
field
use actix_settings::{Settings, Mode}; @@ -24,7 +24,7 @@ location. Settings::override_field(&mut settings.actix.mode, "production")?; assert_eq!(settings.actix.mode, Mode::Production);
Attempts to read an environment variable, parse it, and override the referenced field.
use actix_settings::{Settings, Mode}; @@ -35,38 +35,38 @@ std::env::set_var("OVERRIDE__MODE", &mut settings.actix.mode, "OVERRIDE__MODE")?; assert_eq!(settings.actix.mode, Mode::Production);
#[non_exhaustive]pub struct NoSettings {}
Marker type representing no defined application-specific settings.
pub struct Tls { pub enabled: bool, @@ -8,38 +8,38 @@
enabled: bool
Tru if accepting TLS connections should be enabled.
certificate: PathBuf
Path to certificate .pem file.
.pem
private_key: PathBuf
Path to private key .pem file.
pub trait ApplySettings { fn apply_settings<A>(self, settings: &BasicSettings<A>) -> Self where A: DeserializeOwned; }
Apply a BasicSettings value to self.
pub trait Parse: Sized { fn parse(string: &str) -> Result<Self, Error>; }
pub type Settings = BasicSettings<NoSettings>;
Extractor for the “Basic” HTTP Authentication Scheme.
Extractor for HTTP Basic auth.
BasicAuth extractor configuration used for WWW-Authenticate header later.
BasicAuth
WWW-Authenticate
pub struct BasicAuth(_);
use actix_web_httpauth::extractors::basic::BasicAuth; @@ -18,36 +18,36 @@ order to properly form the WWW-Authenticate response header. App::new() .app_data(basic::Config::default().realm("Restricted area")) .service(web::resource("/index.html").route(web::get().to(index)));
Returns client’s user-ID.
Returns client’s password.
pub struct Config(_);
Set challenge realm attribute.
realm
The “realm” attribute indicates the scope of protection in the manner described in HTTP/1.1 RFC 2617 §1.2.
Associated challenge type.
Convert the config instance into a HTTP challenge.
pub enum Error { +Error in actix_web_httpauth::extractors::bearer - Rust☰ErrorVariantsInsufficientScopeInvalidRequestInvalidTokenMethodsstatus_codeTrait ImplementationsCloneCopyDebugDisplayEqHashOrdPartialEq<Error>PartialOrd<Error>StructuralEqStructuralPartialEqAuto Trait ImplementationsRefUnwindSafeSendSyncUnpinUnwindSafeBlanket ImplementationsAnyBorrow<T>BorrowMut<T>CallHasherEquivalent<K>From<T>InstrumentInto<U>Same<T>ToOwnedToStringTryFrom<U>TryInto<U>VZip<V>WithSubscriberIn actix_web_httpauth::extractors::bearer?Enum actix_web_httpauth::extractors::bearer::Errorsource · [−]pub enum Error { InvalidRequest, InvalidToken, InsufficientScope, @@ -8,51 +8,51 @@ value, repeats the same parameter, uses more than one method for including an ac or is otherwise malformed. InvalidTokenThe access token provided is expired, revoked, malformed, or invalid for other reasons. InsufficientScopeThe request requires higher privileges than provided by the access token. -Implementationssourceimpl Errorsourcepub fn status_code(&self) -> StatusCodeReturns HTTP status code suitable for current error type. -Trait Implementationssourceimpl Clone for Errorsourcefn clone(&self) -> ErrorReturns a copy of the value. Read more +Implementationssourceimpl Errorsourcepub fn status_code(&self) -> StatusCodeReturns HTTP status code suitable for current error type. +Trait Implementationssourceimpl Clone for Errorsourcefn clone(&self) -> ErrorReturns a copy of the value. Read more 1.0.0 · sourcefn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more -sourceimpl Debug for Errorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more -sourceimpl Display for Errorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more -sourceimpl Hash for Errorsourcefn hash<__H: Hasher>(&self, state: &mut __H)Feeds this value into the given Hasher. Read more +sourceimpl Debug for Errorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more +sourceimpl Display for Errorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more +sourceimpl Hash for Errorsourcefn hash<__H: Hasher>(&self, state: &mut __H)Feeds this value into the given Hasher. Read more 1.3.0 · sourcefn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher, Feeds a slice of this type into the given Hasher. Read more -sourceimpl Ord for Errorsourcefn cmp(&self, other: &Error) -> OrderingThis method returns an Ordering between self and other. Read more +sourceimpl Ord for Errorsourcefn cmp(&self, other: &Error) -> OrderingThis method returns an Ordering between self and other. Read more 1.21.0 · sourcefn max(self, other: Self) -> SelfCompares and returns the maximum of two values. Read more 1.21.0 · sourcefn min(self, other: Self) -> SelfCompares and returns the minimum of two values. Read more 1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where Self: PartialOrd<Self>, Restrict a value to a certain interval. Read more -sourceimpl PartialEq<Error> for Errorsourcefn eq(&self, other: &Error) -> boolThis method tests for self and other values to be equal, and is used +sourceimpl PartialEq<Error> for Errorsourcefn eq(&self, other: &Error) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more 1.0.0 · sourcefn ne(&self, other: &Rhs) -> boolThis method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more -sourceimpl PartialOrd<Error> for Errorsourcefn partial_cmp(&self, other: &Error) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more +sourceimpl PartialOrd<Error> for Errorsourcefn partial_cmp(&self, other: &Error) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more 1.0.0 · sourcefn lt(&self, other: &Rhs) -> boolThis method tests less than (for self and other) and is used by the < operator. Read more 1.0.0 · sourcefn le(&self, other: &Rhs) -> boolThis method tests less than or equal to (for self and other) and is used by the <= operator. Read more 1.0.0 · sourcefn gt(&self, other: &Rhs) -> boolThis method tests greater than (for self and other) and is used by the > operator. Read more 1.0.0 · sourcefn ge(&self, other: &Rhs) -> boolThis method tests greater than or equal to (for self and other) and is used by the >= operator. Read more -sourceimpl Copy for Errorsourceimpl Eq for Errorsourceimpl StructuralEq for Errorsourceimpl StructuralPartialEq for ErrorAuto Trait Implementationsimpl RefUnwindSafe for Errorimpl Send for Errorimpl Sync for Errorimpl Unpin for Errorimpl UnwindSafe for ErrorBlanket Implementationssourceimpl<T> Any for T where T: 'static + ?Sized, sourcefn type_id(&self) -> TypeIdGets the TypeId of self. Read more -sourceimpl<T> Borrow<T> for T where T: ?Sized, const: unstable · sourcefn borrow(&self) -> &TImmutably borrows from an owned value. Read more -sourceimpl<T> BorrowMut<T> for T where T: ?Sized, const: unstable · sourcefn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more -impl<T> CallHasher for T where T: Hash + ?Sized, default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64 where H: Hash + ?Sized, B: BuildHasher, sourceimpl<Q, K> Equivalent<K> for Q where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized, sourcefn equivalent(&self, key: &K) -> boolCompare self to key and return true if they are equal. -sourceimpl<T> From<T> for Tconst: unstable · sourcefn from(t: T) -> TReturns the argument unchanged. -sourceimpl<T> Instrument for Tsourcefn instrument(self, span: Span) -> Instrumented<Self>Instruments this type with the provided Span, returning an +sourceimpl Copy for Errorsourceimpl Eq for Errorsourceimpl StructuralEq for Errorsourceimpl StructuralPartialEq for ErrorAuto Trait Implementationsimpl RefUnwindSafe for Errorimpl Send for Errorimpl Sync for Errorimpl Unpin for Errorimpl UnwindSafe for ErrorBlanket Implementationssourceimpl<T> Any for T where T: 'static + ?Sized, sourcefn type_id(&self) -> TypeIdGets the TypeId of self. Read more +sourceimpl<T> Borrow<T> for T where T: ?Sized, const: unstable · sourcefn borrow(&self) -> &TImmutably borrows from an owned value. Read more +sourceimpl<T> BorrowMut<T> for T where T: ?Sized, const: unstable · sourcefn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more +impl<T> CallHasher for T where T: Hash + ?Sized, default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64 where H: Hash + ?Sized, B: BuildHasher, sourceimpl<Q, K> Equivalent<K> for Q where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized, sourcefn equivalent(&self, key: &K) -> boolCompare self to key and return true if they are equal. +sourceimpl<T> From<T> for Tconst: unstable · sourcefn from(t: T) -> TReturns the argument unchanged. +sourceimpl<T> Instrument for Tsourcefn instrument(self, span: Span) -> Instrumented<Self>Instruments this type with the provided Span, returning an Instrumented wrapper. Read more -sourcefn in_current_span(self) -> Instrumented<Self>Instruments this type with the current Span, returning an +sourcefn in_current_span(self) -> Instrumented<Self>Instruments this type with the current Span, returning an Instrumented wrapper. Read more -sourceimpl<T, U> Into<U> for T where U: From<T>, const: unstable · sourcefn into(self) -> UCalls U::from(self). +sourceimpl<T, U> Into<U> for T where U: From<T>, const: unstable · sourcefn into(self) -> UCalls U::from(self). That is, this conversion is whatever the implementation of From<T> for U chooses to do. -sourceimpl<T> Same<T> for Ttype Output = TShould always be Self -sourceimpl<T> ToOwned for T where T: Clone, type Owned = TThe resulting type after obtaining ownership. -sourcefn to_owned(&self) -> TCreates owned data from borrowed data, usually by cloning. Read more -sourcefn clone_into(&self, target: &mut T)Uses borrowed data to replace owned data, usually by cloning. Read more -sourceimpl<T> ToString for T where T: Display + ?Sized, sourcedefault fn to_string(&self) -> StringConverts the given value to a String. Read more -sourceimpl<T, U> TryFrom<U> for T where U: Into<T>, type Error = InfallibleThe type returned in the event of a conversion error. +sourceimpl<T> Same<T> for Ttype Output = TShould always be Self +sourceimpl<T> ToOwned for T where T: Clone, type Owned = TThe resulting type after obtaining ownership. +sourcefn to_owned(&self) -> TCreates owned data from borrowed data, usually by cloning. Read more +sourcefn clone_into(&self, target: &mut T)Uses borrowed data to replace owned data, usually by cloning. Read more +sourceimpl<T> ToString for T where T: Display + ?Sized, sourcedefault fn to_string(&self) -> StringConverts the given value to a String. Read more +sourceimpl<T, U> TryFrom<U> for T where U: Into<T>, type Error = InfallibleThe type returned in the event of a conversion error. const: unstable · sourcefn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>Performs the conversion. -sourceimpl<T, U> TryInto<U> for T where U: TryFrom<T>, type Error = <U as TryFrom<T>>::ErrorThe type returned in the event of a conversion error. +sourceimpl<T, U> TryInto<U> for T where U: TryFrom<T>, type Error = <U as TryFrom<T>>::ErrorThe type returned in the event of a conversion error. const: unstable · sourcefn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>Performs the conversion. -impl<V, T> VZip<V> for T where V: MultiLane<T>, fn vzip(self) -> Vsourceimpl<T> WithSubscriber for Tsourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>, Attaches the provided Subscriber to this type, returning a +impl<V, T> VZip<V> for T where V: MultiLane<T>, fn vzip(self) -> Vsourceimpl<T> WithSubscriber for Tsourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>, Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more -sourcefn with_current_subscriber(self) -> WithDispatch<Self>Attaches the current default Subscriber to this type, returning a +sourcefn with_current_subscriber(self) -> WithDispatch<Self>Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more - \ No newline at end of file +
pub enum Error { InvalidRequest, InvalidToken, InsufficientScope, @@ -8,51 +8,51 @@ value, repeats the same parameter, uses more than one method for including an ac or is otherwise malformed.
InvalidToken
The access token provided is expired, revoked, malformed, or invalid for other reasons.
InsufficientScope
The request requires higher privileges than provided by the access token.
Returns HTTP status code suitable for current error type.
This method returns an Ordering between self and other. Read more
Ordering
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
<
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
<=
This method tests greater than (for self and other) and is used by the > operator. Read more
>
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
>=
Extractor for the “Bearer” HTTP Authentication Scheme.
Extractor for HTTP Bearer auth
BearerAuth extractor configuration.
BearerAuth
Bearer authorization error types, described in RFC 6750.
pub struct BearerAuth(_);
use actix_web_httpauth::extractors::bearer::BearerAuth; @@ -23,35 +23,35 @@ App::new() .scope("email photo"), ) .service(web::resource("/index.html").route(web::get().to(index)));
Returns bearer token provided by client.
Set challenge scope attribute.
scope
The "scope" attribute is a space-delimited list of case-sensitive scope values indicating the required scope of the access token for accessing the requested resource.
"scope"
The “realm” attribute indicates the scope of protection in the manner described in HTTP/1.1 RFC 2617.
Type-safe authentication information extractors.
Authentication error returned by authentication extractors.
Trait implemented for types that provides configuration for the authentication extractors.
pub struct AuthenticationError<C: Challenge> { /* private fields */ }
Different extractors may extend AuthenticationError implementation in order to provide access inner challenge fields.
AuthenticationError
Extended error customization for HTTP Bearer auth.
Bearer
Attach Error to the current Authentication error.
Error status code will be changed to the one provided by the kind Error.
kind
Attach error description to the current Authentication error.
Attach error URI to the current Authentication error.
It is up to implementor to provide properly formed absolute URI.
Creates new authentication error from the provided challenge.
challenge
By default returned error will resolve into the HTTP 401 status code.
HTTP 401
Returns mutable reference to the inner challenge instance.
Returns mutable reference to the inner status code.
Can be used to override returned status code, but by default this lib tries to stick to the RFC, so it might be unreasonable.
pub trait AuthExtractorConfig { +AuthExtractorConfig in actix_web_httpauth::extractors - Rust☰AuthExtractorConfigRequired Associated TypesInnerRequired Methodsinto_innerImplementorsIn actix_web_httpauth::extractors?Trait actix_web_httpauth::extractors::AuthExtractorConfigsource · [−]pub trait AuthExtractorConfig { type Inner: Challenge; fn into_inner(self) -> Self::Inner; }Expand descriptionTrait implemented for types that provides configuration for the authentication extractors. -Required Associated Typessourcetype Inner: ChallengeAssociated challenge type. -Required Methodssourcefn into_inner(self) -> Self::InnerConvert the config instance into a HTTP challenge. -Implementorssourceimpl AuthExtractorConfig for actix_web_httpauth::extractors::basic::Configtype Inner = Basicsourceimpl AuthExtractorConfig for actix_web_httpauth::extractors::bearer::Configtype Inner = Bearer \ No newline at end of file +
pub trait AuthExtractorConfig { type Inner: Challenge; fn into_inner(self) -> Self::Inner; }
pub enum ParseError { +ParseError in actix_web_httpauth::headers::authorization - Rust☰ParseErrorVariantsBase64DecodeErrorInvalidMissingFieldMissingSchemeToStrErrorUtf8ErrorTrait ImplementationsDebugDisplayErrorFrom<DecodeError>From<ToStrError>From<Utf8Error>Auto Trait ImplementationsRefUnwindSafeSendSyncUnpinUnwindSafeBlanket ImplementationsAnyBorrow<T>BorrowMut<T>From<T>InstrumentInto<U>ProviderSame<T>ToStringTryFrom<U>TryInto<U>VZip<V>WithSubscriberIn actix_web_httpauth::headers::authorization?Enum actix_web_httpauth::headers::authorization::ParseErrorsource · [−]pub enum ParseError { Invalid, MissingScheme, MissingField(&'static str), @@ -14,36 +14,36 @@ ToStrError(ToStrError)Unable to convert header into the str. Base64DecodeError(DecodeError)Malformed base64 string. Utf8Error(Utf8Error)Malformed UTF-8 string. -Trait Implementationssourceimpl Debug for ParseErrorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more -sourceimpl Display for ParseErrorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more -sourceimpl Error for ParseErrorsourcefn source(&self) -> Option<&(dyn Error + 'static)>The lower-level source of this error, if any. Read more +Trait Implementationssourceimpl Debug for ParseErrorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more +sourceimpl Display for ParseErrorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more +sourceimpl Error for ParseErrorsourcefn source(&self) -> Option<&(dyn Error + 'static)>The lower-level source of this error, if any. Read more 1.0.0 · sourcefn description(&self) -> &str👎Deprecated since 1.42.0: use the Display impl or to_string() Read more1.0.0 · sourcefn cause(&self) -> Option<&dyn Error>👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting -sourcefn provide(&'a self, req: &mut Demand<'a>)🔬This is a nightly-only experimental API. (error_generic_member_access)Provides type based access to context intended for error reports. Read more -sourceimpl From<DecodeError> for ParseErrorsourcefn from(err: DecodeError) -> SelfConverts to this type from the input type. -sourceimpl From<ToStrError> for ParseErrorsourcefn from(err: ToStrError) -> SelfConverts to this type from the input type. -sourceimpl From<Utf8Error> for ParseErrorsourcefn from(err: Utf8Error) -> SelfConverts to this type from the input type. -Auto Trait Implementationsimpl RefUnwindSafe for ParseErrorimpl Send for ParseErrorimpl Sync for ParseErrorimpl Unpin for ParseErrorimpl UnwindSafe for ParseErrorBlanket Implementationssourceimpl<T> Any for T where T: 'static + ?Sized, sourcefn type_id(&self) -> TypeIdGets the TypeId of self. Read more -sourceimpl<T> Borrow<T> for T where T: ?Sized, const: unstable · sourcefn borrow(&self) -> &TImmutably borrows from an owned value. Read more -sourceimpl<T> BorrowMut<T> for T where T: ?Sized, const: unstable · sourcefn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more -sourceimpl<T> From<T> for Tconst: unstable · sourcefn from(t: T) -> TReturns the argument unchanged. -sourceimpl<T> Instrument for Tsourcefn instrument(self, span: Span) -> Instrumented<Self>Instruments this type with the provided Span, returning an +sourcefn provide(&'a self, req: &mut Demand<'a>)🔬This is a nightly-only experimental API. (error_generic_member_access)Provides type based access to context intended for error reports. Read more +sourceimpl From<DecodeError> for ParseErrorsourcefn from(err: DecodeError) -> SelfConverts to this type from the input type. +sourceimpl From<ToStrError> for ParseErrorsourcefn from(err: ToStrError) -> SelfConverts to this type from the input type. +sourceimpl From<Utf8Error> for ParseErrorsourcefn from(err: Utf8Error) -> SelfConverts to this type from the input type. +Auto Trait Implementationsimpl RefUnwindSafe for ParseErrorimpl Send for ParseErrorimpl Sync for ParseErrorimpl Unpin for ParseErrorimpl UnwindSafe for ParseErrorBlanket Implementationssourceimpl<T> Any for T where T: 'static + ?Sized, sourcefn type_id(&self) -> TypeIdGets the TypeId of self. Read more +sourceimpl<T> Borrow<T> for T where T: ?Sized, const: unstable · sourcefn borrow(&self) -> &TImmutably borrows from an owned value. Read more +sourceimpl<T> BorrowMut<T> for T where T: ?Sized, const: unstable · sourcefn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more +sourceimpl<T> From<T> for Tconst: unstable · sourcefn from(t: T) -> TReturns the argument unchanged. +sourceimpl<T> Instrument for Tsourcefn instrument(self, span: Span) -> Instrumented<Self>Instruments this type with the provided Span, returning an Instrumented wrapper. Read more -sourcefn in_current_span(self) -> Instrumented<Self>Instruments this type with the current Span, returning an +sourcefn in_current_span(self) -> Instrumented<Self>Instruments this type with the current Span, returning an Instrumented wrapper. Read more -sourceimpl<T, U> Into<U> for T where U: From<T>, const: unstable · sourcefn into(self) -> UCalls U::from(self). +sourceimpl<T, U> Into<U> for T where U: From<T>, const: unstable · sourcefn into(self) -> UCalls U::from(self). That is, this conversion is whatever the implementation of From<T> for U chooses to do. -sourceimpl<E> Provider for E where E: Error + ?Sized, sourcefn provide(&'a self, req: &mut Demand<'a>)🔬This is a nightly-only experimental API. (provide_any)Data providers should implement this method to provide all values they are able to +sourceimpl<E> Provider for E where E: Error + ?Sized, sourcefn provide(&'a self, req: &mut Demand<'a>)🔬This is a nightly-only experimental API. (provide_any)Data providers should implement this method to provide all values they are able to provide by using demand. Read more -sourceimpl<T> Same<T> for Ttype Output = TShould always be Self -sourceimpl<T> ToString for T where T: Display + ?Sized, sourcedefault fn to_string(&self) -> StringConverts the given value to a String. Read more -sourceimpl<T, U> TryFrom<U> for T where U: Into<T>, type Error = InfallibleThe type returned in the event of a conversion error. +sourceimpl<T> Same<T> for Ttype Output = TShould always be Self +sourceimpl<T> ToString for T where T: Display + ?Sized, sourcedefault fn to_string(&self) -> StringConverts the given value to a String. Read more +sourceimpl<T, U> TryFrom<U> for T where U: Into<T>, type Error = InfallibleThe type returned in the event of a conversion error. const: unstable · sourcefn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>Performs the conversion. -sourceimpl<T, U> TryInto<U> for T where U: TryFrom<T>, type Error = <U as TryFrom<T>>::ErrorThe type returned in the event of a conversion error. +sourceimpl<T, U> TryInto<U> for T where U: TryFrom<T>, type Error = <U as TryFrom<T>>::ErrorThe type returned in the event of a conversion error. const: unstable · sourcefn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>Performs the conversion. -impl<V, T> VZip<V> for T where V: MultiLane<T>, fn vzip(self) -> Vsourceimpl<T> WithSubscriber for Tsourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>, Attaches the provided Subscriber to this type, returning a +impl<V, T> VZip<V> for T where V: MultiLane<T>, fn vzip(self) -> Vsourceimpl<T> WithSubscriber for Tsourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>, Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more -sourcefn with_current_subscriber(self) -> WithDispatch<Self>Attaches the current default Subscriber to this type, returning a +sourcefn with_current_subscriber(self) -> WithDispatch<Self>Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more - \ No newline at end of file +
pub enum ParseError { Invalid, MissingScheme, MissingField(&'static str), @@ -14,36 +14,36 @@
ToStrError(ToStrError)
Unable to convert header into the str.
Base64DecodeError(DecodeError)
Malformed base64 string.
Utf8Error(Utf8Error)
Malformed UTF-8 string.
Authorization header and various auth schemes.
Authorization
Authorization header, defined in RFC 7235
Credentials for Basic authentication scheme, defined in RFC 7617
Basic
Credentials for Bearer authentication scheme, defined in RFC 6750.
Possible errors while parsing Authorization header.
Authentication scheme for Authorization header.
pub struct Authorization<S: Scheme>(_);
The “Authorization” header field allows a user agent to authenticate itself with an origin server—usually, but not necessarily, after receiving a 401 (Unauthorized) response. Its value consists of credentials containing the authentication information of the user agent for the @@ -10,60 +10,60 @@ realm of the resource being requested.
Consumes Authorization header and returns inner Scheme implementation.
Scheme
Converts this type into a mutable reference of the (usually inferred) input type.
Returns the name of the header field.
Parse the header from a HTTP message.
Try to convert value to a HeaderValue.
pub struct Basic { /* private fields */ }
Creates Basic credentials with provided user_id and optional +
user_id
Creates Basic credentials with provided user_id and optional password.
password
let credentials = Basic::new("Alladin", Some("open sesame"));
Returns client’s password if provided.
Try to parse an authentication scheme from the Authorization header.
pub struct Bearer { /* private fields */ }
Should be used in combination with Authorization header.
Creates new Bearer credentials with the token provided.
let credentials = Bearer::new("mF_9.B5f-4.1JqM");
Gets reference to the credentials token.
pub trait Scheme: TryIntoHeaderValue + Debug + Display + Clone + Send + Sync { +Scheme in actix_web_httpauth::headers::authorization - Rust☰SchemeRequired MethodsparseImplementorsIn actix_web_httpauth::headers::authorization?Trait actix_web_httpauth::headers::authorization::Schemesource · [−]pub trait Scheme: TryIntoHeaderValue + Debug + Display + Clone + Send + Sync { fn parse(header: &HeaderValue) -> Result<Self, ParseError>; }Expand descriptionAuthentication scheme for Authorization header. -Required Methodssourcefn parse(header: &HeaderValue) -> Result<Self, ParseError>Try to parse an authentication scheme from the Authorization header. -Implementorssourceimpl Scheme for Basicsourceimpl Scheme for Bearer \ No newline at end of file +
pub trait Scheme: TryIntoHeaderValue + Debug + Display + Clone + Send + Sync { fn parse(header: &HeaderValue) -> Result<Self, ParseError>; }
Typed HTTP headers.
WWW-Authenticate header and various auth challenges.
Challenge for the “Basic” HTTP Authentication Scheme.
Challenge for WWW-Authenticate header with HTTP Basic auth scheme, described in RFC 7617
Challenge for WWW-Authenticate header with HTTP Basic auth scheme, +
use actix_web_httpauth::headers::www_authenticate::basic::Basic; @@ -11,63 +11,63 @@ described in RFC 7617 .insert_header(WwwAuthenticate(challenge)) .finish() }
Creates new Basic challenge with an empty realm field.
let challenge = Basic::new();
Creates new Basic challenge from the provided realm field value.
let challenge = Basic::with_realm("Restricted area");
let my_realm = "Earth realm".to_string(); let challenge = Basic::with_realm(my_realm);
pub enum Error { +Error in actix_web_httpauth::headers::www_authenticate::bearer - Rust☰ErrorVariantsInsufficientScopeInvalidRequestInvalidTokenMethodsstatus_codeTrait ImplementationsCloneCopyDebugDisplayEqHashOrdPartialEq<Error>PartialOrd<Error>StructuralEqStructuralPartialEqAuto Trait ImplementationsRefUnwindSafeSendSyncUnpinUnwindSafeBlanket ImplementationsAnyBorrow<T>BorrowMut<T>CallHasherEquivalent<K>From<T>InstrumentInto<U>Same<T>ToOwnedToStringTryFrom<U>TryInto<U>VZip<V>WithSubscriberIn actix_web_httpauth::headers::www_authenticate::bearer?Enum actix_web_httpauth::headers::www_authenticate::bearer::Errorsource · [−]pub enum Error { InvalidRequest, InvalidToken, InsufficientScope, @@ -8,51 +8,51 @@ value, repeats the same parameter, uses more than one method for including an ac or is otherwise malformed. InvalidTokenThe access token provided is expired, revoked, malformed, or invalid for other reasons. InsufficientScopeThe request requires higher privileges than provided by the access token. -Implementationssourceimpl Errorsourcepub fn status_code(&self) -> StatusCodeReturns HTTP status code suitable for current error type. -Trait Implementationssourceimpl Clone for Errorsourcefn clone(&self) -> ErrorReturns a copy of the value. Read more +Implementationssourceimpl Errorsourcepub fn status_code(&self) -> StatusCodeReturns HTTP status code suitable for current error type. +Trait Implementationssourceimpl Clone for Errorsourcefn clone(&self) -> ErrorReturns a copy of the value. Read more 1.0.0 · sourcefn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more -sourceimpl Debug for Errorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more -sourceimpl Display for Errorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more -sourceimpl Hash for Errorsourcefn hash<__H: Hasher>(&self, state: &mut __H)Feeds this value into the given Hasher. Read more +sourceimpl Debug for Errorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more +sourceimpl Display for Errorsourcefn fmt(&self, f: &mut Formatter<'_>) -> ResultFormats the value using the given formatter. Read more +sourceimpl Hash for Errorsourcefn hash<__H: Hasher>(&self, state: &mut __H)Feeds this value into the given Hasher. Read more 1.3.0 · sourcefn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher, Feeds a slice of this type into the given Hasher. Read more -sourceimpl Ord for Errorsourcefn cmp(&self, other: &Error) -> OrderingThis method returns an Ordering between self and other. Read more +sourceimpl Ord for Errorsourcefn cmp(&self, other: &Error) -> OrderingThis method returns an Ordering between self and other. Read more 1.21.0 · sourcefn max(self, other: Self) -> SelfCompares and returns the maximum of two values. Read more 1.21.0 · sourcefn min(self, other: Self) -> SelfCompares and returns the minimum of two values. Read more 1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where Self: PartialOrd<Self>, Restrict a value to a certain interval. Read more -sourceimpl PartialEq<Error> for Errorsourcefn eq(&self, other: &Error) -> boolThis method tests for self and other values to be equal, and is used +sourceimpl PartialEq<Error> for Errorsourcefn eq(&self, other: &Error) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more 1.0.0 · sourcefn ne(&self, other: &Rhs) -> boolThis method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more -sourceimpl PartialOrd<Error> for Errorsourcefn partial_cmp(&self, other: &Error) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more +sourceimpl PartialOrd<Error> for Errorsourcefn partial_cmp(&self, other: &Error) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more 1.0.0 · sourcefn lt(&self, other: &Rhs) -> boolThis method tests less than (for self and other) and is used by the < operator. Read more 1.0.0 · sourcefn le(&self, other: &Rhs) -> boolThis method tests less than or equal to (for self and other) and is used by the <= operator. Read more 1.0.0 · sourcefn gt(&self, other: &Rhs) -> boolThis method tests greater than (for self and other) and is used by the > operator. Read more 1.0.0 · sourcefn ge(&self, other: &Rhs) -> boolThis method tests greater than or equal to (for self and other) and is used by the >= operator. Read more -sourceimpl Copy for Errorsourceimpl Eq for Errorsourceimpl StructuralEq for Errorsourceimpl StructuralPartialEq for ErrorAuto Trait Implementationsimpl RefUnwindSafe for Errorimpl Send for Errorimpl Sync for Errorimpl Unpin for Errorimpl UnwindSafe for ErrorBlanket Implementationssourceimpl<T> Any for T where T: 'static + ?Sized, sourcefn type_id(&self) -> TypeIdGets the TypeId of self. Read more -sourceimpl<T> Borrow<T> for T where T: ?Sized, const: unstable · sourcefn borrow(&self) -> &TImmutably borrows from an owned value. Read more -sourceimpl<T> BorrowMut<T> for T where T: ?Sized, const: unstable · sourcefn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more -impl<T> CallHasher for T where T: Hash + ?Sized, default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64 where H: Hash + ?Sized, B: BuildHasher, sourceimpl<Q, K> Equivalent<K> for Q where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized, sourcefn equivalent(&self, key: &K) -> boolCompare self to key and return true if they are equal. -sourceimpl<T> From<T> for Tconst: unstable · sourcefn from(t: T) -> TReturns the argument unchanged. -sourceimpl<T> Instrument for Tsourcefn instrument(self, span: Span) -> Instrumented<Self>Instruments this type with the provided Span, returning an +sourceimpl Copy for Errorsourceimpl Eq for Errorsourceimpl StructuralEq for Errorsourceimpl StructuralPartialEq for ErrorAuto Trait Implementationsimpl RefUnwindSafe for Errorimpl Send for Errorimpl Sync for Errorimpl Unpin for Errorimpl UnwindSafe for ErrorBlanket Implementationssourceimpl<T> Any for T where T: 'static + ?Sized, sourcefn type_id(&self) -> TypeIdGets the TypeId of self. Read more +sourceimpl<T> Borrow<T> for T where T: ?Sized, const: unstable · sourcefn borrow(&self) -> &TImmutably borrows from an owned value. Read more +sourceimpl<T> BorrowMut<T> for T where T: ?Sized, const: unstable · sourcefn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more +impl<T> CallHasher for T where T: Hash + ?Sized, default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64 where H: Hash + ?Sized, B: BuildHasher, sourceimpl<Q, K> Equivalent<K> for Q where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized, sourcefn equivalent(&self, key: &K) -> boolCompare self to key and return true if they are equal. +sourceimpl<T> From<T> for Tconst: unstable · sourcefn from(t: T) -> TReturns the argument unchanged. +sourceimpl<T> Instrument for Tsourcefn instrument(self, span: Span) -> Instrumented<Self>Instruments this type with the provided Span, returning an Instrumented wrapper. Read more -sourcefn in_current_span(self) -> Instrumented<Self>Instruments this type with the current Span, returning an +sourcefn in_current_span(self) -> Instrumented<Self>Instruments this type with the current Span, returning an Instrumented wrapper. Read more -sourceimpl<T, U> Into<U> for T where U: From<T>, const: unstable · sourcefn into(self) -> UCalls U::from(self). +sourceimpl<T, U> Into<U> for T where U: From<T>, const: unstable · sourcefn into(self) -> UCalls U::from(self). That is, this conversion is whatever the implementation of From<T> for U chooses to do. -sourceimpl<T> Same<T> for Ttype Output = TShould always be Self -sourceimpl<T> ToOwned for T where T: Clone, type Owned = TThe resulting type after obtaining ownership. -sourcefn to_owned(&self) -> TCreates owned data from borrowed data, usually by cloning. Read more -sourcefn clone_into(&self, target: &mut T)Uses borrowed data to replace owned data, usually by cloning. Read more -sourceimpl<T> ToString for T where T: Display + ?Sized, sourcedefault fn to_string(&self) -> StringConverts the given value to a String. Read more -sourceimpl<T, U> TryFrom<U> for T where U: Into<T>, type Error = InfallibleThe type returned in the event of a conversion error. +sourceimpl<T> Same<T> for Ttype Output = TShould always be Self +sourceimpl<T> ToOwned for T where T: Clone, type Owned = TThe resulting type after obtaining ownership. +sourcefn to_owned(&self) -> TCreates owned data from borrowed data, usually by cloning. Read more +sourcefn clone_into(&self, target: &mut T)Uses borrowed data to replace owned data, usually by cloning. Read more +sourceimpl<T> ToString for T where T: Display + ?Sized, sourcedefault fn to_string(&self) -> StringConverts the given value to a String. Read more +sourceimpl<T, U> TryFrom<U> for T where U: Into<T>, type Error = InfallibleThe type returned in the event of a conversion error. const: unstable · sourcefn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>Performs the conversion. -sourceimpl<T, U> TryInto<U> for T where U: TryFrom<T>, type Error = <U as TryFrom<T>>::ErrorThe type returned in the event of a conversion error. +sourceimpl<T, U> TryInto<U> for T where U: TryFrom<T>, type Error = <U as TryFrom<T>>::ErrorThe type returned in the event of a conversion error. const: unstable · sourcefn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>Performs the conversion. -impl<V, T> VZip<V> for T where V: MultiLane<T>, fn vzip(self) -> Vsourceimpl<T> WithSubscriber for Tsourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>, Attaches the provided Subscriber to this type, returning a +impl<V, T> VZip<V> for T where V: MultiLane<T>, fn vzip(self) -> Vsourceimpl<T> WithSubscriber for Tsourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>, Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more -sourcefn with_current_subscriber(self) -> WithDispatch<Self>Attaches the current default Subscriber to this type, returning a +sourcefn with_current_subscriber(self) -> WithDispatch<Self>Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more - \ No newline at end of file +
Challenge for the “Bearer” HTTP Authentication Scheme.
Challenge for WWW-Authenticate header with HTTP Bearer auth scheme, described in RFC 6750.
Builder for the Bearer challenge.
use actix_web_httpauth::headers::www_authenticate::bearer::{ Bearer, Error, @@ -18,60 +18,60 @@ .insert_header(WwwAuthenticate(challenge)) .finish() }
Creates the builder for Bearer challenge.
let challenge = Bearer::build() .realm("Restricted area") .scope("openid profile email") .finish();
pub struct BearerBuilder(_);
It is up to implementor to fill all required fields, neither this Builder nor Bearer provide any validation.
Builder
Provides the scope attribute, as defined in RFC 6749 §3.3.
Provides the realm attribute, as defined in RFC 2617.
Provides the error attribute, as defined in [RFC 6750, Section 3.1].
error
Provides the error_description attribute, as defined in [RFC 6750, Section 3].
error_description
Provides the error_uri attribute, as defined in [RFC 6750 §3].
error_uri
It is up to implementor to provide properly-formed absolute URI.
RFC 6750 §3
Consumes the builder and returns built Bearer instance.
WWW-Authenticate header, described in RFC 7235.
Authentication challenge for WWW-Authenticate header.
pub struct WwwAuthenticate<C: Challenge>(pub C);
This header is generic over the Challenge trait, see Basic and Bearer challenges for details.
Challenge
0: C
pub trait Challenge: TryIntoHeaderValue + Debug + Display + Clone + Send + Sync { +Challenge in actix_web_httpauth::headers::www_authenticate - Rust☰ChallengeRequired Methodsto_bytesImplementorsIn actix_web_httpauth::headers::www_authenticate?Trait actix_web_httpauth::headers::www_authenticate::Challengesource · [−]pub trait Challenge: TryIntoHeaderValue + Debug + Display + Clone + Send + Sync { fn to_bytes(&self) -> Bytes; }Expand descriptionAuthentication challenge for WWW-Authenticate header. -Required Methodssourcefn to_bytes(&self) -> BytesConverts the challenge into a bytes suitable for HTTP transmission. -Implementors \ No newline at end of file +
pub trait Challenge: TryIntoHeaderValue + Debug + Display + Clone + Send + Sync { fn to_bytes(&self) -> Bytes; }
Converts the challenge into a bytes suitable for HTTP transmission.
HTTP authentication schemes for Actix Web.
Provides:
HTTP Authentication middleware.
Middleware for checking HTTP authentication.
pub struct HttpAuthentication<T, F> where T: FromRequest, { /* private fields */ }
If there is no Authorization header in the request, this middleware returns an error immediately, without calling the F callback.
F
Otherwise, it will pass both the request and the parsed credentials into it. In case of successful validation F callback is required to return the ServiceRequest back.
Construct HttpAuthentication middleware with the provided auth extractor T and +
HttpAuthentication
Construct HttpAuthentication middleware with the provided auth extractor T and validation callback F.
Construct HttpAuthentication middleware for the HTTP “Basic” authentication scheme.
// In this example validator returns immediately, but since it is required to return // anything that implements `IntoFuture` trait, it can be extended to query database or to @@ -19,7 +19,7 @@ validation callback F. } let middleware = HttpAuthentication::basic(validator);
Construct HttpAuthentication middleware for the HTTP “Bearer” authentication scheme.
async fn validator( req: ServiceRequest, @@ -38,36 +38,36 @@ validation callback F. } let middleware = HttpAuthentication::bearer(validator);
fn:
fn
mod
struct
enum
trait
type
macro
Access-Control-Request-Method
Compress
Logger
1 2 @@ -111,4 +111,4 @@ assert!(AllOrSome::Some(()).is_some()); }
1 2 @@ -1283,4 +1283,4 @@ } }
1 2 @@ -99,4 +99,4 @@ } }
1 2 @@ -767,4 +767,4 @@ } }
1 2 @@ -121,4 +121,4 @@ use inner::{Inner, OriginFn}; pub use middleware::CorsMiddleware;
1 2 @@ -527,4 +527,4 @@ } }
1 +config.rs - source☰?1 2 3 4 @@ -201,4 +201,4 @@ } } - \ No newline at end of file +
1 2 3 4 @@ -201,4 +201,4 @@ } }
1 +identity.rs - source☰?1 2 3 4 @@ -529,4 +529,4 @@ } } - \ No newline at end of file +
1 2 3 4 @@ -529,4 +529,4 @@ } }
1 +identity_ext.rs - source☰?1 2 3 4 @@ -53,4 +53,4 @@ } } - \ No newline at end of file +
1 2 3 4 @@ -53,4 +53,4 @@ } }
1 +lib.rs - source☰?1 2 3 4 @@ -199,4 +199,4 @@ pub use self::identity_ext::IdentityExt; pub use self::middleware::IdentityMiddleware; - \ No newline at end of file +
1 2 3 4 @@ -199,4 +199,4 @@ pub use self::identity_ext::IdentityExt; pub use self::middleware::IdentityMiddleware;
1 +middleware.rs - source☰?1 2 3 4 @@ -511,4 +511,4 @@ LogOut, } - \ No newline at end of file +
1 2 3 4 @@ -511,4 +511,4 @@ LogOut, }
1 2 @@ -243,4 +243,4 @@ } }
1 2 @@ -85,4 +85,4 @@ } }
1 2 @@ -319,4 +319,4 @@ } }
1 2 @@ -207,4 +207,4 @@ } }
1 2 @@ -237,4 +237,4 @@ } }
1 +lib.rs - source☰?1 2 3 4 @@ -669,4 +669,4 @@ } } - \ No newline at end of file +
1 2 3 4 @@ -669,4 +669,4 @@ } }
1 +lib.rs - source☰?1 2 3 4 @@ -57,4 +57,4 @@ #[cfg(feature = "web")] impl actix_web::ResponseError for Error {} - \ No newline at end of file +
1 2 3 4 @@ -57,4 +57,4 @@ #[cfg(feature = "web")] impl actix_web::ResponseError for Error {}
1 +redis.rs - source☰?1 2 3 4 @@ -285,4 +285,4 @@ } } - \ No newline at end of file +
1 2 3 4 @@ -285,4 +285,4 @@ } }
1 2 @@ -793,4 +793,4 @@ } }
1 2 @@ -1465,4 +1465,4 @@ } }
1 2 @@ -927,4 +927,4 @@ Ok(()) }
1 2 @@ -649,4 +649,4 @@ } }
1 2 @@ -77,4 +77,4 @@ } }
1 2 @@ -231,4 +231,4 @@ } }
1 2 @@ -53,4 +53,4 @@ #[cfg(feature = "redis-rs-session")] pub use redis_rs::{RedisSessionStore, RedisSessionStoreBuilder};
1 2 @@ -631,4 +631,4 @@ } }
1 2 @@ -695,4 +695,4 @@ } }
1 2 @@ -117,4 +117,4 @@ } }
1 2 @@ -39,4 +39,4 @@ String::from_utf8(value).unwrap().try_into().unwrap() }
1 2 @@ -277,4 +277,4 @@ } }
1 2 @@ -1619,4 +1619,4 @@ } }
1 2 @@ -81,4 +81,4 @@ } }
1 2 @@ -187,4 +187,4 @@ } }
1 2 @@ -141,4 +141,4 @@ } }
1 2 @@ -191,4 +191,4 @@ } }
1 2 @@ -135,4 +135,4 @@ } }
1 2 @@ -131,4 +131,4 @@ pub tls: Tls, }
1 2 @@ -55,4 +55,4 @@ } }
1 2 @@ -133,4 +133,4 @@ } }
1 2 @@ -197,4 +197,4 @@ } }
1 2 @@ -37,4 +37,4 @@ pub private_key: PathBuf, }
1 +basic.rs - source☰?1 2 3 4 @@ -223,4 +223,4 @@ } } - \ No newline at end of file +
1 2 3 4 @@ -223,4 +223,4 @@ } }
1 +bearer.rs - source☰?1 2 3 4 @@ -287,4 +287,4 @@ } } - \ No newline at end of file +
1 2 3 4 @@ -287,4 +287,4 @@ } }
1 +config.rs - source☰?1 2 3 4 @@ -41,4 +41,4 @@ } } - \ No newline at end of file +
1 2 3 4 @@ -41,4 +41,4 @@ } }
1 +errors.rs - source☰?1 2 3 4 @@ -157,4 +157,4 @@ } } - \ No newline at end of file +
1 2 3 4 @@ -157,4 +157,4 @@ } }
1 +mod.rs - source☰?1 2 3 4 @@ -17,4 +17,4 @@ pub use self::config::AuthExtractorConfig; pub use self::errors::AuthenticationError; - \ No newline at end of file +
1 2 3 4 @@ -17,4 +17,4 @@ pub use self::config::AuthExtractorConfig; pub use self::errors::AuthenticationError;
1 +errors.rs - source☰?1 2 3 4 @@ -143,4 +143,4 @@ } } - \ No newline at end of file +
1 2 3 4 @@ -143,4 +143,4 @@ } }
1 +header.rs - source☰?1 2 3 4 @@ -167,4 +167,4 @@ } } - \ No newline at end of file +
1 2 3 4 @@ -167,4 +167,4 @@ } }
1 +mod.rs - source☰?1 2 3 4 @@ -17,4 +17,4 @@ pub use self::header::Authorization; pub use self::scheme::{basic::Basic, bearer::Bearer, Scheme}; - \ No newline at end of file +
1 2 3 4 @@ -17,4 +17,4 @@ pub use self::header::Authorization; pub use self::scheme::{basic::Basic, bearer::Bearer, Scheme};
1 +basic.rs - source☰