mirror of
https://github.com/vbrandl/bind9-api.git
synced 2025-04-21 01:57:00 +02:00
Compare commits
124 Commits
Author | SHA1 | Date | |
---|---|---|---|
6688ffebbc | |||
|
bee19e4c78 | ||
|
be5c8c6e62 | ||
|
55aa95a41c | ||
|
a31c30a3b0 | ||
|
27cba3d460 | ||
|
ebd64545d4 | ||
|
5e1e171584 | ||
|
a498428247 | ||
|
69c6530a2a | ||
|
0e3ed4554d | ||
|
0fcd919e60 | ||
|
05511e3526 | ||
|
f68a33f85c | ||
|
054760b041 | ||
|
6aacdd0ecb | ||
|
2b63223462 | ||
|
eb94a3cc41 | ||
|
9da3f45cd2 | ||
|
973593d53d | ||
|
65305e98f7 | ||
|
529efb4d38 | ||
|
6397f72a3a | ||
|
b84f1fbc97 | ||
|
e319366bd5 | ||
|
f221638c84 | ||
|
7e9676f966 | ||
|
d2650cf561 | ||
|
a008f8d73d | ||
|
c6427f90ec | ||
|
2b0c71d384 | ||
|
9dcd50a92e | ||
|
c8de45c8b3 | ||
|
6b7b67aa35 | ||
|
c758e03109 | ||
|
3cfeeef63c | ||
|
a9f4294bfc | ||
|
11a0306e45 | ||
|
2560dbc723 | ||
|
8d5fe29da3 | ||
|
21e11e4a86 | ||
|
e01d75787a | ||
|
c4a9069592 | ||
|
a6f8544837 | ||
|
fee4882fea | ||
|
8f3dd17cb5 | ||
|
5ed74531dc | ||
|
06b1fcdb85 | ||
|
6a16f37e71 | ||
|
970e4da459 | ||
|
347fe90afd | ||
|
6ea6ffc76a | ||
|
73bf955d68 | ||
|
a6e786a3fb | ||
|
e9e65b4f7a | ||
|
9dee0ba3e0 | ||
|
c79472e828 | ||
|
21b9df70a3 | ||
|
1ffc650e1b | ||
|
30b548c06e | ||
|
ef0179bdbe | ||
|
fc4d9a6286 | ||
|
379e329a0b | ||
|
5edf89e6d2 | ||
|
19b777ac70 | ||
|
02e81c9308 | ||
|
ec56de5dd7 | ||
|
3b19dab99a | ||
|
4cbe3cf0fa | ||
|
7b13da59bb | ||
|
0c6d61ee22 | ||
|
c341578749 | ||
|
357012e0d4 | ||
|
12140e8767 | ||
|
c4c2107b03 | ||
|
05d8bdafd0 | ||
|
c4cb843dab | ||
|
78ebb05b34 | ||
|
3babc1fc9e | ||
|
f4c509cdaf | ||
|
f27cfa4544 | ||
|
40f3b8fbd0 | ||
|
144eb24edd | ||
|
d666548214 | ||
|
58078eee81 | ||
|
b1ef857d76 | ||
|
3c5d1cdcd3 | ||
|
e6cc6440a9 | ||
|
fb648901c4 | ||
|
b8468b56c6 | ||
|
93578c917c | ||
|
74a6121c65 | ||
|
9a4a484add | ||
|
75bd96d470 | ||
|
a4668072ac | ||
|
48d4e6b41a | ||
|
9835de15b1 | ||
|
9f619bb1a7 | ||
|
445ce3d0cd | ||
|
a0d59b42a9 | ||
|
2f7e28e531 | ||
|
488018e35e | ||
|
d1558b2590 | ||
|
4f0af6e1f1 | ||
|
1fb4406138 | ||
|
d5f5dd39b3 | ||
|
7ff19e8add | ||
|
bef32c0d91 | ||
|
bed16f2e35 | ||
|
933e6aa23b | ||
|
f591e8014b | ||
|
0010349003 | ||
|
70b3aeec37 | ||
|
3e25b49286 | ||
|
e135bf9386 | ||
|
81c3e7daa5 | ||
|
8445dbc5ac | ||
|
abf04e9b4d | ||
|
6b61addfc7 | ||
|
69d7b47c83 | ||
|
8dd1a1b0fa | ||
|
d87cbf9d0f | ||
|
3af4ccf2d2 | ||
|
d50bfb83dc |
3065
Cargo.lock
generated
3065
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
13
README.md
13
README.md
@ -7,6 +7,19 @@
|
||||
This is an attempt to implement an API to create, update or delete DNS records
|
||||
on a BIND9 DNS server.
|
||||
|
||||
## Building
|
||||
|
||||
To compile the code, you first need to [install Rust](https://rustup.rs/). Then
|
||||
you can run
|
||||
|
||||
```
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
in the project root. The server and client binary will be located in
|
||||
`./target/release/bind9-api` and `./target/release/bind9-api-client`
|
||||
respectively.
|
||||
|
||||
## Server
|
||||
|
||||
The server will wait for incoming requests and uses the `nsupdate` command to
|
||||
|
@ -3,13 +3,13 @@
|
||||
set -ex
|
||||
|
||||
main() {
|
||||
local src=$(pwd) \
|
||||
stage=$src/deploy
|
||||
local src=$(pwd)
|
||||
local stage=$src/deploy
|
||||
|
||||
mkdir -p $deploy
|
||||
mkdir -p $stage
|
||||
|
||||
cp target/x86_64-unknown-linux-musl/release/bind9-api $stage/bind9-api-${TRAVIS-TAG:1}-x86_64-musl
|
||||
cp target/x86_64-unknown-linux-musl/release/bind9-api-client $stage/bind9-api-client-${TRAVIS-TAG:1}-x86_64-musl
|
||||
cp target/x86_64-unknown-linux-musl/release/bind9-api $stage/bind9-api-${TRAVIS_TAG:1}-x86_64-musl
|
||||
cp target/x86_64-unknown-linux-musl/release/bind9-api-client $stage/bind9-api-client-${TRAVIS_TAG:1}-x86_64-musl
|
||||
}
|
||||
|
||||
main
|
||||
|
194
client/Cargo.lock
generated
194
client/Cargo.lock
generated
@ -1,194 +0,0 @@
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bind9-api-client"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "redox_termios"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.14.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.14.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termion"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
"checksum atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2fc4a1aa4c24c0718a250f0681885c1af91419d242f29eb8f2ab28502d80dbd1"
|
||||
"checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789"
|
||||
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
|
||||
"checksum libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "b685088df2b950fccadf07a7187c8ef846a959c142338a48f9dc0b94517eb5f1"
|
||||
"checksum proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "effdb53b25cdad54f8f48843d67398f7ef2e14f12c1b4cb4effc549a6462a4d6"
|
||||
"checksum quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e44651a0dc4cdd99f71c83b561e221f714912d11af1a4dff0631f923d53af035"
|
||||
"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1"
|
||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||
"checksum serde 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)" = "210e5a3b159c566d7527e9b22e44be73f2e0fcc330bb78fef4dbccb56d2e74c8"
|
||||
"checksum serde_derive 1.0.69 (registry+https://github.com/rust-lang/crates.io-index)" = "dd724d68017ae3a7e63600ee4b2fdb3cad2158ffd1821d44aff4580f63e2b593"
|
||||
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
||||
"checksum syn 0.14.4 (registry+https://github.com/rust-lang/crates.io-index)" = "2beff8ebc3658f07512a413866875adddd20f4fd47b2a4e6c9da65cd281baaea"
|
||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
|
||||
"checksum toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a0263c6c02c4db6c8f7681f9fd35e90de799ebd4cfdeab77a38f4ff6b3d8c0d9"
|
||||
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
||||
"checksum winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "773ef9dcc5f24b7d850d0ff101e542ff24c3b090a9768e03ff889fdef41f00fd"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
@ -1,21 +1,21 @@
|
||||
[package]
|
||||
name = "bind9-api-client"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
authors = ["Valentin Brandl <vbrandl@riseup.net>"]
|
||||
description = "Client for the BIND9 API"
|
||||
license = "MIT/Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
clap = "2.32.0"
|
||||
clap = "2.33.0"
|
||||
crypto = { path = "../crypto" }
|
||||
data = { path = "../data" }
|
||||
failure = "0.1.1"
|
||||
hyper = "0.11"
|
||||
log = "0.4.3"
|
||||
failure = "0.1.7"
|
||||
hyper = "0.12.35"
|
||||
log = "0.4.8"
|
||||
openssl-probe = "0.1.2"
|
||||
pretty_env_logger = "0.2.3"
|
||||
reqwest = "0.8.6"
|
||||
serde = "1.0.69"
|
||||
serde_derive = "1.0.69"
|
||||
serde_json = "1.0.22"
|
||||
toml = "0.4.6"
|
||||
pretty_env_logger = "0.4.0"
|
||||
reqwest = "0.9.24"
|
||||
serde = "1.0.104"
|
||||
serde_derive = "1.0.104"
|
||||
serde_json = "1.0.50"
|
||||
toml = "0.5.6"
|
||||
|
@ -42,7 +42,6 @@ extern crate clap;
|
||||
extern crate crypto;
|
||||
extern crate data;
|
||||
extern crate failure;
|
||||
#[macro_use]
|
||||
extern crate hyper;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
@ -65,8 +64,6 @@ use std::borrow::Cow;
|
||||
|
||||
type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
header! { (XApiToken, data::TOKEN_HEADER) => [String] }
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Copy)]
|
||||
enum Method {
|
||||
POST,
|
||||
@ -109,16 +106,17 @@ fn call_api<D: serde::Serialize>(
|
||||
let data_s = serde_json::to_string(&data)?;
|
||||
info!("body: {}", data_s);
|
||||
let signature = crypto::sign(config.secret.as_bytes(), data_s.as_bytes());
|
||||
let signature = crypto::bytes_to_hex_str(&signature)?;
|
||||
let signature = crypto::bytes_to_hex_str(&signature);
|
||||
let client = reqwest::Client::new();
|
||||
let url = format!("{}/record", config.host);
|
||||
Ok(if method == Method::POST {
|
||||
client.post(&url)
|
||||
} else {
|
||||
client.delete(&url)
|
||||
}.header(XApiToken(signature))
|
||||
.json(&data)
|
||||
.send()?)
|
||||
}
|
||||
.header("X-Api-Token", signature)
|
||||
.json(&data)
|
||||
.send()?)
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
|
@ -5,9 +5,9 @@ authors = ["Valentin Brandl <vbrandl@riseup.net>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
failure = "0.1.1"
|
||||
hex = "0.3.2"
|
||||
ring = "0.12.1"
|
||||
failure = "0.1.7"
|
||||
hex = "0.4.0"
|
||||
ring = "0.13.5"
|
||||
|
||||
[dev-dependencies]
|
||||
proptest = "0.8.1"
|
||||
proptest = "0.9.5"
|
||||
|
@ -55,10 +55,8 @@ use ring::{digest, hmac};
|
||||
type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Converts a byte slice to a lowercase hex string.
|
||||
pub fn bytes_to_hex_str(bytes: &[u8]) -> Result<String> {
|
||||
let mut output = String::new();
|
||||
bytes.write_hex(&mut output)?;
|
||||
Ok(output)
|
||||
pub fn bytes_to_hex_str(bytes: &[u8]) -> String {
|
||||
bytes.encode_hex::<String>()
|
||||
}
|
||||
|
||||
/// Converts a hey string to a vec of bytes.
|
||||
|
@ -5,6 +5,6 @@ authors = ["Valentin Brandl <vbrandl@riseup.net>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
failure = "0.1.1"
|
||||
serde = "1.0.69"
|
||||
serde_derive = "1.0.69"
|
||||
failure = "0.1.7"
|
||||
serde = "1.0.104"
|
||||
serde_derive = "1.0.104"
|
||||
|
1741
server/Cargo.lock
generated
1741
server/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,18 +1,18 @@
|
||||
[package]
|
||||
name = "bind9-api"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
authors = ["Valentin Brandl <vbrandl@riseup.net>"]
|
||||
description = "Web API to create, update and remove DNS entries in bind9"
|
||||
license = "MIT/Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "0.6.14"
|
||||
clap = "2.31.2"
|
||||
actix-web = "0.7.19"
|
||||
clap = "2.33.0"
|
||||
crypto = { path = "../crypto" }
|
||||
data = { path = "../data" }
|
||||
failure = "0.1.1"
|
||||
futures = "0.1.21"
|
||||
log = "0.4.3"
|
||||
pretty_env_logger = "0.2.3"
|
||||
serde = "1.0.69"
|
||||
serde_json = "1.0.22"
|
||||
failure = "0.1.7"
|
||||
futures = "0.1.29"
|
||||
log = "0.4.8"
|
||||
pretty_env_logger = "0.4.0"
|
||||
serde = "1.0.104"
|
||||
serde_json = "1.0.50"
|
||||
|
@ -104,7 +104,7 @@ pub struct Validated<T>(T);
|
||||
|
||||
impl<T: 'static + ::serde::de::DeserializeOwned> FromRequest<Arc<Config>> for Validated<T> {
|
||||
type Config = ();
|
||||
type Result = Box<Future<Item = Self, Error = Error>>;
|
||||
type Result = Box<dyn Future<Item = Self, Error = Error>>;
|
||||
|
||||
fn from_request(req: &HttpRequest<Arc<Config>>, _: &Self::Config) -> Self::Result {
|
||||
let state = req.state().clone();
|
||||
@ -134,7 +134,8 @@ impl<T> Deref for Validated<T> {
|
||||
}
|
||||
|
||||
fn extract_signature<S>(req: &HttpRequest<S>) -> Result<Vec<u8>> {
|
||||
Ok(req.headers()
|
||||
Ok(req
|
||||
.headers()
|
||||
.get(::data::TOKEN_HEADER)
|
||||
.as_ref()
|
||||
.ok_or_else(|| ErrorUnauthorized(ParseError::Header))?
|
||||
|
Loading…
x
Reference in New Issue
Block a user