From 33dfea8997a4fb3e1d2a525347137213a48ae0fc Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Mon, 28 Sep 2020 02:04:18 +0100 Subject: [PATCH] update httpauth readme --- actix-cors/src/lib.rs | 2 +- actix-web-httpauth/README.md | 31 ++++++++++++------- .../www_authenticate/challenge/basic.rs | 2 +- actix-web-httpauth/src/lib.rs | 18 +++++------ 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/actix-cors/src/lib.rs b/actix-cors/src/lib.rs index c592043af..d09657cda 100644 --- a/actix-cors/src/lib.rs +++ b/actix-cors/src/lib.rs @@ -1133,6 +1133,7 @@ mod tests { resp.headers().get(header::VARY).unwrap().as_bytes() ); + #[allow(clippy::needless_collect)] { let headers = resp .headers() @@ -1145,7 +1146,6 @@ mod tests { .collect::>(); for h in exposed_headers { - #[allow(clippy::needless_collect)] assert!(headers.contains(&h.as_str())); } } diff --git a/actix-web-httpauth/README.md b/actix-web-httpauth/README.md index 470356173..b76dbd6ea 100644 --- a/actix-web-httpauth/README.md +++ b/actix-web-httpauth/README.md @@ -1,22 +1,29 @@ # actix-web-httpauth +> HTTP authentication schemes for [actix-web](https://github.com/actix/actix-web). + [![crates.io](https://img.shields.io/crates/v/actix-web-httpauth)](https://crates.io/crates/actix-web-httpauth) [![Documentation](https://docs.rs/actix-web-httpauth/badge.svg)](https://docs.rs/actix-web-httpauth) -[![Dependency Status](https://deps.rs/crate/actix-web-httpauth/0.4.2/status.svg)](https://deps.rs/crate/actix-web-httpauth/0.4.2) +[![Dependency Status](https://deps.rs/crate/actix-web-httpauth/0.5.0/status.svg)](https://deps.rs/crate/actix-web-httpauth/0.5.0) ![Apache 2.0 or MIT licensed](https://img.shields.io/crates/l/actix-web-httpauth) -[![Join the chat at https://gitter.im/actix/actix](https://badges.gitter.im/actix/actix.svg)](https://gitter.im/actix/actix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Join the chat at https://gitter.im/actix/actix-web](https://badges.gitter.im/actix/actix-web.svg)](https://gitter.im/actix/actix-web?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -> HTTP authentication schemes for [actix-web](https://github.com/actix/actix-web) framework. -Provides: - * typed [Authorization] and [WWW-Authenticate] headers - * [extractors] for an [Authorization] header - * [middleware] for easier authorization checking +## Features +- Typed [Authorization] and [WWW-Authenticate] headers +- [Extractors] for authorization headers +- [Middleware] for easier authorization checking -All supported schemas are actix [Extractors](https://docs.rs/actix-web/2.0.0/actix_web/trait.FromRequest.html), -and can be used both in the middlewares and request handlers. +All supported schemas can be used in both middleware and request handlers. -## Supported schemes +## Supported Schemes +- [HTTP Basic](https://tools.ietf.org/html/rfc7617) +- [OAuth Bearer](https://tools.ietf.org/html/rfc6750) - * [Basic](https://tools.ietf.org/html/rfc7617) - * [Bearer](https://tools.ietf.org/html/rfc6750) + + + +[Authorization]: https://docs.rs/actix-web-httpauth/*/actix_web_httpauth/headers/authorization/index.html +[WWW-Authenticate]: https://docs.rs/actix-web-httpauth/*/actix_web_httpauth/headers/www_authenticate/index.html +[Extractors]: https://actix.rs/docs/extractors/ +[Middleware]: https://docs.rs/actix-web-httpauth/*/actix_web_httpauth/middleware/index.html diff --git a/actix-web-httpauth/src/headers/www_authenticate/challenge/basic.rs b/actix-web-httpauth/src/headers/www_authenticate/challenge/basic.rs index c18a37d7d..efe97d3aa 100644 --- a/actix-web-httpauth/src/headers/www_authenticate/challenge/basic.rs +++ b/actix-web-httpauth/src/headers/www_authenticate/challenge/basic.rs @@ -96,7 +96,7 @@ impl fmt::Display for Basic { let bytes = self.to_bytes(); let repr = str::from_utf8(&bytes) // Should not happen since challenges are crafted manually - // from `&'static str`'s and Strings + // from a `&'static str` or `String` .map_err(|_| fmt::Error)?; f.write_str(repr) diff --git a/actix-web-httpauth/src/lib.rs b/actix-web-httpauth/src/lib.rs index 21994c7be..9bd27d603 100644 --- a/actix-web-httpauth/src/lib.rs +++ b/actix-web-httpauth/src/lib.rs @@ -1,21 +1,21 @@ -//! HTTP Authorization support for [actix-web](https://actix.rs) framework. +//! HTTP authentication schemes for [actix-web](https://actix.rs). //! //! Provides: -//! * typed [Authorization] and [WWW-Authenticate] headers -//! * [extractors] for an [Authorization] header -//! * [middleware] for easier authorization checking +//! - Typed [Authorization] and [WWW-Authenticate] headers +//! - [Extractors] for an [Authorization] header +//! - [Middleware] for easier authorization checking //! //! ## Supported schemes //! -//! * `Basic`, as defined in [RFC7617](https://tools.ietf.org/html/rfc7617) -//! * `Bearer`, as defined in [RFC6750](https://tools.ietf.org/html/rfc6750) +//! - `Basic`, as defined in [RFC7617](https://tools.ietf.org/html/rfc7617) +//! - `Bearer`, as defined in [RFC6750](https://tools.ietf.org/html/rfc6750) //! //! [Authorization]: `crate::headers::authorization::Authorization` //! [WWW-Authenticate]: `crate::headers::www_authenticate::WwwAuthenticate` -//! [extractors]: https://actix.rs/docs/extractors/ -//! [middleware]: ./middleware/ +//! [Extractors]: https://actix.rs/docs/extractors/ +//! [Middleware]: ./middleware -#![deny(bare_trait_objects, missing_docs, nonstandard_style, rust_2018_idioms)] +#![deny(missing_docs, nonstandard_style, rust_2018_idioms)] #![deny(clippy::all)] pub mod extractors;