actix-extras
actix-extras copied to clipboard
`impl Challenge for &'static str`
PR Type
Feature
PR Checklist
- [x] Tests for the changes have been added / updated.
- [x] Documentation comments have been added / updated.
- [x] A changelog entry has been made for the appropriate packages.
- [x] Format code with the nightly rustfmt (
cargo +nightly fmt).
Overview
As it stands, using actix-web-httpauth::middleware::HttpAuthentication requires creating a type that impls Challenge in order to return an AuthenticationError. This makes it possible to simply (e.g.) return Err(AuthenticationError::new("Authentication required").into()) from your auth check function.
I don't know how useful the test really is, but it allowed me to check the box ;)
(~~The CI failure seems unrelated to this PR~~ it's related but we don't have to run tests on MSRV, I'm going to take a look at the config later today™)