* Add IdentityError to actix-identity crate. In order to let crates in the actix web ecosystem interact correctly with `actix_web::Error`, this commit introduces its own error type, replacing the previous usage of `anyhow::Error`. * Mend some clippy warnings on IdentityError. * Split identity error into more granular versions. - `MissingIdentityError` occurs whenever we attempt to gather information about an identity from a session, and fail. - `LoginError` occurs whenever we attempt to login via an identity, and fail. * Feedback for identity error implementation. - `IdentityError` -> `GetIdentityError` - Move error messages into Display impl where appropriate - Split `id` and `get_identity` errors into two types - Implement `source` on custom errors * Expand identity error types with struct markers. In order to get a little more future compatibility and reduce abstraction leaking, this commit introduces some contextual structs to our identity errors package. * Improve doc message for SessionExpiryError. Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> * Improve identity error docs and messaging. Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> * Expand LostIdentityError with placeholder. Adds a placeholder unit struct to the LostIdentityError variant of GetIdentityError, which should let us expand on that variant with extra context later if we like. * Add From coercion for LostIdentityError. Improve the ergonomics of using the LostIdentityError unit struct. * Update Cargo.toml * Update CHANGES.md * expose identity error module * fix error impl Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> Co-authored-by: Rob Ede <robjtede@icloud.com>
4.4 KiB
Changes
Unreleased - 2022-xx-xx
- Replace use of
anyhow::Error
with specific error types. #296 - Minimum supported Rust version (MSRV) is now 1.59 due to transitive
time
dependency.
0.5.2 - 2022-07-19
- Fix visit deadline. #263
0.5.1 - 2022-07-11
- Remove unnecessary dependencies. #259
0.5.0 - 2022-07-11
actix-identity
v0.5 is a complete rewrite. The goal is to streamline user experience and reduce maintenance overhead.
actix-identity
is now designed as an additional layer on top of actix-session
v0.7, focused on identity management. The identity information is stored in the session state, which is managed by actix-session
and can be stored using any of the supported SessionStore
implementations. This reduces the surface area in actix-identity
(e.g., it is no longer concerned with cookies!) and provides a smooth upgrade path for users: if you need to work with sessions, you no longer need to choose between actix-session
and actix-identity
; they work together now!
actix-identity
v0.5 has feature-parity with actix-identity
v0.4; if you bump into any blocker when upgrading, please open an issue.
Changes:
-
Minimum supported Rust version (MSRV) is now 1.57 due to transitive
time
dependency. -
IdentityService
,IdentityPolicy
andCookieIdentityPolicy
have been replaced byIdentityMiddleware
. #246 -
Rename
RequestIdentity
trait toIdentityExt
. #246 -
Trying to extract an
Identity
for an unauthenticated user will return a401 Unauthorized
response to the client. Extract anOption<Identity>
or aResult<Identity, actix_web::Error>
if you need to handle cases where requests may or may not be authenticated. #246Example:
use actix_web::{http::header::LOCATION, get, HttpResponse, Responder}; use actix_identity::Identity; #[get("/")] async fn index(user: Option<Identity>) -> impl Responder { if let Some(user) = user { HttpResponse::Ok().finish() } else { // Redirect to login page if unauthenticated HttpResponse::TemporaryRedirect() .insert_header((LOCATION, "/login")) .finish() } }
0.4.0 - 2022-03-01
- Update
actix-web
dependency to4
.
0.4.0-beta.9 - 2022-02-07
- Relax body type bounds on middleware impl. #223
- Update
actix-web
dependency to4.0.0-rc.1
.
0.4.0-beta.8 - 2022-01-21
- No significant changes since
0.4.0-beta.7
.
0.4.0-beta.7 - 2021-12-29
- Update
actix-web
dependency to4.0.0.beta-18
. #218 - Minimum supported Rust version (MSRV) is now 1.54.
0.4.0-beta.6 - 2021-12-18
- Update
actix-web
dependency to4.0.0.beta-15
. #216
0.4.0-beta.5 - 2021-12-12
- Update
actix-web
dependency to4.0.0.beta-14
. #209
0.4.0-beta.4 - 2021-11-22
- No significant changes since
0.4.0-beta.3
.
0.4.0-beta.3 - 2021-10-21
- Update
actix-web
dependency to v4.0.0-beta.10. #203 - Minimum supported Rust version (MSRV) is now 1.52.
0.4.0-beta.2 - 2021-06-27
- No notable changes.
0.4.0-beta.1 - 2021-04-02
- Rename
CookieIdentityPolicy::{max_age => max_age_secs}
. #168 - Rename
CookieIdentityPolicy::{max_age_time => max_age}
. #168 - Update
actix-web
dependency to 4.0.0 beta. - Minimum supported Rust version (MSRV) is now 1.46.0.
0.3.1 - 2020-09-20
- Add method to set
HttpOnly
flag on cookie identity. #102
0.3.0 - 2020-09-11
- Update
actix-web
dependency to 3.0.0. - Minimum supported Rust version (MSRV) is now 1.42.0.
0.3.0-alpha.1 - 2020-03-14
- Update the
time
dependency to 0.2.7 - Update the
actix-web
dependency to 3.0.0-alpha.1 - Minimize
futures
dependency
0.2.1 - 2020-01-10
- Fix panic with already borrowed: BorrowMutError #1263
0.2.0 - 2019-12-20
- Use actix-web 2.0
0.1.0 - 2019-06-xx
- Move identity middleware to separate crate