mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-23 23:51:06 +01:00
prepare actix-identity release 0.5.0
This commit is contained in:
parent
d3fb564380
commit
603215095a
@ -1,37 +1,40 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## 0.5.0 - 2022-xx-xx
|
## Unreleased - 2022-xx-xx
|
||||||
|
|
||||||
`actix-identity:0.5.0` is a complete rewrite. The goal is to streamline user experience and reduce maintenance overhead.
|
|
||||||
|
|
||||||
`actix-identity:0.5.0` is designed as an additional layer on top of `actix-session:0.7.x`, focused on identity management.
|
## 0.5.0 - 2022-07-11
|
||||||
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` (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 is a complete rewrite. The goal is to streamline user experience and reduce maintenance overhead.
|
||||||
|
|
||||||
`actix-identity:0.5.0` has feature-parity with `actix-identity:0.4.x` - if you bump into any blocker when upgrading, please open an issue.
|
`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:
|
Changes:
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.57 due to transitive `time` dependency.
|
- Minimum supported Rust version (MSRV) is now 1.57 due to transitive `time` dependency.
|
||||||
- `IdentityService`, `IdentityPolicy` and `CookieIdentityPolicy` have been replaced by `IdentityMiddleware`. [#246]
|
- `IdentityService`, `IdentityPolicy` and `CookieIdentityPolicy` have been replaced by `IdentityMiddleware`. [#246]
|
||||||
- `RequestIdentity` has been replaced by `IdentityExt`. [#246]
|
- Rename `RequestIdentity` trait to `IdentityExt`. [#246]
|
||||||
- Trying to extract an `Identity` for an unauthenticated user will return a `401` response to the caller. Extract an `Option<Identity>` or a `Result<Identity, actix_web::Error>` if you need to work with users that may or may not be authenticated [#246]. Example:
|
- Trying to extract an `Identity` for an unauthenticated user will return a `401 Unauthorized` response to the client. Extract an `Option<Identity>` or a `Result<Identity, actix_web::Error>` if you need to handle cases where requests may or may not be authenticated. [#246]
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use actix_web::{http::header::LOCATION, get, HttpResponse, Responder};
|
||||||
|
use actix_identity::Identity;
|
||||||
|
|
||||||
```rust
|
#[get("/")]
|
||||||
use actix_web::{http::header::LOCATION, get, HttpResponse, Responder};
|
async fn index(user: Option<Identity>) -> impl Responder {
|
||||||
use actix_identity::Identity;
|
if let Some(user) = user {
|
||||||
|
HttpResponse::Ok().finish()
|
||||||
#[get("/")]
|
} else {
|
||||||
async fn index(user: Option<Identity>) -> impl Responder {
|
// Redirect to login page if unauthenticated
|
||||||
if let Some(user) = user {
|
HttpResponse::TemporaryRedirect()
|
||||||
HttpResponse::Ok().finish()
|
.insert_header((LOCATION, "/login"))
|
||||||
} else {
|
.finish()
|
||||||
// Redirect to login page if unauthenticated
|
}
|
||||||
HttpResponse::TemporaryRedirect()
|
}
|
||||||
.insert_header((LOCATION, "/login"))
|
```
|
||||||
.finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
[#246]: https://github.com/actix/actix-extras/pull/246
|
[#246]: https://github.com/actix/actix-extras/pull/246
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-identity"
|
name = "actix-identity"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
authors = [
|
authors = [
|
||||||
"Nikolay Kim <fafhrd91@gmail.com>",
|
"Nikolay Kim <fafhrd91@gmail.com>",
|
||||||
"Luca Palmieri <rust@lpalmieri.com>",
|
"Luca Palmieri <rust@lpalmieri.com>",
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
> Identity service for actix-web framework.
|
> Identity service for actix-web framework.
|
||||||
|
|
||||||
[![crates.io](https://img.shields.io/crates/v/actix-identity?label=latest)](https://crates.io/crates/actix-identity)
|
[![crates.io](https://img.shields.io/crates/v/actix-identity?label=latest)](https://crates.io/crates/actix-identity)
|
||||||
[![Documentation](https://docs.rs/actix-identity/badge.svg?version=0.4.0)](https://docs.rs/actix-identity/0.4.0)
|
[![Documentation](https://docs.rs/actix-identity/badge.svg?version=0.5.0)](https://docs.rs/actix-identity/0.5.0)
|
||||||
![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-identity)
|
![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-identity)
|
||||||
[![Dependency Status](https://deps.rs/crate/actix-identity/0.4.0/status.svg)](https://deps.rs/crate/actix-identity/0.4.0)
|
[![Dependency Status](https://deps.rs/crate/actix-identity/0.5.0/status.svg)](https://deps.rs/crate/actix-identity/0.5.0)
|
||||||
|
|
||||||
## Documentation & community resources
|
## Documentation & community resources
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user