1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 17:22:57 +01:00

update actix-identity to aw4b21

This commit is contained in:
Rob Ede 2022-01-21 20:42:58 +00:00
parent 09734a8d12
commit 4e72e3d8ec
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
2 changed files with 5 additions and 5 deletions

View File

@ -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"

View File

@ -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;
}