diff options
author | Katharina Fey <kookie@spacekookie.de> | 2018-07-10 19:50:47 +0200 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2018-07-10 19:50:47 +0200 |
commit | 7dfaacb94c8e4a37fb68fcaa7435c8cc8a08e7f9 (patch) | |
tree | c644acb5281b5baaa8cd4d95c423513a65984573 | |
parent | 768b648109b31cea3580bea7b88fe9b7277e2806 (diff) |
Adding the http ability to register/login and managing metadata
-rw-r--r-- | lockchain-http/src/lib.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lockchain-http/src/lib.rs b/lockchain-http/src/lib.rs index dfe1211..3adb503 100644 --- a/lockchain-http/src/lib.rs +++ b/lockchain-http/src/lib.rs @@ -106,6 +106,31 @@ where // Delete a specific record from a vault r.method(http::Method::DELETE).with(handlers::delete_record); }) + .resource("/vaults/{vaultid}/metadata", |r| { + // Get a metadata index of things available. To retrieve an item + // a vault registry token needs to be provided which is checked + r.method(http::Method::GET).with(handlers::get_all_metadata); + // Create a new metadata domain (requires admin rights) + r.method(http::Method::PUT).with(handlers::put_metadata); + }) + .resource("/vaults/{vaultid}/metadata/{metaid}", |r| { + // Get a specific metadata field + r.method(http::Method::GET).with(handlers::get_all_records); + // Update a specific metadata field + r.method(http::Method::POST).with(handlers::get_all_records); + }) + .resource("/vaults/{vaultid}/register", |r| { + // Register a new user in a vault (with a registry token) + r.method(http::Method::POST).with(handlers::deauthenticate) + }) + .resource("/vaults/{vaultid}/login", |r| { + // Login as a user for this vault + r.method(http::Method::POST).with(handlers::authenticate) + }) + .resource("/vaults/{vaultid}/logout", |r| { + // Logout, closing an existing session + r.method(http::Method::POST).with(handlers::deauthenticate) + }) .resource("/users/login", |r| { // Request a new auth token r.method(http::Method::POST).with(handlers::authenticate) |