mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-23 15:51:06 +01:00
update actix-identity to aw4b21
This commit is contained in:
parent
09734a8d12
commit
4e72e3d8ec
@ -16,7 +16,7 @@ path = "src/lib.rs"
|
||||
[dependencies]
|
||||
actix-service = "2"
|
||||
actix-utils = "3"
|
||||
actix-web = { version = "4.0.0-beta.18", default-features = false, features = ["cookies", "secure-cookies"] }
|
||||
actix-web = { version = "4.0.0-beta.21", default-features = false, features = ["cookies", "secure-cookies"] }
|
||||
|
||||
futures-util = { version = "0.3.7", default-features = false }
|
||||
serde = "1.0"
|
||||
|
@ -1,7 +1,7 @@
|
||||
use actix_utils::future::{ready, Ready};
|
||||
use actix_web::{
|
||||
dev::{Extensions, Payload},
|
||||
Error, FromRequest, HttpRequest,
|
||||
Error, FromRequest, HttpMessage as _, HttpRequest,
|
||||
};
|
||||
|
||||
pub(crate) struct IdentityItem {
|
||||
@ -48,12 +48,12 @@ impl Identity {
|
||||
/// Return the claimed identity of the user associated request or `None` if no identity can be
|
||||
/// found associated with the request.
|
||||
pub fn identity(&self) -> Option<String> {
|
||||
Identity::get_identity(&self.0.req_data())
|
||||
Identity::get_identity(&self.0.extensions())
|
||||
}
|
||||
|
||||
/// Remember identity.
|
||||
pub fn remember(&self, identity: String) {
|
||||
if let Some(id) = self.0.req_data_mut().get_mut::<IdentityItem>() {
|
||||
if let Some(id) = self.0.extensions_mut().get_mut::<IdentityItem>() {
|
||||
id.id = Some(identity);
|
||||
id.changed = true;
|
||||
}
|
||||
@ -61,7 +61,7 @@ impl Identity {
|
||||
|
||||
/// This method is used to 'forget' the current identity on subsequent requests.
|
||||
pub fn forget(&self) {
|
||||
if let Some(id) = self.0.req_data_mut().get_mut::<IdentityItem>() {
|
||||
if let Some(id) = self.0.extensions_mut().get_mut::<IdentityItem>() {
|
||||
id.id = None;
|
||||
id.changed = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user