-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ name = "mosquitto-jwt-auth" | |
version = "0.1.0" | ||
authors = ["Christoph Walcher <[email protected]>"] | ||
edition = "2018" | ||
[badges] | ||
travis-ci = { repository = "wiomoc/mosquitto-jwt-auth" } | ||
coveralls = { repository = "wiomoc/mosquitto-jwt-auth" } | ||
|
||
[lib] | ||
crate-type=["dylib"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
auth_plugin target/debug/libmosquitto_jwt_auth.so | ||
auth_opt_jwt_alg HS999 | ||
auth_opt_jwt_sec_base64 XmThTwNsoLBlbk3cbOi5r2g1EIJNT7o7zSKy9tMUsIg= | ||
auth_opt_jwt_validate_exp false | ||
auth_opt_jwt_validate_sub_match_username false | ||
listener 3883 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
auth_plugin target/debug/libmosquitto_jwt_auth.so | ||
auth_opt_jwt_alg HS256 | ||
auth_opt_jwt_sec_base64 XmThTwNsoLBlbk3cbOi5r2g1EIJNT7o7zSKy9tMUsIg= | ||
auth_opt_jwt_validate_exp false | ||
auth_opt_jwt_validate_sub_match_username false | ||
listener 3884 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use std::io::{BufRead, BufReader}; | ||
use std::process::{Child, Command, Stdio}; | ||
use std::thread; | ||
use std::time::Duration; | ||
|
||
#[test] | ||
#[cfg(target_os = "linux")] | ||
fn test_should_start() { | ||
let mut child = Command::new("mosquitto") | ||
.args(&["-c", "tests/mosquitto_valid.conf"]) | ||
.stdout(Stdio::piped()) | ||
.spawn() | ||
.unwrap(); | ||
|
||
thread::sleep(Duration::from_secs(3)); | ||
|
||
assert!(child.try_wait().unwrap().is_none()); | ||
child.kill().unwrap(); | ||
thread::sleep(Duration::from_secs(3)); | ||
} | ||
|
||
#[test] | ||
#[cfg(target_os = "linux")] | ||
fn test_invalid_config() { | ||
let mut child = Command::new("mosquitto") | ||
.args(&["-c", "tests/mosquitto_invalid_alg.conf"]) | ||
.stdout(Stdio::piped()) | ||
.spawn() | ||
.unwrap(); | ||
|
||
thread::sleep(Duration::from_secs(3)); | ||
|
||
assert_eq!(child.wait().unwrap().code().unwrap(), 1); | ||
} |