From 2e54681af0bc76ed22ce43f8126a029e600ece93 Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 21 Feb 2022 07:34:55 +0300 Subject: Add a module for IndieAuth bearer token auth require_token() uses a token endpoint URI and an HTTP client to query the token endpoint and return a User object if the user was authorized, or rejecting with IndieAuthError if not. It is recommended to use recover() and catch the IndieAuthError at the application level to show a "not authorized" error message to the user. This function is more intended for API consumption, but is general enough to permit using in other scenarios. TODO: make a variant that returns Option instead of rejecting --- Cargo.toml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Cargo.toml') diff --git a/Cargo.toml b/Cargo.toml index 8b43c63..88eb6d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,9 +30,11 @@ mockito = "^0.30.0" # HTTP mocking for Rust. tempdir = "^0.3.7" # A library for managing a temporary directory and deleting all contents when it's dropped paste = "^1.0.5" # Macros for all your token pasting needs test-logger = "^0.1.0" # Simple helper to initialize env_logger before unit and integration tests +httpmock = "^0.6" # HTTP mocking library that allows you to simulate responses from HTTP based services [dependencies] async-trait = "^0.1.50" # Type erasure for async trait methods +bytes = "^1.1.0" data-encoding = "^2.3.2" # Efficient and customizable data-encoding functions like base64, base32, and hex easy-scraper = "^0.2.0" # HTML scraping library focused on ease of use ellipse = "^0.2.0" # Truncate and ellipsize strings in a human-friendly way @@ -80,4 +82,8 @@ default-features = false features = ["multipart", "compression"] [dependencies.hyper] version = "^0.14.17" -features = ["client", "stream", "runtime"] \ No newline at end of file +features = ["client", "stream", "runtime"] +[dependencies.hyper-rustls] +version = "^0.23.0" +default-features = false +features = ["webpki-tokio", "http1", "http2", "tls12", "logging"] \ No newline at end of file -- cgit 1.4.1