20220219 webui updates + source refactor + clippy go clip clip (#642)

This commit is contained in:
Firstyear 2022-02-20 12:43:38 +10:00 committed by GitHub
parent 6e1ed9ea07
commit f252d91e13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
86 changed files with 1022 additions and 655 deletions

182
Cargo.lock generated
View file

@ -87,9 +87,9 @@ dependencies = [
[[package]]
name = "anyhow"
version = "1.0.53"
version = "1.0.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0"
checksum = "7a99269dff3bc004caa411f38845c20303f1e393ca2bd6581576fa3a7f59577d"
[[package]]
name = "arrayref"
@ -198,9 +198,9 @@ dependencies = [
[[package]]
name = "async-lock"
version = "2.4.0"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b"
checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6"
dependencies = [
"event-listener",
]
@ -559,9 +559,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.0.72"
version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]]
name = "cfg-if"
@ -646,14 +646,14 @@ dependencies = [
[[package]]
name = "concread"
version = "0.3.0"
source = "git+https://github.com/kanidm/concread.git#4c137983f99e0ffe93d27dca12a2054abc86edaf"
source = "git+https://github.com/kanidm/concread.git#7ab828262e05aada2330ae325d95e75f97b8dc4e"
dependencies = [
"ahash",
"crossbeam",
"crossbeam-epoch",
"crossbeam-utils",
"lru",
"parking_lot",
"parking_lot 0.11.2",
"rand 0.8.5",
"smallvec",
"tokio",
@ -945,6 +945,20 @@ dependencies = [
"cipher",
]
[[package]]
name = "daemon"
version = "0.1.0"
dependencies = [
"kanidm",
"profiles",
"score",
"serde",
"structopt",
"tokio",
"toml",
"users",
]
[[package]]
name = "darling"
version = "0.12.4"
@ -1895,26 +1909,22 @@ dependencies = [
"num_cpus",
"num_enum",
"openssl",
"profiles",
"r2d2",
"r2d2_sqlite",
"rand 0.8.5",
"regex",
"rusqlite",
"rustc_version 0.4.0",
"saffron",
"serde",
"serde_cbor",
"serde_derive",
"serde_json",
"smartstring",
"smolset",
"sshkeys",
"structopt",
"tide",
"tide-openssl",
"time 0.2.27",
"tokio",
"tokio-openssl",
"tokio-util",
"toml",
"touch",
@ -1942,6 +1952,7 @@ dependencies = [
"kanidm_proto",
"oauth2",
"reqwest",
"score",
"serde",
"serde_json",
"tokio",
@ -2003,14 +2014,15 @@ dependencies = [
"libc",
"libsqlite3-sys",
"lru",
"profiles",
"r2d2",
"r2d2_sqlite",
"reqwest",
"rpassword",
"rusqlite",
"score",
"serde",
"serde_cbor",
"serde_derive",
"structopt",
"tokio",
"tokio-util",
@ -2089,9 +2101,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.117"
version = "0.2.118"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c"
checksum = "06e509672465a0504304aa87f9f176f2b2b716ed8fb105ebe5c02dc6dce96a94"
[[package]]
name = "libnss"
@ -2230,9 +2242,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "mio"
version = "0.7.14"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
checksum = "ba272f85fa0b41fc91872be579b3bbe0f56b792aa361a380eb669469f68dafb2"
dependencies = [
"libc",
"log",
@ -2475,6 +2487,7 @@ dependencies = [
"ldap3_server",
"mathru",
"openssl",
"profiles",
"rand 0.8.5",
"serde",
"serde_json",
@ -2510,7 +2523,17 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
"lock_api",
"parking_lot_core",
"parking_lot_core 0.8.5",
]
[[package]]
name = "parking_lot"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58"
dependencies = [
"lock_api",
"parking_lot_core 0.9.1",
]
[[package]]
@ -2527,6 +2550,19 @@ dependencies = [
"winapi",
]
[[package]]
name = "parking_lot_core"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954"
dependencies = [
"cfg-if 1.0.0",
"libc",
"redox_syscall",
"smallvec",
"windows-sys",
]
[[package]]
name = "paste"
version = "0.1.18"
@ -2682,9 +2718,9 @@ checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
[[package]]
name = "proc-macro-crate"
version = "1.1.0"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83"
checksum = "9dada8c9981fcf32929c3c0f0cd796a9284aca335565227ed88c83babb1d43dc"
dependencies = [
"thiserror",
"toml",
@ -2729,6 +2765,16 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "profiles"
version = "1.1.0"
dependencies = [
"base64 0.13.0",
"rustc_version 0.4.0",
"serde",
"toml",
]
[[package]]
name = "psl-types"
version = "2.0.10"
@ -2787,7 +2833,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "545c5bc2b880973c9c10e4067418407a0ccaa3091781d1671d46eb35107cb26f"
dependencies = [
"log",
"parking_lot",
"parking_lot 0.11.2",
"scheduled-thread-pool",
]
@ -3104,7 +3150,7 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc6f74fd1204073fa02d5d5d68bec8021be4c38690b61264b2fdb48083d0e7d7"
dependencies = [
"parking_lot",
"parking_lot 0.11.2",
]
[[package]]
@ -3119,6 +3165,30 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "score"
version = "0.1.0"
dependencies = [
"async-std",
"async-trait",
"bundy",
"futures-util",
"kanidm",
"kanidm_proto",
"ldap3_server",
"libc",
"openssl",
"profiles",
"serde",
"tide",
"tide-openssl",
"tokio",
"tokio-openssl",
"tokio-util",
"tracing",
"uuid",
]
[[package]]
name = "security-framework"
version = "2.6.1"
@ -3380,9 +3450,9 @@ dependencies = [
[[package]]
name = "sshkeys"
version = "0.3.1"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c69bf9da628c9a435416cc06f64445c8fa467efe52100bec0912c820ac80fc8"
checksum = "c926cb006a77964474a13a86aa0135ea82c9fd43e6793a1151cc54143db6637c"
dependencies = [
"base64 0.12.3",
"byteorder",
@ -3695,9 +3765,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "1.16.1"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c27a64b625de6d309e8c57716ba93021dccf1b3b5c97edd6d3dd2d2135afc0a"
checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee"
dependencies = [
"bytes",
"libc",
@ -3705,9 +3775,10 @@ dependencies = [
"mio",
"num_cpus",
"once_cell",
"parking_lot",
"parking_lot 0.12.0",
"pin-project-lite 0.2.8",
"signal-hook-registry",
"socket2",
"tokio-macros",
"winapi",
]
@ -3785,9 +3856,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"
[[package]]
name = "tracing"
version = "0.1.30"
version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d8d93354fe2a8e50d5953f5ae2e47a3fc2ef03292e7ea46e3cc38f549525fb9"
checksum = "f6c650a8ef0cd2dd93736f033d21cbd1224c5a967aa0c258d00fcf7dafef9b9f"
dependencies = [
"cfg-if 1.0.0",
"pin-project-lite 0.2.8",
@ -3839,9 +3910,9 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
version = "0.3.8"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74786ce43333fcf51efe947aed9718fbe46d5c7328ec3f1029e818083966d9aa"
checksum = "9e0ab7bdc962035a87fba73f3acca9b8a8d0034c2e6f60b84aeaaddddc155dce"
dependencies = [
"ansi_term",
"lazy_static",
@ -4211,6 +4282,49 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6"
dependencies = [
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_msvc"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5"
[[package]]
name = "windows_i686_gnu"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615"
[[package]]
name = "windows_i686_msvc"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172"
[[package]]
name = "windows_x86_64_gnu"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc"
[[package]]
name = "windows_x86_64_msvc"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316"
[[package]]
name = "winreg"
version = "0.7.0"
@ -4295,9 +4409,9 @@ dependencies = [
[[package]]
name = "zeroize_derive"
version = "1.3.1"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81e8f13fef10b63c06356d65d416b070798ddabcadc10d3ece0c5be9b3c7eddb"
checksum = "3f8f187641dad4f680d25c4bfc4225b418165984179f26ca76ec4fb6441d3a17"
dependencies = [
"proc-macro2",
"quote",

View file

@ -7,6 +7,8 @@ lto = "thin"
members = [
"kanidm_proto",
"kanidmd",
"kanidmd/score",
"kanidmd/daemon",
"kanidmd_web_ui",
"kanidm_client",
"kanidm_tools",
@ -14,6 +16,7 @@ members = [
"kanidm_unix_int/nss_kanidm",
"kanidm_unix_int/pam_kanidm",
"orca",
"profiles",
]
exclude = [

View file

@ -10,15 +10,6 @@ ARGS ?= --build-arg "SCCACHE_REDIS=redis://172.24.20.4:6379"
help:
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/\n\t/'
buildx/kanidmd/simd: ## build multiarch server images
buildx/kanidmd/simd:
@docker buildx build $(EXT_OPTS) --pull --push --platform "linux/amd64" \
-f kanidmd/Dockerfile -t $(IMAGE_BASE)/server:x86_64_$(IMAGE_VERSION) \
--build-arg "KANIDM_BUILD_PROFILE=container_x86_64_v3" \
--build-arg "KANIDM_FEATURES=simd_support" \
$(ARGS) .
@docker buildx imagetools $(EXT_OPTS) inspect $(IMAGE_BASE)/server:$(IMAGE_VERSION)
buildx/kanidmd/x86_64_v3: ## build multiarch server images
buildx/kanidmd/x86_64_v3:
@docker buildx build $(EXT_OPTS) --pull --push --platform "linux/amd64" \

View file

@ -1 +0,0 @@
1.52.0

View file

@ -2,7 +2,7 @@
name = "kanidm_client"
version = "1.1.0-alpha.7"
authors = ["William Brown <william@blackhats.net.au>"]
edition = "2018"
edition = "2021"
license = "MPL-2.0"
description = "Kanidm Client Library"
documentation = "https://docs.rs/kanidm_client/latest/kanidm_client/"
@ -25,6 +25,7 @@ tokio = { version = "1", features = ["rt", "net", "time", "macros", "sync", "sig
tracing-subscriber = "0.3"
tokio = { version = "1", features = ["rt", "net", "time", "macros", "sync", "signal"] }
kanidm = { path = "../kanidmd" }
score = { path = "../kanidmd/score" }
futures = "0.3"
async-std = { version = "1.6", features = ["tokio1"] }

View file

@ -1,5 +1,7 @@
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]

View file

@ -3,10 +3,10 @@ use std::sync::atomic::{AtomicU16, Ordering};
use std::thread;
use kanidm::audit::LogLevel;
use kanidm::config::{Configuration, IntegrationTestConfig};
use kanidm::core::create_server_core;
use kanidm::config::{Configuration, IntegrationTestConfig, ServerRole};
use kanidm::tracing_tree;
use kanidm_client::{KanidmClient, KanidmClientBuilder};
use score::create_server_core;
use async_std::task;
use tokio::sync::mpsc;
@ -55,6 +55,7 @@ pub fn run_test(test_fn: fn(KanidmClient) -> ()) {
config.secure_cookies = false;
config.integration_test_config = Some(int_config);
config.log_level = Some(LogLevel::Quiet as u32);
config.role = ServerRole::WriteReplicaNoUI;
// config.log_level = Some(LogLevel::Verbose as u32);
// config.log_level = Some(LogLevel::FullTrace as u32);
config.threads = 1;

View file

@ -2,7 +2,7 @@
name = "kanidm_proto"
version = "1.1.0-alpha.7"
authors = ["William Brown <william@blackhats.net.au>"]
edition = "2018"
edition = "2021"
license = "MPL-2.0"
description = "Kanidm Protocol Bindings for serde"
documentation = "https://docs.rs/kanidm_proto/latest/kanidm_proto/"

View file

@ -2,7 +2,7 @@
name = "kanidm_tools"
version = "1.1.0-alpha.7"
authors = ["William Brown <william@blackhats.net.au>"]
edition = "2018"
edition = "2021"
default-run = "kanidm"
license = "MPL-2.0"
description = "Kanidm Client Tools"

View file

@ -190,7 +190,7 @@ impl AccountOpt {
eprintln!("Alternatively, you can manually enter the following OTP details:");
println!("Account Name: {}", tok.accountname);
println!("Issuer: {}", tok.issuer);
println!("Algorithm: {}", tok.algo.to_string());
println!("Algorithm: {}", tok.algo);
println!("Period/Step: {}", tok.step);
println!("Secret: {}", tok.get_secret());

View file

@ -1,5 +1,7 @@
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]

View file

@ -1,5 +1,7 @@
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]

View file

@ -2,7 +2,7 @@
name = "kanidm_unix_int"
version = "1.1.0-alpha.7"
authors = ["William Brown <william@blackhats.net.au>"]
edition = "2018"
edition = "2021"
license = "MPL-2.0"
description = "Kanidm Unix Integration Clients"
documentation = "https://docs.rs/kanidm/latest/kanidm/"
@ -80,10 +80,9 @@ lru = "0.7"
[dev-dependencies]
kanidm = { path = "../kanidmd" }
score = { path = "../kanidmd/score" }
[build-dependencies]
structopt = { version = "0.3", default-features = false }
toml = "0.5"
serde = "1.0"
serde_derive = "1.0"
profiles = { path = "../profiles" }

View file

@ -1,15 +1,9 @@
#![allow(dead_code)]
#[macro_use]
extern crate serde_derive;
use std::env;
use structopt::clap::Shell;
use structopt::StructOpt;
use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
include!("src/opt/ssh_authorizedkeys.rs");
@ -17,9 +11,9 @@ include!("src/opt/cache_invalidate.rs");
include!("src/opt/cache_clear.rs");
include!("src/opt/unixd_status.rs");
include!("../profiles/syntax.rs");
fn main() {
profiles::apply_profile();
let outdir = match env::var_os("OUT_DIR") {
None => return,
Some(outdir) => outdir,
@ -62,32 +56,4 @@ fn main() {
UnixdStatusOpt::clap().gen_completions("kanidm_unixd_status", Shell::Bash, comp_dir.clone());
UnixdStatusOpt::clap().gen_completions("kanidm_unixd_status", Shell::Zsh, comp_dir);
println!("cargo:rerun-if-env-changed=KANIDM_BUILD_PROFILE");
let profile = env::var("KANIDM_BUILD_PROFILE").unwrap_or_else(|_| "developer".to_string());
let profile_path: PathBuf = ["../profiles", format!("{}.toml", profile).as_str()]
.iter()
.collect();
println!("cargo:rerun-if-changed={}", profile_path.to_str().unwrap());
let mut f = File::open(&profile_path)
.unwrap_or_else(|_| panic!("Failed to open build profile {:?}", profile_path));
let mut contents = String::new();
f.read_to_string(&mut contents)
.unwrap_or_else(|_| panic!("Failed to read build profile {:?}", profile_path));
let profile_cfg: ProfileConfig = toml::from_str(contents.as_str())
.unwrap_or_else(|_| panic!("Failed to parse build profile {:?}", profile_path));
match profile_cfg.cpu_flags {
CpuOptLevel::none => {}
CpuOptLevel::native => println!("cargo:rustc-env=RUSTFLAGS=-Ctarget-cpu=native"),
CpuOptLevel::x86_64_v1 => println!("cargo:rustc-env=RUSTFLAGS=-Ctarget-feature=+cmov,+cx8,+fxsr,+mmx,+sse,+sse2"),
CpuOptLevel::x86_64_v3 => println!("cargo:rustc-env=RUSTFLAGS=-Ctarget-feature=+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+cx16,+sahf,+popcnt,+sse3,+sse4.1,+sse4.2,+avx,+avx2,+bmi,+bmi2,+f16c,+fma,+lzcnt,+movbe,+xsave"),
}
println!("cargo:rustc-env=KANIDM_PROFILE_NAME={}", profile);
println!("cargo:rustc-env=KANIDM_CPU_FLAGS={}", profile_cfg.cpu_flags);
}

View file

@ -2,7 +2,7 @@
name = "nss_kanidm"
version = "1.1.0-alpha.7"
authors = ["William Brown <william@blackhats.net.au>"]
edition = "2018"
edition = "2021"
[lib]
name = "nss_kanidm"

View file

@ -1,5 +1,7 @@
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]

View file

@ -2,7 +2,7 @@
name = "pam_kanidm"
version = "1.1.0-alpha.7"
authors = ["William Brown <william@blackhats.net.au>"]
edition = "2018"
edition = "2021"
[lib]
name = "pam_kanidm"

View file

@ -1,5 +1,7 @@
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
// In this file, we do want to panic on these faults.
// #![deny(clippy::unwrap_used)]
// #![deny(clippy::expect_used)]

View file

@ -2,7 +2,7 @@
name = "pam_tester"
version = "0.1.2"
authors = ["William Brown <william@blackhats.net.au>"]
edition = "2018"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -1,5 +1,7 @@
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]

View file

@ -1,5 +1,7 @@
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]

View file

@ -1,5 +1,7 @@
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]

View file

@ -1,5 +1,7 @@
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]

View file

@ -1,5 +1,7 @@
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]

View file

@ -1,5 +1,7 @@
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]

View file

@ -1,5 +1,7 @@
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]

View file

@ -4,8 +4,8 @@ use std::thread;
use std::time::Duration;
use kanidm::audit::LogLevel;
use kanidm::config::{Configuration, IntegrationTestConfig};
use kanidm::core::create_server_core;
use kanidm::config::{Configuration, IntegrationTestConfig, ServerRole};
use score::create_server_core;
use kanidm::tracing_tree;
use kanidm_unix_common::cache::{CacheLayer, Id};
@ -66,6 +66,7 @@ fn run_test(fix_fn: fn(&KanidmClient) -> (), test_fn: fn(CacheLayer, KanidmAsync
config.secure_cookies = false;
config.integration_test_config = Some(int_config);
config.log_level = Some(LogLevel::Quiet as u32);
config.role = ServerRole::WriteReplicaNoUI;
// config.log_level = Some(LogLevel::Verbose as u32);
config.threads = 1;

View file

@ -2,7 +2,7 @@
name = "kanidm"
version = "1.1.0-alpha.7"
authors = ["William Brown <william@blackhats.net.au>"]
edition = "2018"
edition = "2021"
license = "MPL-2.0"
description = "Kanidm Server Library and Binary"
documentation = "https://docs.rs/kanidm/latest/kanidm/"
@ -13,10 +13,6 @@ repository = "https://github.com/kanidm/kanidm/"
name = "kanidm"
path = "src/lib/lib.rs"
[[bin]]
name = "kanidmd"
path = "src/server/main.rs"
[dependencies]
kanidm_proto = { path = "../kanidm_proto", version = "1.1.0-alpha" }
tracing = { version = "0.1", features = ["attributes"] }
@ -28,7 +24,6 @@ either = "1.6"
url = { version = "2", features = ["serde"] }
tide = "0.16"
tide-openssl = "^0.1.1"
async-trait = "0.1"
async-h1 = "2.0"
fernet = { version = "^0.1.4", features = ["fernet_danger_timestamps"] }
@ -49,7 +44,6 @@ futures = "0.3"
futures-util = "0.3"
tokio = { version = "1", features = ["full"] }
tokio-util = { version = "0.6", features = ["codec"] }
tokio-openssl = "0.6"
openssl = "0.10"
uuid = { version = "0.8", features = ["serde", "v4" ] }
@ -63,7 +57,6 @@ rusqlite = { version = "0.26", features = ["backup"] }
r2d2 = "0.8"
r2d2_sqlite = "0.19"
structopt = { version = "0.3", default-features = false }
time = { version = "0.2", features = ["serde", "std"] }
hashbrown = { version = "0.11", features = ["serde", "inline-more", "ahash"] }
@ -107,12 +100,7 @@ criterion = { version = "0.3", features = ["html_reports"] }
webauthn-authenticator-rs = "0.3.0-alpha.12"
[build-dependencies]
structopt = { version = "0.3", default-features = false }
serde = "1.0"
serde_derive = "1.0"
toml = "0.5"
rustc_version = "0.4.0"
profiles = { path = "../profiles" }
[[bench]]
name = "scaling_10k"

View file

@ -18,7 +18,7 @@ RUN zypper ar obs://devel:languages:rust devel:languages:rust && \
zypper clean -a
COPY . /usr/src/kanidm
WORKDIR /usr/src/kanidm/kanidmd
WORKDIR /usr/src/kanidm/kanidmd/daemon
ARG SCCACHE_REDIS
ARG KANIDM_FEATURES

View file

@ -1,95 +1,5 @@
#![allow(dead_code)]
#[macro_use]
extern crate serde_derive;
use std::env;
use std::fs::{read_to_string, File};
use std::io::Read;
use std::path::PathBuf;
use structopt::clap::Shell;
use structopt::StructOpt;
use rustc_version::{version, Version};
include!("src/lib/audit_loglevel.rs");
include!("src/server/opt.rs");
include!("../profiles/syntax.rs");
// include!("src/lib/audit_loglevel.rs");
fn main() {
// check to see if the rust version matches the rust minimum version we require for this build
let rust_minver = match read_to_string("../RUST_MSRV") {
Ok(value) => value,
Err(error) => panic!("Couldn't load RUST_MSRV: {:?}", error),
};
let required_rust_ver = Version::parse(&rust_minver.replace("\n", "")).unwrap();
println!("Rust version: {}", version().unwrap());
println!("Required version: {}", required_rust_ver);
if version().unwrap() <= required_rust_ver {
panic!("This crate requires rustc >= {}, quitting.", rust_minver);
}
let outdir = match env::var_os("OUT_DIR") {
None => return,
Some(outdir) => outdir,
};
// Will be the form /Volumes/ramdisk/rs/debug/build/kanidm-8aadc4b0821e9fe7/out
// We want to get to /Volumes/ramdisk/rs/debug/completions
let comp_dir = PathBuf::from(outdir)
.ancestors()
.nth(2)
.map(|p| p.join("completions"))
.expect("Unable to process completions path");
if !comp_dir.exists() {
std::fs::create_dir(&comp_dir).expect("Unable to create completions dir");
}
KanidmdOpt::clap().gen_completions("kanidmd", Shell::Bash, comp_dir.clone());
KanidmdOpt::clap().gen_completions("kanidmd", Shell::Zsh, comp_dir);
// transform any requested paths for our server. We do this by reading
// our profile that we have been provided.
println!("cargo:rerun-if-env-changed=KANIDM_BUILD_PROFILE");
let profile = env::var("KANIDM_BUILD_PROFILE").unwrap_or_else(|_| "developer".to_string());
let profile_path: PathBuf = ["../profiles", format!("{}.toml", profile).as_str()]
.iter()
.collect();
println!("cargo:rerun-if-changed={}", profile_path.to_str().unwrap());
let mut f =
File::open(&profile_path).unwrap_or_else(|_| panic!("Failed to open {:?}", profile_path));
let mut contents = String::new();
f.read_to_string(&mut contents)
.unwrap_or_else(|_| panic!("Failed to read {:?}", profile_path));
let profile_cfg: ProfileConfig = toml::from_str(contents.as_str())
.unwrap_or_else(|_| panic!("Failed to parse {:?}", profile_path));
/*
* x86-64: CMOV, CMPXCHG8B, FPU, FXSR, MMX, FXSR, SCE, SSE, SSE2
* x86-64-v2: (close to Nehalem) CMPXCHG16B, LAHF-SAHF, POPCNT, SSE3, SSE4.1, SSE4.2, SSSE3
* x86-64-v3: (close to Haswell) AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE
*/
match profile_cfg.cpu_flags {
CpuOptLevel::none => {}
CpuOptLevel::native => println!("cargo:rustc-env=RUSTFLAGS=-Ctarget-cpu=native"),
CpuOptLevel::x86_64_v1 => println!("cargo:rustc-env=RUSTFLAGS=-Ctarget-feature=+cmov,+cx8,+fxsr,+mmx,+sse,+sse2"),
CpuOptLevel::x86_64_v3 => println!("cargo:rustc-env=RUSTFLAGS=-Ctarget-feature=+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+cx16,+sahf,+popcnt,+sse3,+sse4.1,+sse4.2,+avx,+avx2,+bmi,+bmi2,+f16c,+fma,+lzcnt,+movbe,+xsave"),
}
println!("cargo:rustc-env=KANIDM_PROFILE_NAME={}", profile);
println!("cargo:rustc-env=KANIDM_CPU_FLAGS={}", profile_cfg.cpu_flags);
println!(
"cargo:rustc-env=KANIDM_WEB_UI_PKG_PATH={}",
profile_cfg.web_ui_pkg_path
);
profiles::apply_profile();
}

30
kanidmd/daemon/Cargo.toml Normal file
View file

@ -0,0 +1,30 @@
[package]
name = "daemon"
version = "0.1.0"
authors = ["William Brown <william@blackhats.net.au>"]
edition = "2021"
license = "MPL-2.0"
description = "Kanidm Server Daemon"
documentation = "https://docs.rs/kanidm/latest/kanidm/"
homepage = "https://github.com/kanidm/kanidm/"
repository = "https://github.com/kanidm/kanidm/"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
name = "kanidmd"
path = "src/main.rs"
[dependencies]
kanidm = { path = "../" }
score = { path = "../score" }
structopt = { version = "0.3", default-features = false }
users = "0.11"
serde = { version = "1", features = ["derive"] }
tokio = { version = "1", features = ["full"] }
toml = "0.5"
[build-dependencies]
serde = { version = "1", features = ["derive"] }
structopt = { version = "0.3", default-features = false }
profiles = { path = "../../profiles" }

36
kanidmd/daemon/build.rs Normal file
View file

@ -0,0 +1,36 @@
#![allow(dead_code)]
use std::env;
use std::path::PathBuf;
use structopt::clap::Shell;
use structopt::StructOpt;
use serde::{Deserialize, Serialize};
include!("../src/lib/audit_loglevel.rs");
include!("src/opt.rs");
fn main() {
profiles::apply_profile();
let outdir = match env::var_os("OUT_DIR") {
None => return,
Some(outdir) => outdir,
};
// Will be the form /Volumes/ramdisk/rs/debug/build/kanidm-8aadc4b0821e9fe7/out
// We want to get to /Volumes/ramdisk/rs/debug/completions
let comp_dir = PathBuf::from(outdir)
.ancestors()
.nth(2)
.map(|p| p.join("completions"))
.expect("Unable to process completions path");
if !comp_dir.exists() {
std::fs::create_dir(&comp_dir).expect("Unable to create completions dir");
}
KanidmdOpt::clap().gen_completions("kanidmd", Shell::Bash, comp_dir.clone());
KanidmdOpt::clap().gen_completions("kanidmd", Shell::Zsh, comp_dir);
}

View file

@ -1,5 +1,7 @@
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]
@ -27,14 +29,14 @@ use std::str::FromStr;
use kanidm::audit::LogLevel;
use kanidm::config::{Configuration, OnlineBackup, ServerRole};
use kanidm::core::{
use kanidm::tracing_tree;
use kanidm::utils::file_permissions_readonly;
use score::{
backup_server_core, create_server_core, dbscan_get_id2entry_core, dbscan_list_id2entry_core,
dbscan_list_index_analysis_core, dbscan_list_index_core, dbscan_list_indexes_core,
domain_rename_core, recover_account_core, reindex_server_core, restore_server_core,
vacuum_server_core, verify_server_core,
};
use kanidm::tracing_tree;
use kanidm::utils::file_permissions_readonly;
use structopt::StructOpt;

39
kanidmd/score/Cargo.toml Normal file
View file

@ -0,0 +1,39 @@
[package]
name = "score"
version = "0.1.0"
authors = ["William Brown <william@blackhats.net.au>"]
edition = "2021"
license = "MPL-2.0"
description = "Kanidm Server Library and Binary"
documentation = "https://docs.rs/kanidm/latest/kanidm/"
homepage = "https://github.com/kanidm/kanidm/"
repository = "https://github.com/kanidm/kanidm/"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
kanidm = { path = "../" }
kanidm_proto = { path = "../../kanidm_proto" }
libc = "0.2"
uuid = { version = "0.8", features = ["serde", "v4" ] }
tide = "0.16"
tide-openssl = "^0.1.1"
futures-util = "0.3"
tokio = { version = "1", features = ["full"] }
tokio-util = { version = "0.6", features = ["codec"] }
tokio-openssl = "0.6"
openssl = "0.10"
ldap3_server = "0.1"
bundy = "^0.1.1"
tracing = { version = "0.1", features = ["attributes"] }
serde = { version = "1", features = ["derive"] }
async-trait = "0.1"
async-std = { version = "1.6", features = ["tokio1"] }
[build-dependencies]
profiles = { path = "../../profiles" }

3
kanidmd/score/build.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
profiles::apply_profile();
}

View file

@ -4,11 +4,11 @@ mod v1;
use self::oauth2::*;
use self::v1::*;
use crate::actors::v1_read::QueryServerReadV1;
use crate::actors::v1_write::QueryServerWriteV1;
use crate::config::{ServerRole, TlsConfiguration};
use crate::prelude::*;
use crate::status::StatusActor;
use kanidm::actors::v1_read::QueryServerReadV1;
use kanidm::actors::v1_write::QueryServerWriteV1;
use kanidm::config::{ServerRole, TlsConfiguration};
use kanidm::prelude::*;
use kanidm::status::StatusActor;
use serde::Serialize;
use std::path::PathBuf;
@ -17,7 +17,7 @@ use uuid::Uuid;
use tide_openssl::TlsListener;
use crate::tracing_tree::TreeMiddleware;
use kanidm::tracing_tree::TreeMiddleware;
use tracing::{error, info};
#[derive(Clone)]
@ -92,7 +92,7 @@ impl RequestExtensions for tide::Request<AppState> {
}
fn new_eventid(&self) -> (Uuid, String) {
let eventid = Uuid::new_v4();
let eventid = kanidm::tracing_tree::operation_id().unwrap();
let hv = eventid.to_hyphenated().to_string();
(eventid, hv)
}

View file

@ -1,10 +1,10 @@
use super::v1::{json_rest_event_get, json_rest_event_post};
use super::{to_tide_response, AppState, RequestExtensions};
use crate::idm::oauth2::{
use kanidm::idm::oauth2::{
AccessTokenIntrospectRequest, AccessTokenRequest, AuthorisationRequest, AuthorisePermitSuccess,
ErrorResponse, Oauth2Error,
};
use crate::prelude::*;
use kanidm::prelude::*;
use kanidm_proto::v1::Entry as ProtoEntry;
use serde::{Deserialize, Serialize};

View file

@ -1,8 +1,8 @@
use crate::event::AuthResult;
use crate::filter::{Filter, FilterInvalid};
use crate::idm::AuthState;
use crate::prelude::*;
use crate::status::StatusRequestEvent;
use kanidm::event::AuthResult;
use kanidm::filter::{Filter, FilterInvalid};
use kanidm::idm::AuthState;
use kanidm::prelude::*;
use kanidm::status::StatusRequestEvent;
use kanidm_proto::v1::Entry as ProtoEntry;
use kanidm_proto::v1::{

View file

@ -1,20 +1,19 @@
use crate::actors::v1_read::QueryServerReadV1;
use crate::ldap::{LdapBoundToken, LdapResponseState};
use crate::prelude::*;
use core::pin::Pin;
use kanidm::actors::v1_read::QueryServerReadV1;
use kanidm::ldap::{LdapBoundToken, LdapResponseState};
use kanidm::prelude::*;
use openssl::ssl::{Ssl, SslAcceptor, SslAcceptorBuilder};
use std::pin::Pin;
use tokio_openssl::SslStream;
use futures_util::sink::SinkExt;
use futures_util::stream::StreamExt;
use ldap3_server::LdapCodec;
use ldap3_server::{proto::LdapMsg, LdapCodec};
use std::marker::Unpin;
use std::net;
use std::str::FromStr;
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::net::TcpListener;
use tokio_util::codec::{FramedRead, FramedWrite};
use uuid::Uuid;
struct LdapSession {
uat: Option<LdapBoundToken>,
@ -29,6 +28,22 @@ impl LdapSession {
}
}
#[instrument(name = "ldap-request", skip(client_address, qe_r_ref))]
async fn client_process_msg(
uat: Option<LdapBoundToken>,
client_address: net::SocketAddr,
protomsg: LdapMsg,
qe_r_ref: &'static QueryServerReadV1,
) -> Option<LdapResponseState> {
let eventid = kanidm::tracing_tree::operation_id().unwrap();
security_info!(
client_ip = %client_address.ip(),
client_port = %client_address.port(),
"LDAP client"
);
qe_r_ref.handle_ldaprequest(eventid, protomsg, uat).await
}
async fn client_process<W: AsyncWrite + Unpin, R: AsyncRead + Unpin>(
mut r: FramedRead<R, LdapCodec>,
mut w: FramedWrite<W, LdapCodec>,
@ -40,17 +55,12 @@ async fn client_process<W: AsyncWrite + Unpin, R: AsyncRead + Unpin>(
// Now that we have the session we begin an event loop to process input OR we return.
while let Some(Ok(protomsg)) = r.next().await {
// Start the event
let eventid = Uuid::new_v4();
let uat = session.uat.clone();
// I'd really have liked to have put this near the [LdapResponseState::Bind] but due to the handing of `audit` it isn't possible due to borrows, etc.
security_info!(
client_ip = %client_address.ip(),
client_port = %client_address.port(),
"LDAP client"
);
let qs_result = qe_r_ref.handle_ldaprequest(eventid, protomsg, uat).await;
let caddr = client_address.clone();
match qs_result {
match client_process_msg(uat, caddr, protomsg, qe_r_ref).await {
// I'd really have liked to have put this near the [LdapResponseState::Bind] but due
// to the handing of `audit` it isn't possible due to borrows, etc.
Some(LdapResponseState::Unbind) => return,
Some(LdapResponseState::Disconnect(rmsg)) => {
if w.send(rmsg).await.is_err() {

View file

@ -8,28 +8,45 @@
//! the entry point for all client traffic which is then directed to the
//! various `actors`.
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]
#![deny(clippy::unreachable)]
#![deny(clippy::await_holding_lock)]
#![deny(clippy::needless_pass_by_value)]
#![deny(clippy::trivially_copy_pass_by_ref)]
#[macro_use]
extern crate tracing;
#[macro_use]
extern crate kanidm;
mod https;
mod ldaps;
use libc::umask;
// use crossbeam::channel::unbounded;
use crate::prelude::*;
use kanidm::prelude::*;
use std::sync::Arc;
use crate::config::Configuration;
use kanidm::config::Configuration;
// SearchResult
// use self::ctx::ServerCtx;
use crate::actors::v1_read::QueryServerReadV1;
use crate::actors::v1_write::QueryServerWriteV1;
use crate::be::{Backend, BackendConfig, BackendTransaction, FsType};
use crate::crypto::setup_tls;
use crate::idm::server::{IdmServer, IdmServerDelayed};
use crate::interval::IntervalActor;
use crate::ldap::LdapServer;
use crate::schema::Schema;
use crate::status::StatusActor;
use crate::utils::{duration_from_epoch_now, touch_file_or_quit};
use kanidm::actors::v1_read::QueryServerReadV1;
use kanidm::actors::v1_write::QueryServerWriteV1;
use kanidm::be::{Backend, BackendConfig, BackendTransaction, FsType};
use kanidm::crypto::setup_tls;
use kanidm::idm::server::{IdmServer, IdmServerDelayed};
use kanidm::interval::IntervalActor;
use kanidm::ldap::LdapServer;
use kanidm::schema::Schema;
use kanidm::status::StatusActor;
use kanidm::utils::{duration_from_epoch_now, touch_file_or_quit};
use kanidm_proto::v1::OperationError;

View file

@ -31,8 +31,8 @@ use tracing::trace;
const DEFAULT_CACHE_TARGET: usize = 2048;
const DEFAULT_IDL_CACHE_RATIO: usize = 32;
const DEFAULT_NAME_CACHE_RATIO: usize = 8;
const DEFAULT_CACHE_RMISS: usize = 8;
const DEFAULT_CACHE_WMISS: usize = 8;
const DEFAULT_CACHE_RMISS: usize = 0;
const DEFAULT_CACHE_WMISS: usize = 4;
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
enum NameCacheKey {
@ -219,8 +219,9 @@ macro_rules! name2uuid {
let cache_key = NameCacheKey::Name2Uuid($name.to_string());
let cache_r = $self.name_cache.get(&cache_key);
if let Some(NameCacheValue::U(uuid)) = cache_r {
trace!("Got cached uuid for name2uuid");
return Ok(Some(uuid.clone()));
} else {
trace!("Cache miss uuid for name2uuid");
}
let db_r = $self.db.name2uuid($name)?;
@ -243,8 +244,9 @@ macro_rules! uuid2spn {
let cache_key = NameCacheKey::Uuid2Spn(*$uuid);
let cache_r = $self.name_cache.get(&cache_key);
if let Some(NameCacheValue::S(ref spn)) = cache_r {
trace!("Got cached spn for uuid2spn");
return Ok(Some(spn.as_ref().clone()));
} else {
trace!("Cache miss spn for uuid2spn");
}
let db_r = $self.db.uuid2spn($uuid)?;
@ -267,8 +269,9 @@ macro_rules! uuid2rdn {
let cache_key = NameCacheKey::Uuid2Rdn(*$uuid);
let cache_r = $self.name_cache.get(&cache_key);
if let Some(NameCacheValue::R(ref rdn)) = cache_r {
trace!("Got cached rdn for uuid2rdn");
return Ok(Some(rdn.clone()));
} else {
trace!("Cache miss rdn for uuid2rdn");
}
let db_r = $self.db.uuid2rdn($uuid)?;
@ -763,7 +766,7 @@ impl<'a> IdlArcSqliteWriteTransaction<'a> {
if let Some(lens) = data.get_mut(&kref as &dyn IdxKeyToRef) {
lens.push(idl_len)
} else {
data.insert(kref.to_key(), vec![idl_len]);
data.insert(kref.as_key(), vec![idl_len]);
}
}
}

View file

@ -34,7 +34,7 @@ impl<'a> IdxKeyRef<'a> {
IdxKeyRef { attr, itype }
}
pub fn to_key(&self) -> IdxKey {
pub fn as_key(&self) -> IdxKey {
IdxKey {
attr: self.attr.into(),
itype: self.itype.clone(),

View file

@ -1575,8 +1575,8 @@ mod tests {
};
use super::{DbEntry, IdxKey};
use crate::identity::Limits;
use crate::prelude::*;
use crate::value::{IndexType, PartialValue, Value};
use smartstring::alias::String as AttrString;
macro_rules! run_test {
($test_fn:expr) => {{
@ -2348,10 +2348,9 @@ mod tests {
}
// Test that a fully indexed search works
let f_eq =
unsafe { filter_resolved!(f_eq("name", PartialValue::new_utf8s("william"))) };
let feq = unsafe { filter_resolved!(f_eq("name", PartialValue::new_utf8s("william"))) };
let (r, _plan) = be.filter2idl(f_eq.to_inner(), 0).unwrap();
let (r, _plan) = be.filter2idl(feq.to_inner(), 0).unwrap();
match r {
IdList::Indexed(idl) => {
assert!(idl == IDLBitRange::from_iter(vec![1]));

View file

@ -289,12 +289,12 @@ pub enum CredentialType {
// PasswordWebauthnVerified(Password, Map<String, WebauthnCredential>),
}
impl Into<CredentialDetail> for &Credential {
fn into(self) -> CredentialDetail {
impl From<&Credential> for CredentialDetail {
fn from(value: &Credential) -> Self {
CredentialDetail {
uuid: self.uuid,
claims: self.claims.clone(),
type_: match &self.type_ {
uuid: value.uuid,
claims: value.claims.clone(),
type_: match &value.type_ {
CredentialType::Password(_) => CredentialDetailType::Password,
CredentialType::GeneratedPassword(_) => CredentialDetailType::GeneratedPassword,
CredentialType::Webauthn(wan) => {

View file

@ -9,7 +9,7 @@ pub(crate) mod delayed;
pub(crate) mod event;
pub(crate) mod group;
pub(crate) mod mfareg;
pub(crate) mod oauth2;
pub mod oauth2;
pub(crate) mod radius;
pub mod server;
pub(crate) mod unix;

View file

@ -827,7 +827,7 @@ impl Oauth2ResourceServersReadTransaction {
let (email, email_verified) = if scope_set.contains("email") {
if let Some(mp) = code_xchg.uat.mail_primary {
(Some(mp.to_string()), Some(true))
(Some(mp), Some(true))
} else {
(None, None)
}
@ -1057,7 +1057,7 @@ impl Oauth2ResourceServersReadTransaction {
let (email, email_verified) = if at.scopes.contains(&"email".to_string()) {
if let Some(mp) = account.mail_primary {
(Some(mp.to_string()), Some(true))
(Some(mp), Some(true))
} else {
(None, None)
}
@ -1238,7 +1238,6 @@ mod tests {
use crate::prelude::*;
use crate::event::ModifyEvent;
use crate::modify::{Modify, ModifyList};
use kanidm_proto::oauth2::*;
use kanidm_proto::v1::{AuthType, UserAuthToken};

View file

@ -334,7 +334,7 @@ impl IdmServerDelayed {
}
}
pub(crate) async fn process_all(&mut self, server: &'static QueryServerWriteV1) {
pub async fn process_all(&mut self, server: &'static QueryServerWriteV1) {
loop {
match self.async_rx.recv().await {
// process it.

View file

@ -529,7 +529,6 @@ mod tests {
use crate::event::{CreateEvent, ModifyEvent};
use crate::idm::event::UnixPasswordChangeEvent;
use crate::ldap::LdapServer;
use crate::modify::{Modify, ModifyList};
use async_std::task;
use hashbrown::HashSet;
use ldap3_server::proto::{LdapFilter, LdapOp, LdapSearchScope};

View file

@ -29,7 +29,7 @@ extern crate lazy_static;
#[macro_use]
pub mod macros;
mod crypto;
pub mod crypto;
pub mod utils;
#[macro_use]
pub mod audit;
@ -40,23 +40,22 @@ pub mod entry;
pub mod event;
pub mod filter;
pub mod identity;
mod interval;
pub(crate) mod ldap;
pub mod interval;
pub mod ldap;
mod modify;
pub(crate) mod value;
pub(crate) mod valueset;
#[macro_use]
mod plugins;
mod access;
mod actors;
pub mod actors;
pub mod idm;
mod repl;
mod schema;
pub mod schema;
pub mod server;
mod status;
pub mod status;
pub mod config;
pub mod core;
/// A prelude of imports that should be imported by all other Kanidm modules to
/// help make imports cleaner.
@ -67,8 +66,16 @@ pub mod prelude {
pub use url::Url;
pub use uuid::Uuid;
pub use crate::tagged_event;
pub use crate::tracing_tree::EventTag;
pub use crate::constants::*;
pub use crate::filter::{Filter, FilterInvalid};
pub use crate::filter::{
f_and, f_andnot, f_eq, f_id, f_inc, f_lt, f_or, f_pres, f_self, f_spn_name, f_sub,
};
pub use crate::filter::{Filter, FilterInvalid, FC};
pub use crate::modify::{m_pres, m_purge, m_remove};
pub use crate::modify::{Modify, ModifyList};
pub use crate::entry::{
Entry, EntryCommitted, EntryInit, EntryInvalid, EntryInvalidCommitted, EntryNew,

View file

@ -1,7 +1,5 @@
macro_rules! setup_test {
() => {{
use crate::utils::duration_from_epoch_now;
/*
use env_logger;
::std::env::set_var("RUST_LOG", "actix_web=debug,kanidm=debug");
@ -219,8 +217,8 @@ where
}
// Test helpers for all plugins.
// #[macro_export]
#[cfg(test)]
#[macro_export]
macro_rules! run_create_test {
(
$expect:expr,
@ -269,8 +267,8 @@ macro_rules! run_create_test {
}};
}
// #[macro_export]
#[cfg(test)]
#[macro_export]
macro_rules! run_modify_test {
(
$expect:expr,
@ -323,8 +321,8 @@ macro_rules! run_modify_test {
}};
}
// #[macro_export]
#[cfg(test)]
#[macro_export]
macro_rules! run_delete_test {
(
$expect:expr,
@ -379,9 +377,6 @@ macro_rules! modlist {
(
$vs:expr
) => {{
#[allow(unused_imports)]
use crate::modify::{m_pres, m_purge, m_remove};
use crate::modify::{Modify, ModifyList};
let s: Box<[Modify]> = Box::new($vs);
ModifyList::new_list(s.into_vec())
}};
@ -393,7 +388,6 @@ macro_rules! f_and {
(
$vs:expr
) => {{
use crate::filter::FC;
let s: Box<[FC]> = Box::new($vs);
f_and(s.into_vec())
}};
@ -405,7 +399,6 @@ macro_rules! f_inc {
(
$vs:expr
) => {{
use crate::filter::FC;
let s: Box<[FC]> = Box::new($vs);
f_inc(s.into_vec())
}};
@ -417,7 +410,6 @@ macro_rules! f_or {
(
$vs:expr
) => {{
use crate::filter::FC;
let s: Box<[FC]> = Box::new($vs);
f_or(s.into_vec())
}};
@ -429,13 +421,6 @@ macro_rules! filter {
(
$fc:expr
) => {{
use crate::filter::Filter;
#[allow(unused_imports)]
use crate::filter::FC;
#[allow(unused_imports)]
use crate::filter::{
f_and, f_andnot, f_eq, f_id, f_inc, f_lt, f_or, f_pres, f_self, f_spn_name, f_sub,
};
Filter::new_ignore_hidden($fc)
}};
}
@ -446,13 +431,6 @@ macro_rules! filter_rec {
(
$fc:expr
) => {{
use crate::filter::Filter;
#[allow(unused_imports)]
use crate::filter::FC;
#[allow(unused_imports)]
use crate::filter::{
f_and, f_andnot, f_eq, f_id, f_inc, f_lt, f_or, f_pres, f_self, f_sub,
};
Filter::new_recycled($fc)
}};
}
@ -463,13 +441,6 @@ macro_rules! filter_all {
(
$fc:expr
) => {{
use crate::filter::Filter;
#[allow(unused_imports)]
use crate::filter::FC;
#[allow(unused_imports)]
use crate::filter::{
f_and, f_andnot, f_eq, f_id, f_inc, f_lt, f_or, f_pres, f_self, f_sub,
};
Filter::new($fc)
}};
}
@ -481,9 +452,6 @@ macro_rules! filter_valid {
(
$fc:expr
) => {{
#[allow(unused_imports)]
use crate::filter::{f_and, f_andnot, f_eq, f_inc, f_lt, f_or, f_pres, f_sub};
use crate::filter::{Filter, FilterInvalid};
let f: Filter<FilterInvalid> = Filter::new($fc);
// Create a resolved filter, via the most unsafe means possible!
f.into_valid()
@ -497,9 +465,6 @@ macro_rules! filter_resolved {
(
$fc:expr
) => {{
#[allow(unused_imports)]
use crate::filter::{f_and, f_andnot, f_eq, f_inc, f_lt, f_or, f_pres, f_sub};
use crate::filter::{Filter, FilterInvalid};
let f: Filter<FilterInvalid> = Filter::new($fc);
// Create a resolved filter, via the most unsafe means possible!
f.into_valid_resolved()
@ -513,7 +478,6 @@ macro_rules! pvalue_utf8 {
(
$v:expr
) => {{
use crate::value::PartialValue;
PartialValue::new_utf8(v.to_string())
}};
}
@ -525,7 +489,6 @@ macro_rules! pvalue_iutf8 {
(
$v:expr
) => {{
use crate::value::PartialValue;
PartialValue::new_iutf8(v.to_string())
}};
}
@ -614,14 +577,12 @@ macro_rules! valueset {
compile_error!("ValueSet needs at least 1 element")
);
($e:expr) => ({
use crate::valueset::ValueSet;
ValueSet::new($e)
});
($e:expr,) => ({
valueset!($e)
});
($e:expr, $($item:expr),*) => ({
use crate::valueset::ValueSet;
let mut x: ValueSet = ValueSet::new($e);
$(assert!(x.insert($item));)*
x

View file

@ -234,4 +234,8 @@ impl<VALID> ModifyList<VALID> {
pub fn len(&self) -> usize {
self.mods.len()
}
pub fn is_empty(&self) -> bool {
self.len() == 0
}
}

View file

@ -188,7 +188,6 @@ impl Plugin for AttrUnique {
#[cfg(test)]
mod tests {
use crate::modify::{Modify, ModifyList};
use crate::prelude::*;
use kanidm_proto::v1::PluginError;

View file

@ -225,7 +225,6 @@ impl Plugin for Base {
#[cfg(test)]
mod tests {
use crate::modify::{Modify, ModifyList};
use crate::prelude::*;
use kanidm_proto::v1::PluginError;

View file

@ -395,7 +395,6 @@ impl Plugin for MemberOf {
#[cfg(test)]
mod tests {
use crate::modify::{Modify, ModifyList};
use crate::prelude::*;
const UUID_A: &'static str = "aaaaaaaa-f82e-4484-a407-181aa03bda5c";

View file

@ -80,7 +80,6 @@ impl Plugin for Oauth2Secrets {
#[cfg(test)]
mod tests {
use crate::modify::{Modify, ModifyList};
use crate::prelude::*;
#[test]

View file

@ -118,7 +118,6 @@ mod tests {
use crate::credential::policy::CryptoPolicy;
use crate::credential::totp::{Totp, TOTP_DEFAULT_STEP};
use crate::credential::{Credential, CredentialType};
use crate::modify::{Modify, ModifyList};
use crate::prelude::*;
const IMPORT_HASH: &'static str =

View file

@ -261,7 +261,6 @@ impl Plugin for ReferentialIntegrity {
#[cfg(test)]
mod tests {
use crate::modify::{Modify, ModifyList};
use crate::prelude::*;
use kanidm_proto::v1::PluginError;

View file

@ -541,7 +541,7 @@ impl<'a> SchemaWriteTransaction<'a> {
r
}
pub(crate) fn reload_idxmeta(&self) -> Vec<IdxKey> {
pub fn reload_idxmeta(&self) -> Vec<IdxKey> {
self.get_attributes()
.values()
.flat_map(|a| {

View file

@ -1000,7 +1000,7 @@ impl QueryServer {
}
}
pub(crate) fn initialise_helper(&self, ts: Duration) -> Result<(), OperationError> {
pub fn initialise_helper(&self, ts: Duration) -> Result<(), OperationError> {
// First, check our database version - attempt to do an initial indexing
// based on the in memory configuration
//
@ -2306,13 +2306,7 @@ impl<'a> QueryServerWriteTransaction<'a> {
admin_error!("initialise_idm p1 -> result {:?}", res);
}
debug_assert!(res.is_ok());
if res.is_err() {
return res;
}
// Is the configured domain name matching what's in the domain_info?
//
let _ = res?;
// The domain info now exists, we should be able to do these migrations as they will
// cause SPN regenerations to occur
@ -2334,9 +2328,7 @@ impl<'a> QueryServerWriteTransaction<'a> {
admin_error!("initialise_idm p2 -> result {:?}", res);
}
debug_assert!(res.is_ok());
if res.is_err() {
return res;
}
let _ = res?;
// Create any system default schema entries.
@ -2424,9 +2416,7 @@ impl<'a> QueryServerWriteTransaction<'a> {
admin_error!(?res, "initialise_idm p3 -> result");
}
debug_assert!(res.is_ok());
if res.is_err() {
return res;
}
let _ = res?;
self.changed_schema.set(true);
self.changed_acp.set(true);
@ -2755,7 +2745,6 @@ mod tests {
use crate::credential::policy::CryptoPolicy;
use crate::credential::Credential;
use crate::event::{CreateEvent, DeleteEvent, ModifyEvent, ReviveRecycledEvent, SearchEvent};
use crate::modify::{Modify, ModifyList};
use crate::prelude::*;
use kanidm_proto::v1::SchemaError;
use std::sync::Arc;

View file

@ -18,7 +18,7 @@ macro_rules! spanned {
macro_rules! tagged_event {
($level:ident, $event_tag:path, $($arg:tt)*) => {{
use tracing;
fn assert_eventtag(_: &crate::tracing_tree::EventTag) {}
fn assert_eventtag(_: &EventTag) {}
assert_eventtag(&$event_tag);
let event_tag_id: u64 = $event_tag.into();
tracing::event!(tracing::Level::$level, event_tag_id, $($arg)*)
@ -27,80 +27,80 @@ macro_rules! tagged_event {
#[macro_export]
macro_rules! admin_error {
($($arg:tt)*) => { crate::tagged_event!(ERROR, crate::tracing_tree::EventTag::AdminError, $($arg)*) }
($($arg:tt)*) => { tagged_event!(ERROR, EventTag::AdminError, $($arg)*) }
}
#[macro_export]
macro_rules! admin_warn {
($($arg:tt)*) => { crate::tagged_event!(WARN, crate::tracing_tree::EventTag::AdminWarn, $($arg)*) }
($($arg:tt)*) => { tagged_event!(WARN, EventTag::AdminWarn, $($arg)*) }
}
#[macro_export]
macro_rules! admin_info {
($($arg:tt)*) => { crate::tagged_event!(INFO, crate::tracing_tree::EventTag::AdminInfo, $($arg)*) }
($($arg:tt)*) => { tagged_event!(INFO, EventTag::AdminInfo, $($arg)*) }
}
#[macro_export]
macro_rules! request_error {
($($arg:tt)*) => { crate::tagged_event!(ERROR, crate::tracing_tree::EventTag::RequestError, $($arg)*) }
($($arg:tt)*) => { tagged_event!(ERROR, EventTag::RequestError, $($arg)*) }
}
#[macro_export]
macro_rules! request_warn {
($($arg:tt)*) => { crate::tagged_event!(WARN, crate::tracing_tree::EventTag::RequestWarn, $($arg)*) }
($($arg:tt)*) => { tagged_event!(WARN, EventTag::RequestWarn, $($arg)*) }
}
#[macro_export]
macro_rules! request_info {
($($arg:tt)*) => { crate::tagged_event!(INFO, crate::tracing_tree::EventTag::RequestInfo, $($arg)*) }
($($arg:tt)*) => { tagged_event!(INFO, EventTag::RequestInfo, $($arg)*) }
}
#[macro_export]
macro_rules! request_trace {
($($arg:tt)*) => { crate::tagged_event!(TRACE, crate::tracing_tree::EventTag::RequestTrace, $($arg)*) }
($($arg:tt)*) => { tagged_event!(TRACE, EventTag::RequestTrace, $($arg)*) }
}
#[macro_export]
macro_rules! security_critical {
($($arg:tt)*) => { crate::tagged_event!(INFO, crate::tracing_tree::EventTag::SecurityCritical, $($arg)*) }
($($arg:tt)*) => { tagged_event!(INFO, EventTag::SecurityCritical, $($arg)*) }
}
#[macro_export]
macro_rules! security_error {
($($arg:tt)*) => { crate::tagged_event!(ERROR, crate::tracing_tree::EventTag::SecurityError, $($arg)*) }
($($arg:tt)*) => { tagged_event!(ERROR, EventTag::SecurityError, $($arg)*) }
}
#[macro_export]
macro_rules! security_info {
($($arg:tt)*) => { crate::tagged_event!(INFO, crate::tracing_tree::EventTag::SecurityInfo, $($arg)*) }
($($arg:tt)*) => { tagged_event!(INFO, EventTag::SecurityInfo, $($arg)*) }
}
#[macro_export]
macro_rules! security_access {
($($arg:tt)*) => { crate::tagged_event!(INFO, crate::tracing_tree::EventTag::SecurityAccess, $($arg)*) }
($($arg:tt)*) => { tagged_event!(INFO, EventTag::SecurityAccess, $($arg)*) }
}
#[macro_export]
macro_rules! filter_error {
($($arg:tt)*) => { crate::tagged_event!(ERROR, crate::tracing_tree::EventTag::FilterError, $($arg)*) }
($($arg:tt)*) => { tagged_event!(ERROR, EventTag::FilterError, $($arg)*) }
}
#[macro_export]
macro_rules! filter_warn {
($($arg:tt)*) => { crate::tagged_event!(WARN, crate::tracing_tree::EventTag::FilterWarn, $($arg)*) }
($($arg:tt)*) => { tagged_event!(WARN, EventTag::FilterWarn, $($arg)*) }
}
#[macro_export]
macro_rules! filter_info {
($($arg:tt)*) => { crate::tagged_event!(INFO, crate::tracing_tree::EventTag::FilterInfo, $($arg)*) }
($($arg:tt)*) => { tagged_event!(INFO, EventTag::FilterInfo, $($arg)*) }
}
#[macro_export]
macro_rules! filter_trace {
($($arg:tt)*) => { crate::tagged_event!(TRACE, crate::tracing_tree::EventTag::FilterTrace, $($arg)*) }
($($arg:tt)*) => { tagged_event!(TRACE, EventTag::FilterTrace, $($arg)*) }
}
#[macro_export]
macro_rules! perf_trace {
($($arg:tt)*) => { crate::tagged_event!(TRACE, crate::tracing_tree::EventTag::PerfTrace, $($arg)*) }
($($arg:tt)*) => { tagged_event!(TRACE, EventTag::PerfTrace, $($arg)*) }
}

View file

@ -58,7 +58,7 @@ impl TreeMiddleware {
let method = method.as_ref();
let path = path.as_str();
request_info!(
security_info!(
src = remote_address,
http.host = host,
http.method = method,

View file

@ -2,7 +2,7 @@
name = "kanidmd_web_ui"
version = "1.1.0-alpha.7"
authors = ["William Brown <william@blackhats.net.au>"]
edition = "2018"
edition = "2021"
license = "MPL-2.0"
description = "Kanidm Server Web User Interface"
documentation = "https://docs.rs/kanidm/latest/kanidm/"

View file

@ -1,6 +1,35 @@
let wasm;
const heap = new Array(32).fill(undefined);
heap.push(undefined, null, true, false);
function getObject(idx) { return heap[idx]; }
let heap_next = heap.length;
function dropObject(idx) {
if (idx < 36) return;
heap[idx] = heap_next;
heap_next = idx;
}
function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}
function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
heap_next = heap[idx];
heap[idx] = obj;
return idx;
}
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
@ -17,35 +46,6 @@ function getStringFromWasm0(ptr, len) {
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
}
const heap = new Array(32).fill(undefined);
heap.push(undefined, null, true, false);
let heap_next = heap.length;
function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
heap_next = heap[idx];
heap[idx] = obj;
return idx;
}
function getObject(idx) { return heap[idx]; }
function dropObject(idx) {
if (idx < 36) return;
heap[idx] = heap_next;
heap_next = idx;
}
function takeObject(idx) {
const ret = getObject(idx);
dropObject(idx);
return ret;
}
let WASM_VECTOR_LEN = 0;
let cachedTextEncoder = new TextEncoder('utf-8');
@ -220,7 +220,7 @@ function addBorrowedObject(obj) {
}
function __wbg_adapter_30(arg0, arg1, arg2) {
try {
wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hce11f961552fa4de(arg0, arg1, addBorrowedObject(arg2));
wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3b4ba9e1909dbf65(arg0, arg1, addBorrowedObject(arg2));
} finally {
heap[stack_pointer++] = undefined;
}
@ -248,17 +248,27 @@ function makeClosure(arg0, arg1, dtor, f) {
return real;
}
function __wbg_adapter_33(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h46eb76f8f067dd38(arg0, arg1, addHeapObject(arg2));
wasm._dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h693f07e57b7269a6(arg0, arg1, addHeapObject(arg2));
}
function __wbg_adapter_36(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0e88b99267006220(arg0, arg1, addHeapObject(arg2));
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h334d01558ab9ee3a(arg0, arg1, addHeapObject(arg2));
}
/**
*/
export function run_app() {
wasm.run_app();
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.run_app(retptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
let cachegetUint32Memory0 = null;
@ -324,10 +334,6 @@ async function init(input) {
}
const imports = {};
imports.wbg = {};
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
var ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};
@ -335,6 +341,10 @@ async function init(input) {
var ret = getObject(arg0);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
var ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
const obj = getObject(arg1);
var ret = typeof(obj) === 'string' ? obj : undefined;
@ -411,375 +421,375 @@ async function init(input) {
wasm.__wbindgen_free(arg0, arg1 * 4);
console.warn(...v0);
};
imports.wbg.__wbg_instanceof_Window_c4b70662a0d2c5ec = function(arg0) {
imports.wbg.__wbg_instanceof_Window_434ce1849eb4e0fc = function(arg0) {
var ret = getObject(arg0) instanceof Window;
return ret;
};
imports.wbg.__wbg_document_1c64944725c0d81d = function(arg0) {
imports.wbg.__wbg_document_5edd43643d1060d9 = function(arg0) {
var ret = getObject(arg0).document;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_location_f98ad02632f88c43 = function(arg0) {
imports.wbg.__wbg_location_11472bb76bf5bbca = function(arg0) {
var ret = getObject(arg0).location;
return addHeapObject(ret);
};
imports.wbg.__wbg_history_3ac8f1466e0c0528 = function() { return handleError(function (arg0) {
imports.wbg.__wbg_history_52cfc93c824e772b = function() { return handleError(function (arg0) {
var ret = getObject(arg0).history;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_navigator_480e592af6ad365b = function(arg0) {
imports.wbg.__wbg_navigator_0e0588c949560476 = function(arg0) {
var ret = getObject(arg0).navigator;
return addHeapObject(ret);
};
imports.wbg.__wbg_localStorage_6775414303ab5085 = function() { return handleError(function (arg0) {
imports.wbg.__wbg_localStorage_2b7091e6919605e2 = function() { return handleError(function (arg0) {
var ret = getObject(arg0).localStorage;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_sessionStorage_91431bb083105afe = function() { return handleError(function (arg0) {
imports.wbg.__wbg_sessionStorage_fdaffb6b65d0b064 = function() { return handleError(function (arg0) {
var ret = getObject(arg0).sessionStorage;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_fetch_cfe0d1dd786e9cd4 = function(arg0, arg1) {
imports.wbg.__wbg_fetch_427498e0ccea81f4 = function(arg0, arg1) {
var ret = getObject(arg0).fetch(getObject(arg1));
return addHeapObject(ret);
};
imports.wbg.__wbg_body_78ae4fd43b446013 = function(arg0) {
imports.wbg.__wbg_body_7538539844356c1c = function(arg0) {
var ret = getObject(arg0).body;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_createElement_86c152812a141a62 = function() { return handleError(function (arg0, arg1, arg2) {
imports.wbg.__wbg_createElement_d017b8d2af99bab9 = function() { return handleError(function (arg0, arg1, arg2) {
var ret = getObject(arg0).createElement(getStringFromWasm0(arg1, arg2));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_createElementNS_ae12b8681c3957a3 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
imports.wbg.__wbg_createElementNS_fd4a7e49f74039e1 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
var ret = getObject(arg0).createElementNS(arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_createTextNode_365db3bc3d0523ab = function(arg0, arg1, arg2) {
imports.wbg.__wbg_createTextNode_39a0de25d14bcde5 = function(arg0, arg1, arg2) {
var ret = getObject(arg0).createTextNode(getStringFromWasm0(arg1, arg2));
return addHeapObject(ret);
};
imports.wbg.__wbg_getElementById_f3e94458ce77f0d0 = function(arg0, arg1, arg2) {
imports.wbg.__wbg_getElementById_b30e88aff96f66a1 = function(arg0, arg1, arg2) {
var ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_querySelector_b92a6c73bcfe671b = function() { return handleError(function (arg0, arg1, arg2) {
imports.wbg.__wbg_querySelector_cc714d0aa0b868ed = function() { return handleError(function (arg0, arg1, arg2) {
var ret = getObject(arg0).querySelector(getStringFromWasm0(arg1, arg2));
return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_get_398540d826c14d7c = function() { return handleError(function (arg0, arg1, arg2, arg3) {
var ret = getObject(arg1).get(getStringFromWasm0(arg2, arg3));
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_set_5357fedb30848723 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}, arguments) };
imports.wbg.__wbg_pathname_3570d699aa5b91aa = function(arg0, arg1) {
var ret = getObject(arg1).pathname;
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_new_3f48783ae4f87f8f = function() { return handleError(function (arg0, arg1) {
var ret = new URL(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_value_686b2a68422cb88d = function(arg0, arg1) {
var ret = getObject(arg1).value;
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_setvalue_0a07023245efa3cc = function(arg0, arg1, arg2) {
getObject(arg0).value = getStringFromWasm0(arg1, arg2);
};
imports.wbg.__wbg_instanceof_Response_e1b11afbefa5b563 = function(arg0) {
var ret = getObject(arg0) instanceof Response;
return ret;
};
imports.wbg.__wbg_status_6d8bb444ddc5a7b2 = function(arg0) {
var ret = getObject(arg0).status;
return ret;
};
imports.wbg.__wbg_headers_5ffa990806e04cfc = function(arg0) {
var ret = getObject(arg0).headers;
return addHeapObject(ret);
};
imports.wbg.__wbg_json_88cc6d5cf8f61121 = function() { return handleError(function (arg0) {
var ret = getObject(arg0).json();
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_text_8279d34d73e43c68 = function() { return handleError(function (arg0) {
var ret = getObject(arg0).text();
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_add_f36d97e1d70d27b0 = function() { return handleError(function (arg0, arg1, arg2) {
imports.wbg.__wbg_add_c1e566b20be6badb = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).add(getStringFromWasm0(arg1, arg2));
}, arguments) };
imports.wbg.__wbg_remove_89670e56a41482a8 = function() { return handleError(function (arg0, arg1, arg2) {
imports.wbg.__wbg_remove_b4d29ca5eb7db54e = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).remove(getStringFromWasm0(arg1, arg2));
}, arguments) };
imports.wbg.__wbg_get_49ddec76fecb886f = function() { return handleError(function (arg0, arg1) {
var ret = getObject(arg0).get(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_href_1194e84dd750563a = function(arg0, arg1) {
imports.wbg.__wbg_href_cad8f02caf39f2fb = function(arg0, arg1) {
var ret = getObject(arg1).href;
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_headers_4764f5445b6a6c89 = function(arg0) {
imports.wbg.__wbg_getClientExtensionResults_37549795564cd9d3 = function(arg0) {
var ret = getObject(arg0).getClientExtensionResults();
return addHeapObject(ret);
};
imports.wbg.__wbg_headers_1a60dec7fbd28a3b = function(arg0) {
var ret = getObject(arg0).headers;
return addHeapObject(ret);
};
imports.wbg.__wbg_newwithstrandinit_9b0fa00478c37287 = function() { return handleError(function (arg0, arg1, arg2) {
imports.wbg.__wbg_newwithstrandinit_c07f0662ece15bc6 = function() { return handleError(function (arg0, arg1, arg2) {
var ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_instanceof_HtmlInputElement_8cafe5f30dfdb6bc = function(arg0) {
imports.wbg.__wbg_instanceof_HtmlInputElement_8969541a2a0bded0 = function(arg0) {
var ret = getObject(arg0) instanceof HTMLInputElement;
return ret;
};
imports.wbg.__wbg_setchecked_206243371da58f6a = function(arg0, arg1) {
imports.wbg.__wbg_setchecked_f6ead3490df88a7f = function(arg0, arg1) {
getObject(arg0).checked = arg1 !== 0;
};
imports.wbg.__wbg_value_0627d4b1c27534e6 = function(arg0, arg1) {
imports.wbg.__wbg_value_fc1c354d1a0e9714 = function(arg0, arg1) {
var ret = getObject(arg1).value;
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_setvalue_2459f62386b6967f = function(arg0, arg1, arg2) {
imports.wbg.__wbg_setvalue_ce4a23f487065c07 = function(arg0, arg1, arg2) {
getObject(arg0).value = getStringFromWasm0(arg1, arg2);
};
imports.wbg.__wbg_instanceof_Event_480a3ec3d45b75a6 = function(arg0) {
imports.wbg.__wbg_get_5835a17331a9d8f2 = function() { return handleError(function (arg0, arg1) {
var ret = getObject(arg0).get(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_instanceof_Event_39e54e1fe6593f4c = function(arg0) {
var ret = getObject(arg0) instanceof Event;
return ret;
};
imports.wbg.__wbg_target_cc69dde6c2d9ec90 = function(arg0) {
imports.wbg.__wbg_target_e560052e31e4567c = function(arg0) {
var ret = getObject(arg0).target;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_cancelBubble_f67c419013823f11 = function(arg0) {
imports.wbg.__wbg_cancelBubble_17d7988ab2fbe4c9 = function(arg0) {
var ret = getObject(arg0).cancelBubble;
return ret;
};
imports.wbg.__wbg_preventDefault_9866c9fd51eecfb6 = function(arg0) {
imports.wbg.__wbg_preventDefault_fa00541ff125b78c = function(arg0) {
getObject(arg0).preventDefault();
};
imports.wbg.__wbg_instanceof_HtmlDocument_1faa18f5a2da6fb3 = function(arg0) {
imports.wbg.__wbg_instanceof_HtmlDocument_395ec6365cabde6c = function(arg0) {
var ret = getObject(arg0) instanceof HTMLDocument;
return ret;
};
imports.wbg.__wbg_cookie_becfe81fc969a9ff = function() { return handleError(function (arg0, arg1) {
imports.wbg.__wbg_cookie_66f4449cc764fcb2 = function() { return handleError(function (arg0, arg1) {
var ret = getObject(arg1).cookie;
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_getClientExtensionResults_73fef7f1197950fb = function(arg0) {
var ret = getObject(arg0).getClientExtensionResults();
imports.wbg.__wbg_addEventListener_55682f77717d7665 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), getObject(arg4));
}, arguments) };
imports.wbg.__wbg_removeEventListener_9cd36e5806463d5d = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).removeEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), arg4 !== 0);
}, arguments) };
imports.wbg.__wbg_credentials_403bf2de10e8f1c3 = function(arg0) {
var ret = getObject(arg0).credentials;
return addHeapObject(ret);
};
imports.wbg.__wbg_instanceof_Element_97d85e53f1805b82 = function(arg0) {
imports.wbg.__wbg_instanceof_Element_c9423704dd5d9b1d = function(arg0) {
var ret = getObject(arg0) instanceof Element;
return ret;
};
imports.wbg.__wbg_namespaceURI_f4cd665d07463337 = function(arg0, arg1) {
imports.wbg.__wbg_namespaceURI_e9a971e6c1ce68db = function(arg0, arg1) {
var ret = getObject(arg1).namespaceURI;
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_classList_b666640fdfbcc8ab = function(arg0) {
imports.wbg.__wbg_classList_5086913f676eb3f3 = function(arg0) {
var ret = getObject(arg0).classList;
return addHeapObject(ret);
};
imports.wbg.__wbg_removeAttribute_eea03ed128669b8f = function() { return handleError(function (arg0, arg1, arg2) {
imports.wbg.__wbg_removeAttribute_1adaecf6b4d35a09 = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).removeAttribute(getStringFromWasm0(arg1, arg2));
}, arguments) };
imports.wbg.__wbg_setAttribute_1b533bf07966de55 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
imports.wbg.__wbg_setAttribute_1776fcc9b98d464e = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}, arguments) };
imports.wbg.__wbg_instanceof_HtmlElement_df66c8b4a687aa43 = function(arg0) {
imports.wbg.__wbg_instanceof_HtmlElement_d3e8f1c1d6788b24 = function(arg0) {
var ret = getObject(arg0) instanceof HTMLElement;
return ret;
};
imports.wbg.__wbg_focus_00530e359f44fc6e = function() { return handleError(function (arg0) {
imports.wbg.__wbg_focus_4434360545ac99cf = function() { return handleError(function (arg0) {
getObject(arg0).focus();
}, arguments) };
imports.wbg.__wbg_addEventListener_09e11fbf8b4b719b = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), getObject(arg4));
}, arguments) };
imports.wbg.__wbg_removeEventListener_24d5a7c12c3f3c39 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).removeEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), arg4 !== 0);
}, arguments) };
imports.wbg.__wbg_credentials_5339e35d156d6605 = function(arg0) {
var ret = getObject(arg0).credentials;
return addHeapObject(ret);
};
imports.wbg.__wbg_pushState_f772e11155235e9c = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
imports.wbg.__wbg_pushState_89ce908020e1d6aa = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
getObject(arg0).pushState(getObject(arg1), getStringFromWasm0(arg2, arg3), arg4 === 0 ? undefined : getStringFromWasm0(arg4, arg5));
}, arguments) };
imports.wbg.__wbg_parentElement_0253a5d6c3ff0ba5 = function(arg0) {
imports.wbg.__wbg_parentElement_96e1e07348340043 = function(arg0) {
var ret = getObject(arg0).parentElement;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_lastChild_ca5bac177ef353f6 = function(arg0) {
imports.wbg.__wbg_lastChild_e2b014abab089e08 = function(arg0) {
var ret = getObject(arg0).lastChild;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_setnodeValue_702374ad3d0ec3df = function(arg0, arg1, arg2) {
imports.wbg.__wbg_setnodeValue_f175b74a390f8fda = function(arg0, arg1, arg2) {
getObject(arg0).nodeValue = arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2);
};
imports.wbg.__wbg_appendChild_d318db34c4559916 = function() { return handleError(function (arg0, arg1) {
imports.wbg.__wbg_appendChild_3fe5090c665d3bb4 = function() { return handleError(function (arg0, arg1) {
var ret = getObject(arg0).appendChild(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_insertBefore_5b314357408fbec1 = function() { return handleError(function (arg0, arg1, arg2) {
imports.wbg.__wbg_insertBefore_4f09909023feac91 = function() { return handleError(function (arg0, arg1, arg2) {
var ret = getObject(arg0).insertBefore(getObject(arg1), getObject(arg2));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_removeChild_d3ca7b53e537867e = function() { return handleError(function (arg0, arg1) {
imports.wbg.__wbg_removeChild_f4a83c9698136bbb = function() { return handleError(function (arg0, arg1) {
var ret = getObject(arg0).removeChild(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_pathname_32da720074d17e34 = function() { return handleError(function (arg0, arg1) {
imports.wbg.__wbg_pathname_d0014089875ea691 = function() { return handleError(function (arg0, arg1) {
var ret = getObject(arg1).pathname;
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_search_f44353b4fdbdd216 = function() { return handleError(function (arg0, arg1) {
imports.wbg.__wbg_search_7e1c9ba7f3985c36 = function() { return handleError(function (arg0, arg1) {
var ret = getObject(arg1).search;
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_replace_fde8d9ba8c5000f9 = function() { return handleError(function (arg0, arg1, arg2) {
imports.wbg.__wbg_replace_ec236a3e3182c4da = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).replace(getStringFromWasm0(arg1, arg2));
}, arguments) };
imports.wbg.__wbg_getItem_77fb9d4666f3b93a = function() { return handleError(function (arg0, arg1, arg2, arg3) {
imports.wbg.__wbg_getItem_f92ef607397e96b1 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
var ret = getObject(arg1).getItem(getStringFromWasm0(arg2, arg3));
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_removeItem_e02016195a414450 = function() { return handleError(function (arg0, arg1, arg2) {
imports.wbg.__wbg_removeItem_ccc2014f87a14e1b = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).removeItem(getStringFromWasm0(arg1, arg2));
}, arguments) };
imports.wbg.__wbg_setItem_b0c4561489dffecd = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
imports.wbg.__wbg_setItem_279b13e5ad0b82cb = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}, arguments) };
imports.wbg.__wbg_new_949bbc1147195c4e = function() {
imports.wbg.__wbg_get_bee69a0c35eec41c = function() { return handleError(function (arg0, arg1, arg2, arg3) {
var ret = getObject(arg1).get(getStringFromWasm0(arg2, arg3));
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_set_f9448486a94c9aef = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}, arguments) };
imports.wbg.__wbg_pathname_7affbcff36f35c0e = function(arg0, arg1) {
var ret = getObject(arg1).pathname;
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_new_4473c9af1cac368b = function() { return handleError(function (arg0, arg1) {
var ret = new URL(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_value_d3a30bc2c7caf357 = function(arg0, arg1) {
var ret = getObject(arg1).value;
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_setvalue_6a34bab301f38bf2 = function(arg0, arg1, arg2) {
getObject(arg0).value = getStringFromWasm0(arg1, arg2);
};
imports.wbg.__wbg_instanceof_Response_ea36d565358a42f7 = function(arg0) {
var ret = getObject(arg0) instanceof Response;
return ret;
};
imports.wbg.__wbg_status_3a55bb50e744b834 = function(arg0) {
var ret = getObject(arg0).status;
return ret;
};
imports.wbg.__wbg_headers_e4204c6775f7b3b4 = function(arg0) {
var ret = getObject(arg0).headers;
return addHeapObject(ret);
};
imports.wbg.__wbg_json_4ab99130d1a5b3a9 = function() { return handleError(function (arg0) {
var ret = getObject(arg0).json();
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_text_aeba5a5bbfef7f15 = function() { return handleError(function (arg0) {
var ret = getObject(arg0).text();
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_new_16f24b0728c5e67b = function() {
var ret = new Array();
return addHeapObject(ret);
};
imports.wbg.__wbg_newnoargs_be86524d73f67598 = function(arg0, arg1) {
imports.wbg.__wbg_newnoargs_f579424187aa1717 = function(arg0, arg1) {
var ret = new Function(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
};
imports.wbg.__wbg_get_4d0f21c2f823742e = function() { return handleError(function (arg0, arg1) {
imports.wbg.__wbg_get_8bbb82393651dd9c = function() { return handleError(function (arg0, arg1) {
var ret = Reflect.get(getObject(arg0), getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_call_888d259a5fefc347 = function() { return handleError(function (arg0, arg1) {
imports.wbg.__wbg_call_89558c3e96703ca1 = function() { return handleError(function (arg0, arg1) {
var ret = getObject(arg0).call(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_new_0b83d3df67ecb33e = function() {
imports.wbg.__wbg_new_d3138911a89329b0 = function() {
var ret = new Object();
return addHeapObject(ret);
};
imports.wbg.__wbg_push_284486ca27c6aa8b = function(arg0, arg1) {
imports.wbg.__wbg_push_a72df856079e6930 = function(arg0, arg1) {
var ret = getObject(arg0).push(getObject(arg1));
return ret;
};
imports.wbg.__wbg_instanceof_Error_561efcb1265706d8 = function(arg0) {
imports.wbg.__wbg_instanceof_Error_4287ce7d75f0e3a2 = function(arg0) {
var ret = getObject(arg0) instanceof Error;
return ret;
};
imports.wbg.__wbg_message_9f7d15ff97fc4102 = function(arg0) {
imports.wbg.__wbg_message_1dfe93b595be8811 = function(arg0) {
var ret = getObject(arg0).message;
return addHeapObject(ret);
};
imports.wbg.__wbg_name_5a42234155690dbc = function(arg0) {
imports.wbg.__wbg_name_66305ab387468967 = function(arg0) {
var ret = getObject(arg0).name;
return addHeapObject(ret);
};
imports.wbg.__wbg_toString_0ef1ea57b966aed4 = function(arg0) {
imports.wbg.__wbg_toString_3e854a6a919f2996 = function(arg0) {
var ret = getObject(arg0).toString();
return addHeapObject(ret);
};
imports.wbg.__wbg_valueOf_99d85ac83228d11b = function(arg0) {
imports.wbg.__wbg_valueOf_39e0d6bc7e4232b9 = function(arg0) {
var ret = getObject(arg0).valueOf();
return ret;
};
imports.wbg.__wbg_is_0f5efc7977a2c50b = function(arg0, arg1) {
imports.wbg.__wbg_is_3d73f4d91adacc37 = function(arg0, arg1) {
var ret = Object.is(getObject(arg0), getObject(arg1));
return ret;
};
imports.wbg.__wbg_resolve_d23068002f584f22 = function(arg0) {
imports.wbg.__wbg_resolve_4f8f547f26b30b27 = function(arg0) {
var ret = Promise.resolve(getObject(arg0));
return addHeapObject(ret);
};
imports.wbg.__wbg_then_2fcac196782070cc = function(arg0, arg1) {
imports.wbg.__wbg_then_a6860c82b90816ca = function(arg0, arg1) {
var ret = getObject(arg0).then(getObject(arg1));
return addHeapObject(ret);
};
imports.wbg.__wbg_then_8c2d62e8ae5978f7 = function(arg0, arg1, arg2) {
imports.wbg.__wbg_then_58a04e42527f52c6 = function(arg0, arg1, arg2) {
var ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
return addHeapObject(ret);
};
imports.wbg.__wbg_self_c6fbdfc2918d5e58 = function() { return handleError(function () {
imports.wbg.__wbg_self_e23d74ae45fb17d1 = function() { return handleError(function () {
var ret = self.self;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_window_baec038b5ab35c54 = function() { return handleError(function () {
imports.wbg.__wbg_window_b4be7f48b24ac56e = function() { return handleError(function () {
var ret = window.window;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_globalThis_3f735a5746d41fbd = function() { return handleError(function () {
imports.wbg.__wbg_globalThis_d61b1f48a57191ae = function() { return handleError(function () {
var ret = globalThis.globalThis;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_global_1bc0b39582740e95 = function() { return handleError(function () {
imports.wbg.__wbg_global_e7669da72fd7f239 = function() { return handleError(function () {
var ret = global.global;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_buffer_397eaa4d72ee94dd = function(arg0) {
imports.wbg.__wbg_buffer_5e74a88a1424a2e0 = function(arg0) {
var ret = getObject(arg0).buffer;
return addHeapObject(ret);
};
imports.wbg.__wbg_newwithbyteoffsetandlength_4b9b8c4e3f5adbff = function(arg0, arg1, arg2) {
imports.wbg.__wbg_newwithbyteoffsetandlength_278ec7532799393a = function(arg0, arg1, arg2) {
var ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
return addHeapObject(ret);
};
imports.wbg.__wbg_new_a7ce447f15ff496f = function(arg0) {
imports.wbg.__wbg_new_e3b800e570795b3c = function(arg0) {
var ret = new Uint8Array(getObject(arg0));
return addHeapObject(ret);
};
imports.wbg.__wbg_set_969ad0a60e51d320 = function(arg0, arg1, arg2) {
imports.wbg.__wbg_set_5b8081e9d002f0df = function(arg0, arg1, arg2) {
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
};
imports.wbg.__wbg_length_1eb8fc608a0d4cdb = function(arg0) {
imports.wbg.__wbg_length_30803400a8f15c59 = function(arg0) {
var ret = getObject(arg0).length;
return ret;
};
imports.wbg.__wbg_set_82a4e8a85e31ac42 = function() { return handleError(function (arg0, arg1, arg2) {
imports.wbg.__wbg_set_c42875065132a932 = function() { return handleError(function (arg0, arg1, arg2) {
var ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
return ret;
}, arguments) };
@ -797,16 +807,16 @@ async function init(input) {
var ret = wasm.memory;
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper1154 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 474, __wbg_adapter_30);
imports.wbg.__wbindgen_closure_wrapper1287 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 552, __wbg_adapter_30);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper1351 = function(arg0, arg1, arg2) {
var ret = makeClosure(arg0, arg1, 522, __wbg_adapter_33);
imports.wbg.__wbindgen_closure_wrapper1490 = function(arg0, arg1, arg2) {
var ret = makeClosure(arg0, arg1, 602, __wbg_adapter_33);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_closure_wrapper1486 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 560, __wbg_adapter_36);
imports.wbg.__wbindgen_closure_wrapper1632 = function(arg0, arg1, arg2) {
var ret = makeMutClosure(arg0, arg1, 640, __wbg_adapter_36);
return addHeapObject(ret);
};

View file

@ -1,5 +1,15 @@
#![recursion_limit = "256"]
#![deny(warnings)]
#![warn(unused_extern_crates)]
#![deny(clippy::todo)]
#![deny(clippy::unimplemented)]
#![deny(clippy::unwrap_used)]
#![deny(clippy::expect_used)]
#![deny(clippy::panic)]
#![deny(clippy::unreachable)]
#![deny(clippy::await_holding_lock)]
#![deny(clippy::needless_pass_by_value)]
#![deny(clippy::trivially_copy_pass_by_ref)]
use wasm_bindgen::prelude::*;
@ -11,7 +21,7 @@ mod oauth2;
mod utils;
mod views;
#[wasm_bindgen]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen)]
pub fn run_app() -> Result<(), JsValue> {
yew::start_app::<manager::ManagerApp>();
Ok(())

View file

@ -8,7 +8,6 @@ use yew::prelude::*;
use yew_router::prelude::*;
use crate::error::FetchError;
use crate::manager::Route;
use crate::models;
use crate::utils;
@ -79,7 +78,7 @@ impl LoginApp {
};
let authreq_jsvalue = serde_json::to_string(&authreq)
.map(|s| JsValue::from(&s))
.expect("Failed to serialise authreq");
.expect_throw("Failed to serialise authreq");
let mut opts = RequestInit::new();
opts.method("POST");
@ -95,7 +94,7 @@ impl LoginApp {
let window = utils::window();
let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?;
let resp: Response = resp_value.dyn_into().unwrap();
let resp: Response = resp_value.dyn_into().expect_throw("Invalid response type");
let status = resp.status();
let headers = resp.headers();
@ -106,7 +105,7 @@ impl LoginApp {
.flatten()
.unwrap_or_else(|| "".to_string());
let jsval = JsFuture::from(resp.json()?).await?;
let state: AuthResponse = jsval.into_serde().unwrap();
let state: AuthResponse = jsval.into_serde().expect_throw("Invalid response type");
Ok(LoginAppMsg::Start(session_id, state))
} else {
let kopid = headers.get("x-kanidm-opid").ok().flatten();
@ -122,7 +121,7 @@ impl LoginApp {
) -> Result<LoginAppMsg, FetchError> {
let authreq_jsvalue = serde_json::to_string(&authreq)
.map(|s| JsValue::from(&s))
.expect("Failed to serialise authreq");
.expect_throw("Failed to serialise authreq");
let mut opts = RequestInit::new();
opts.method("POST");
@ -142,13 +141,13 @@ impl LoginApp {
let window = utils::window();
let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?;
let resp: Response = resp_value.dyn_into().unwrap();
let resp: Response = resp_value.dyn_into().expect_throw("Invalid response type");
let status = resp.status();
let headers = resp.headers();
if status == 200 {
let jsval = JsFuture::from(resp.json()?).await?;
let state: AuthResponse = jsval.into_serde().unwrap();
let state: AuthResponse = jsval.into_serde().expect_throw("Invalid response type");
Ok(LoginAppMsg::Next(state))
} else {
let kopid = headers.get("x-kanidm-opid").ok().flatten();
@ -326,7 +325,7 @@ impl LoginApp {
.navigator()
.credentials()
.get_with_options(challenge)
.expect("Unable to create promise");
.expect_throw("Unable to create promise");
let fut = JsFuture::from(promise);
let linkc = ctx.link().clone();
@ -362,13 +361,10 @@ impl LoginApp {
}
}
LoginState::Authenticated => {
let loc: Route = models::pop_return_location().into();
let loc = models::pop_return_location();
// redirect
console::log!(format!("authenticated, try going to -> {:?}", loc));
ctx.link()
.history()
.expect_throw("failed to read history")
.push(loc);
loc.goto(&ctx.link().history().expect_throw("failed to read history"));
html! {
<div class="container">
<p>
@ -425,10 +421,10 @@ impl Component for LoginApp {
let html_document = document
.dyn_into::<web_sys::HtmlDocument>()
.expect("failed to dyn cast to htmldocument");
.expect_throw("failed to dyn cast to htmldocument");
let cookie = html_document
.cookie()
.expect("failed to access page cookies");
.expect_throw("failed to access page cookies");
console::log!("cookies");
console::log!(cookie.as_str());
@ -563,7 +559,7 @@ impl Component for LoginApp {
self.session_id = session_id;
if mechs.len() == 1 {
// If it's only one mech, just submit that.
let mech = mechs.pop().unwrap();
let mech = mechs.pop().expect_throw("Memory corruption occured");
let authreq = AuthRequest {
step: AuthStep::Begin(mech),
};
@ -618,7 +614,7 @@ impl Component for LoginApp {
AuthState::Continue(mut allowed) => {
if allowed.len() == 1 {
// If there is only one, change our state for that input type.
match allowed.pop().unwrap() {
match allowed.pop().expect_throw("Memory corruption occured") {
AuthAllowed::Anonymous => {
// Just submit this.
}

View file

@ -5,22 +5,24 @@
//! will allow you to proceed with the oauth flow.
use gloo::console;
use wasm_bindgen::UnwrapThrowExt;
use yew::functional::*;
use yew::prelude::*;
use yew_router::prelude::*;
use crate::login::LoginApp;
use crate::oauth2::Oauth2App;
use crate::views::ViewsApp;
use crate::views::{ViewRoute, ViewsApp};
use serde::{Deserialize, Serialize};
// router to decide on state.
#[derive(Routable, PartialEq, Clone, Debug)]
#[derive(Routable, PartialEq, Clone, Debug, Serialize, Deserialize)]
pub enum Route {
#[at("/")]
Landing,
#[at("/ui/view")]
Index,
#[at("/ui/view/:s")]
Views,
#[at("/ui/login")]
Login,
@ -36,24 +38,26 @@ pub enum Route {
#[function_component(Landing)]
fn landing() -> Html {
// Do this to allow use_history to work because lol.
use_history().unwrap().push(Route::Index);
use_history()
.expect_throw("Unable to access history")
.push(ViewRoute::Apps);
html! { <main></main> }
}
fn switch(routes: &Route) -> Html {
fn switch(route: &Route) -> Html {
console::log!("manager::switch");
match routes {
match route {
Route::Landing => html! { <Landing /> },
Route::Index => html! { <ViewsApp /> },
Route::Login => html! { <LoginApp /> },
Route::Oauth2 => html! { <Oauth2App /> },
Route::Views => html! { <ViewsApp /> },
Route::NotFound => {
html! {
<main>
<h1>{ "404" }</h1>
<Link<Route> to={ Route::Index }>
<Link<ViewRoute> to={ ViewRoute::Apps }>
{ "Home" }
</Link<Route>>
</Link<ViewRoute>>
</main>
}
}

View file

@ -5,8 +5,10 @@ use gloo::storage::LocalStorage as PersistentStorage;
use gloo::storage::SessionStorage as TemporaryStorage;
use gloo::storage::Storage;
use wasm_bindgen::UnwrapThrowExt;
use yew_router::prelude::{AnyHistory, History};
use crate::manager::Route;
use crate::views::ViewRoute;
use serde::{Deserialize, Serialize};
pub fn get_bearer_token() -> Option<String> {
@ -27,15 +29,15 @@ pub fn clear_bearer_token() {
#[derive(Serialize, Deserialize, Debug)]
pub enum Location {
Oauth2,
Views,
Manager(Route),
Views(ViewRoute),
}
impl From<Location> for Route {
fn from(l: Location) -> Self {
match l {
Location::Views => Route::Index,
Location::Oauth2 => Route::Oauth2,
impl Location {
pub(crate) fn goto(self, history: &AnyHistory) {
match self {
Location::Manager(r) => history.push(r),
Location::Views(r) => history.push(r),
}
}
}
@ -48,7 +50,7 @@ pub fn pop_return_location() -> Location {
let l: Result<Location, _> = TemporaryStorage::get("return_location");
console::log!(format!("return_location -> {:?}", l).as_str());
TemporaryStorage::delete("return_location");
l.unwrap_or(Location::Views)
l.unwrap_or(Location::Manager(Route::Landing))
}
pub fn push_oauth2_authorisation_request(r: AuthorisationRequest) {

View file

@ -70,7 +70,7 @@ impl Oauth2App {
let window = utils::window();
let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?;
let resp: Response = resp_value.dyn_into().unwrap();
let resp: Response = resp_value.dyn_into().expect_throw("Invalid response type");
let status = resp.status();
if status == 200 {
@ -93,7 +93,7 @@ impl Oauth2App {
) -> Result<Oauth2Msg, FetchError> {
let authreq_jsvalue = serde_json::to_string(&authreq)
.map(|s| JsValue::from(&s))
.expect("Failed to serialise authreq");
.expect_throw("Failed to serialise authreq");
let mut opts = RequestInit::new();
opts.method("POST");
@ -113,13 +113,13 @@ impl Oauth2App {
let window = utils::window();
let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?;
let resp: Response = resp_value.dyn_into().unwrap();
let resp: Response = resp_value.dyn_into().expect_throw("Invalid response type");
let status = resp.status();
let headers = resp.headers();
if status == 200 {
let jsval = JsFuture::from(resp.json()?).await?;
let state: ConsentRequest = jsval.into_serde().unwrap();
let state: ConsentRequest = jsval.into_serde().expect_throw("Invalid response type");
Ok(Oauth2Msg::Consent(state))
} else {
let kopid = headers.get("x-kanidm-opid").ok().flatten();
@ -135,7 +135,7 @@ impl Oauth2App {
) -> Result<Oauth2Msg, FetchError> {
let consentreq_jsvalue = serde_json::to_string(&consent_req.consent_token)
.map(|s| JsValue::from(&s))
.expect("Failed to serialise consent_req");
.expect_throw("Failed to serialise consent_req");
let mut opts = RequestInit::new();
opts.method("POST");
@ -156,7 +156,7 @@ impl Oauth2App {
let window = utils::window();
let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?;
let resp: Response = resp_value.dyn_into().unwrap();
let resp: Response = resp_value.dyn_into().expect_throw("Invalid response type");
let status = resp.status();
let headers = resp.headers();
@ -190,7 +190,7 @@ impl Component for Oauth2App {
let location = ctx
.link()
.location()
.expect("Can't access current location");
.expect_throw("Can't access current location");
let query: Option<AuthorisationRequest> = location
.query()
@ -263,7 +263,8 @@ impl Component for Oauth2App {
match msg {
Oauth2Msg::LoginProceed => {
models::push_return_location(models::Location::Oauth2);
models::push_return_location(models::Location::Manager(Route::Oauth2));
ctx.link()
.history()
.expect_throw("failed to read history")
@ -278,9 +279,8 @@ impl Component for Oauth2App {
self.state = match (&self.state, ar) {
(State::TokenCheck(token), Some(ar)) => {
let token_c = token.clone();
let ar_c = ar.clone();
ctx.link().send_future(async {
match Self::fetch_authreq(token_c, ar_c).await {
match Self::fetch_authreq(token_c, ar).await {
Ok(v) => v,
Err(v) => v.into(),
}

View file

@ -4,15 +4,17 @@ pub use web_sys::InputEvent;
use web_sys::{Document, Event, HtmlElement, HtmlInputElement, Window};
pub fn window() -> Window {
web_sys::window().expect("Unable to retrieve window")
web_sys::window().expect_throw("Unable to retrieve window")
}
pub fn document() -> Document {
window().document().expect("Unable to retrieve document")
window()
.document()
.expect_throw("Unable to retrieve document")
}
pub fn body() -> HtmlElement {
document().body().expect("Unable to retrieve body")
document().body().expect_throw("Unable to retrieve body")
}
pub fn autofocus() {

View file

@ -0,0 +1,77 @@
use gloo::console;
use yew::prelude::*;
pub enum Msg {
// Nothing
}
pub struct AppsApp {}
impl Component for AppsApp {
type Message = Msg;
type Properties = ();
fn create(_ctx: &Context<Self>) -> Self {
console::log!("views::apps::create");
AppsApp {}
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
console::log!("views::apps::changed");
false
}
fn update(&mut self, _ctx: &Context<Self>, _msg: Self::Message) -> bool {
console::log!("views::apps::update");
/*
match msg {
ViewsMsg::Logout => {
}
}
*/
true
}
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
console::log!("views::apps::rendered");
}
fn view(&self, _ctx: &Context<Self>) -> Html {
html! {
<>
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h2>{ "Apps" }</h2>
</div>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">{ "#" }</th>
<th scope="col">{ "Header" }</th>
<th scope="col">{ "Header" }</th>
<th scope="col">{ "Header" }</th>
<th scope="col">{ "Header" }</th>
</tr>
</thead>
<tbody>
<tr>
<td>{ "1,001" }</td>
<td>{ "random" }</td>
<td>{ "data" }</td>
<td>{ "placeholder" }</td>
<td>{ "text" }</td>
</tr>
<tr>
<td>{ "1,015" }</td>
<td>{ "random" }</td>
<td>{ "tabular" }</td>
<td>{ "information" }</td>
<td>{ "text" }</td>
</tr>
</tbody>
</table>
</div>
</>
}
}
}

View file

@ -0,0 +1 @@

View file

@ -6,6 +6,28 @@ use yew::prelude::*;
use crate::manager::Route;
use yew_router::prelude::*;
use serde::{Deserialize, Serialize};
mod apps;
mod components;
mod security;
use apps::AppsApp;
use security::SecurityApp;
#[derive(Routable, PartialEq, Clone, Debug, Serialize, Deserialize)]
pub enum ViewRoute {
#[at("/ui/view/apps")]
Apps,
#[at("/ui/view/security")]
Security,
#[not_found]
#[at("/ui/view/404")]
NotFound,
}
enum State {
LoginRequired,
Authenticated(String),
@ -19,6 +41,17 @@ pub enum ViewsMsg {
Logout,
}
fn switch(route: &ViewRoute) -> Html {
console::log!("views::switch");
match route {
ViewRoute::Apps => html! { <AppsApp /> },
ViewRoute::Security => html! { <SecurityApp /> },
ViewRoute::NotFound => html! {
<Redirect<Route> to={Route::NotFound}/>
},
}
}
impl Component for ViewsApp {
type Message = ViewsMsg;
type Properties = ();
@ -56,7 +89,17 @@ impl Component for ViewsApp {
fn view(&self, ctx: &Context<Self>) -> Html {
match self.state {
State::LoginRequired => {
models::push_return_location(models::Location::Views);
// Where are we?
let loc = ctx
.link()
.history()
.expect_throw("failed to read history")
.location()
.route()
.expect_throw("invalid route");
models::push_return_location(models::Location::Views(loc));
ctx.link()
.history()
.expect_throw("failed to read history")
@ -90,47 +133,27 @@ impl ViewsApp {
<nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
<div class="position-sticky pt-3">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">
<span data-feather="home"></span>
{ "Account" }
</a>
<Link<ViewRoute> classes="nav-link" to={ViewRoute::Apps}>
<span data-feather="file"></span>
{ "Apps" }
</Link<ViewRoute>>
</li>
<li class="nav-item">
<Link<ViewRoute> classes="nav-link" to={ViewRoute::Security}>
<span data-feather="file"></span>
{ "Security" }
</Link<ViewRoute>>
</li>
</ul>
</div>
</nav>
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
<h2>{ "Section title" }</h2>
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th scope="col">{ "#" }</th>
<th scope="col">{ "Header" }</th>
<th scope="col">{ "Header" }</th>
<th scope="col">{ "Header" }</th>
<th scope="col">{ "Header" }</th>
</tr>
</thead>
<tbody>
<tr>
<td>{ "1,001" }</td>
<td>{ "random" }</td>
<td>{ "data" }</td>
<td>{ "placeholder" }</td>
<td>{ "text" }</td>
</tr>
<tr>
<td>{ "1,015" }</td>
<td>{ "random" }</td>
<td>{ "tabular" }</td>
<td>{ "information" }</td>
<td>{ "text" }</td>
</tr>
</tbody>
</table>
</div>
<Switch<ViewRoute> render={ Switch::render(switch) } />
</main>
</div>
</div>

View file

@ -0,0 +1,46 @@
use gloo::console;
use yew::prelude::*;
pub enum Msg {
// Nothing
}
pub struct SecurityApp {}
impl Component for SecurityApp {
type Message = Msg;
type Properties = ();
fn create(_ctx: &Context<Self>) -> Self {
console::log!("views::security::create");
SecurityApp {}
}
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
console::log!("views::security::changed");
false
}
fn update(&mut self, _ctx: &Context<Self>, _msg: Self::Message) -> bool {
console::log!("views::security::update");
/*
match msg {
ViewsMsg::Logout => {
}
}
*/
true
}
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
console::log!("views::security::rendered");
}
fn view(&self, _ctx: &Context<Self>) -> Html {
html! {
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h2>{ "Security" }</h2>
</div>
}
}
}

View file

@ -2,7 +2,7 @@
name = "orca"
version = "1.1.0-alpha.7"
authors = ["William Brown <william@blackhats.net.au>"]
edition = "2018"
edition = "2021"
license = "MPL-2.0"
description = "Orca - load testing for LDAP and Kanidm"
documentation = "https://docs.rs/kanidm/latest/kanidm/"
@ -45,3 +45,5 @@ async-std = { version = "1.6", features = ["tokio1"] }
mathru = "0.11"
[build-dependencies]
profiles = { path = "../profiles" }

3
orca/build.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
profiles::apply_profile();
}

View file

@ -11,6 +11,7 @@ After=chronyd.service ntpd.service network-online.target kanidm-unixd.service
User=root
Type=simple
ExecStart=/usr/sbin/kanidm_unixd_tasks
KillSignal=SIGINT
CapabilityBoundingSet=CAP_CHOWN CAP_FOWNER CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH
# SystemCallFilter=@aio @basic-io @chown @file-system @io-event @network-io @sync

View file

@ -14,6 +14,7 @@ RuntimeDirectory=kanidm-unixd
Type=simple
ExecStart=/usr/sbin/kanidm_unixd
KillSignal=SIGINT
# Implied by dynamic user.
# ProtectHome=

View file

@ -13,6 +13,7 @@ DynamicUser=yes
UMask=0027
StateDirectory=kanidm
ExecStart=/usr/sbin/kanidmd server -c /etc/kanidm/server.toml
KillSignal=SIGINT
NoNewPrivileges=true
PrivateTmp=true

23
profiles/Cargo.toml Normal file
View file

@ -0,0 +1,23 @@
[package]
name = "profiles"
version = "1.1.0"
authors = ["William Brown <william@blackhats.net.au>"]
edition = "2021"
license = "MPL-2.0"
description = "Kanidm Build System Profiles"
documentation = "https://docs.rs/kanidm/latest/kanidm/"
homepage = "https://github.com/kanidm/kanidm/"
repository = "https://github.com/kanidm/kanidm/"
[lib]
name = "profiles"
path = "src/lib.rs"
[dependencies]
serde = { version = "1", features = ["derive"] }
toml = "0.5"
base64 = "0.13"
rustc_version = "0.4.0"
[build-dependencies]
base64 = "0.13"

1
profiles/RUST_MSRV Normal file
View file

@ -0,0 +1 @@
1.58.0

27
profiles/build.rs Normal file
View file

@ -0,0 +1,27 @@
use std::env;
use std::fs;
use std::path::PathBuf;
fn main() {
println!("cargo:rerun-if-changed=RUST_MSRV");
println!("cargo:rerun-if-env-changed=KANIDM_BUILD_PROFILE");
let rust_minver = include_str!("RUST_MSRV");
let profile = env::var("KANIDM_BUILD_PROFILE").unwrap_or_else(|_| "developer".to_string());
let profile_path: PathBuf = ["./", format!("{}.toml", profile).as_str()]
.iter()
.collect();
let data =
fs::read(&profile_path).unwrap_or_else(|_| panic!("Failed to read {:?}", profile_path));
let contents = base64::encode(data);
println!("cargo:rerun-if-changed={}", profile_path.to_str().unwrap());
println!("cargo:rustc-env=KANIDM_BUILD_PROFILE={}", profile);
println!("cargo:rustc-env=KANIDM_BUILD_PROFILE_TOML={}", contents);
println!("cargo:rustc-env=KANIDM_RUST_MSRV={}", rust_minver);
}

View file

@ -1,3 +1,3 @@
web_ui_pkg_path = "../kanidmd_web_ui/pkg"
web_ui_pkg_path = "../../kanidmd_web_ui/pkg"
# Valid options are none, native, x86_64, x86_64_v3
cpu_flags = "native"

74
profiles/src/lib.rs Normal file
View file

@ -0,0 +1,74 @@
use rustc_version::{version, Version};
use serde::Deserialize;
use std::env;
#[derive(Debug, Deserialize)]
#[allow(non_camel_case_types)]
enum CpuOptLevel {
none,
native,
x86_64_v1,
x86_64_v3,
}
impl std::fmt::Display for CpuOptLevel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match &self {
CpuOptLevel::none => write!(f, "none"),
CpuOptLevel::native => write!(f, "native"),
CpuOptLevel::x86_64_v1 => write!(f, "x86_64_v1"),
CpuOptLevel::x86_64_v3 => write!(f, "x86_64_v3"),
}
}
}
#[derive(Debug, Deserialize)]
struct ProfileConfig {
web_ui_pkg_path: String,
cpu_flags: CpuOptLevel,
}
pub fn apply_profile() {
println!("cargo:rerun-if-env-changed=KANIDM_RUST_MSRV");
println!("cargo:rerun-if-env-changed=KANIDM_BUILD_PROFILE");
println!("cargo:rerun-if-env-changed=KANIDM_BUILD_PROFILE_TOML");
// check to see if the rust version matches the rust minimum version we require for this build
let rust_minver = env!("KANIDM_RUST_MSRV");
let required_rust_ver = Version::parse(&rust_minver.replace("\n", "")).unwrap();
println!("Rust version: {}", version().unwrap());
println!("Required version: {}", required_rust_ver);
if version().unwrap() < required_rust_ver {
panic!("This crate requires rustc >= {}, quitting.", rust_minver);
}
// transform any requested paths for our server. We do this by reading
// our profile that we have been provided.
let profile = env!("KANIDM_BUILD_PROFILE");
let contents = env!("KANIDM_BUILD_PROFILE_TOML");
let data = base64::decode(contents)
.unwrap_or_else(|_| panic!("Failed to parse profile - {} - {}", profile, contents));
let profile_cfg: ProfileConfig = toml::from_slice(&data)
.unwrap_or_else(|_| panic!("Failed to parse profile - {} - {}", profile, contents));
/*
* x86-64: CMOV, CMPXCHG8B, FPU, FXSR, MMX, FXSR, SCE, SSE, SSE2
* x86-64-v2: (close to Nehalem) CMPXCHG16B, LAHF-SAHF, POPCNT, SSE3, SSE4.1, SSE4.2, SSSE3
* x86-64-v3: (close to Haswell) AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE
*/
match profile_cfg.cpu_flags {
CpuOptLevel::none => {}
CpuOptLevel::native => println!("cargo:rustc-env=RUSTFLAGS=-Ctarget-cpu=native"),
CpuOptLevel::x86_64_v1 => println!("cargo:rustc-env=RUSTFLAGS=-Ctarget-feature=+cmov,+cx8,+fxsr,+mmx,+sse,+sse2"),
CpuOptLevel::x86_64_v3 => println!("cargo:rustc-env=RUSTFLAGS=-Ctarget-feature=+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+cx16,+sahf,+popcnt,+sse3,+sse4.1,+sse4.2,+avx,+avx2,+bmi,+bmi2,+f16c,+fma,+lzcnt,+movbe,+xsave"),
}
println!("cargo:rustc-env=KANIDM_PROFILE_NAME={}", profile);
println!("cargo:rustc-env=KANIDM_CPU_FLAGS={}", profile_cfg.cpu_flags);
println!(
"cargo:rustc-env=KANIDM_WEB_UI_PKG_PATH={}",
profile_cfg.web_ui_pkg_path
);
}

View file

@ -1,26 +0,0 @@
#[derive(Debug, Deserialize)]
#[allow(non_camel_case_types)]
enum CpuOptLevel {
none,
native,
x86_64_v1,
x86_64_v3,
}
impl std::fmt::Display for CpuOptLevel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match &self {
CpuOptLevel::none => write!(f, "none"),
CpuOptLevel::native => write!(f, "native"),
CpuOptLevel::x86_64_v1 => write!(f, "x86_64_v1"),
CpuOptLevel::x86_64_v3 => write!(f, "x86_64_v3"),
}
}
}
#[derive(Debug, Deserialize)]
struct ProfileConfig {
web_ui_pkg_path: String,
cpu_flags: CpuOptLevel,
}