mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-23 23: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]
|
[dependencies]
|
||||||
actix-service = "2"
|
actix-service = "2"
|
||||||
actix-utils = "3"
|
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 }
|
futures-util = { version = "0.3.7", default-features = false }
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use actix_utils::future::{ready, Ready};
|
use actix_utils::future::{ready, Ready};
|
||||||
use actix_web::{
|
use actix_web::{
|
||||||
dev::{Extensions, Payload},
|
dev::{Extensions, Payload},
|
||||||
Error, FromRequest, HttpRequest,
|
Error, FromRequest, HttpMessage as _, HttpRequest,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) struct IdentityItem {
|
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
|
/// Return the claimed identity of the user associated request or `None` if no identity can be
|
||||||
/// found associated with the request.
|
/// found associated with the request.
|
||||||
pub fn identity(&self) -> Option<String> {
|
pub fn identity(&self) -> Option<String> {
|
||||||
Identity::get_identity(&self.0.req_data())
|
Identity::get_identity(&self.0.extensions())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remember identity.
|
/// Remember identity.
|
||||||
pub fn remember(&self, identity: String) {
|
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.id = Some(identity);
|
||||||
id.changed = true;
|
id.changed = true;
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ impl Identity {
|
|||||||
|
|
||||||
/// This method is used to 'forget' the current identity on subsequent requests.
|
/// This method is used to 'forget' the current identity on subsequent requests.
|
||||||
pub fn forget(&self) {
|
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.id = None;
|
||||||
id.changed = true;
|
id.changed = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user