From 813e075edea1eb55e880f8e17517d48842ebeca4 Mon Sep 17 00:00:00 2001 From: Tim Bruijnzeels Date: Thu, 13 Jun 2019 08:43:32 +0200 Subject: [PATCH 1/4] Simplifications and code formatting. --- commons/src/api/ca.rs | 68 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/commons/src/api/ca.rs b/commons/src/api/ca.rs index cccf69f3..093fb2b5 100644 --- a/commons/src/api/ca.rs +++ b/commons/src/api/ca.rs @@ -100,7 +100,7 @@ impl TrustAnchorLocator { /// Creates a new TAL, panics when the provided Cert is not a TA cert. pub fn new(uris: Vec, cert: &Cert) -> Self { if cert.authority_key_identifier().is_some() { - panic!("Trying to create TrustAnchorLocator for a non-TA certificate.") + panic!("Trying to create TAL for a non-TA certificate.") } let encoded_ski = cert.subject_public_key_info().to_info_bytes(); TrustAnchorLocator { uris, encoded_ski } @@ -148,13 +148,12 @@ impl RepoInfo { pub fn signed_object(&self, name_space: &str) -> uri::Rsync { match name_space { "" => self.base_uri.clone(), - _ => uri::Rsync::from_string(format!("{}{}/", self.base_uri.to_string(), name_space)).unwrap() + _ => self.base_uri.join(name_space.as_ref()).join(b"/") } } pub fn resolve(&self, name_space: &str, file_name: &str) -> uri::Rsync { - let uri = format!("{}{}", self.signed_object(name_space).to_string(), file_name); - uri::Rsync::from_string(uri).unwrap() + self.signed_object(name_space).join(file_name.as_ref()) } pub fn rpki_notify(&self) -> uri::Https { @@ -184,22 +183,14 @@ impl RepoInfo { impl PartialEq for RepoInfo { fn eq(&self, other: &RepoInfo) -> bool { - self.base_uri == other.base_uri && self.rpki_notify.as_str() == other.rpki_notify.as_str() + self.base_uri == other.base_uri && + self.rpki_notify.as_str() == other.rpki_notify.as_str() } } impl Eq for RepoInfo {} -//------------ ResourceClass ------------------------------------------------- - -#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] -pub struct ResourceClass { - name: String, - current_key: CaKey -} - - //------------ CaKey --------------------------------------------------------- #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] @@ -298,7 +289,11 @@ impl Default for CurrentObjects { } impl CurrentObjects { - pub fn insert(&mut self, name: String, object: CurrentObject) -> Option { + pub fn insert( + &mut self, + name: String, + object: CurrentObject + ) -> Option { self.0.insert(name, object) } @@ -505,7 +500,12 @@ pub struct ObjectsDelta { impl ObjectsDelta { pub fn new(signed_objects_uri: uri::Rsync) -> Self { - ObjectsDelta { signed_objects_uri, added: vec![], updated: vec![], withdrawn: vec![]} + ObjectsDelta { + signed_objects_uri, + added: vec![], + updated: vec![], + withdrawn: vec![] + } } pub fn add(&mut self, added: AddedObject) { @@ -523,27 +523,27 @@ impl Into for ObjectsDelta { fn into(self) -> publication::PublishDelta { let mut builder = publication::PublishDeltaBuilder::new(); - fn resolve(uri: &uri::Rsync, name: &str) -> uri::Rsync { - let uri = format!("{}{}", uri.to_string(), name); - uri::Rsync::from_string(uri).unwrap() - } - for a in self.added.into_iter() { let publish = publication::Publish::new( - None, resolve(&self.signed_objects_uri, &a.name), a.object.content + None, + self.signed_objects_uri.join(a.name.as_ref()), + a.object.content ); builder.add_publish(publish); } for u in self.updated.into_iter() { let update = publication::Update::new( - None, resolve(&self.signed_objects_uri, &u.name), u.object.content, u.old + None, + self.signed_objects_uri.join(u.name.as_ref()), + u.object.content, + u.old ); builder.add_update(update); } for w in self.withdrawn.into_iter() { let withdraw = publication::Withdraw::new( None, - resolve(&self.signed_objects_uri, &w.name), + self.signed_objects_uri.join(w.name.as_ref()), w.hash ); builder.add_withdraw(withdraw); @@ -615,10 +615,10 @@ pub struct ResourceSet { } impl ResourceSet { - pub fn from_strs(asns: &str, ipv4: &str, ipv6: &str) -> Result { - let asn = AsResources::from_str(asns).map_err(|_| ResourceSetError::AsnParsing)?; - let v4 = Ipv4Resources::from_str(ipv4).map_err(|_| ResourceSetError::Ipv4Parsing)?; - let v6 = Ipv6Resources::from_str(ipv6).map_err(|_| ResourceSetError::Ipv6Parsing)?; + pub fn from_strs(asn: &str, v4: &str, v6: &str) -> Result { + let asn = AsResources::from_str(asn).map_err(|_| ResSetErr::Asn)?; + let v4 = Ipv4Resources::from_str(v4).map_err(|_| ResSetErr::V4)?; + let v6 = Ipv6Resources::from_str(v6).map_err(|_| ResSetErr::V6)?; Ok(ResourceSet { asn , v4, v6 }) } @@ -708,21 +708,21 @@ impl TrustAnchorInfo { } } -//------------ ResourceSetError ---------------------------------------------- +//------------ ResSetErr ----------------------------------------------------- #[derive(Clone, Debug, Display, Eq, PartialEq)] -pub enum ResourceSetError { +pub enum ResSetErr { #[display(fmt="Cannot parse ASN resources")] - AsnParsing, + Asn, #[display(fmt="Cannot parse IPv4 resources")] - Ipv4Parsing, + V4, #[display(fmt="Cannot parse IPv6 resources")] - Ipv6Parsing, + V6, #[display(fmt="Mixed Address Families in configured resource set")] - MixedFamilies, + Mix, } From ce6bb662111ee345ec1f540caf0199901cd1580d Mon Sep 17 00:00:00 2001 From: Enrico Berti Date: Thu, 13 Jun 2019 09:37:27 +0200 Subject: [PATCH 2/4] Added navigation bar on top instead of landing page --- daemon/ui/src/App.vue | 40 ++++++++++++++++++++++++++++++++++-- daemon/ui/src/router.js | 3 +-- daemon/ui/src/views/Home.vue | 18 ---------------- daemon/ui/vue.config.js | 2 +- 4 files changed, 40 insertions(+), 23 deletions(-) delete mode 100644 daemon/ui/src/views/Home.vue diff --git a/daemon/ui/src/App.vue b/daemon/ui/src/App.vue index a3ecccdd..4fdde23e 100644 --- a/daemon/ui/src/App.vue +++ b/daemon/ui/src/App.vue @@ -10,7 +10,25 @@ - + + + + Publishers + + + Trust Anchor + + +   + +
@@ -44,6 +62,12 @@ body { color: #ffffff; z-index: 3; } +.el-menu-item a { + text-decoration: none; +} +.logo { + line-height: 10px; +} .logo img { width: 146px; margin-left: -14px; @@ -69,13 +93,25 @@ export default { langs: [ {iso: "it", label: "Italiano"}, {iso: "en", label: "English"} - ] + ], + activeIndex: null }; }, + watch: { + $route (to, from) { + this.activeIndex = this.getActiveIndex(to.name); + } + }, + mounted: function(){ + this.activeIndex = this.getActiveIndex(this.$route.name); + }, created() { this.loadUser(); }, methods: { + getActiveIndex(path) { + return ''+ (['publishers', 'trustanchor'].indexOf(path) + 1); + }, loadUser() { this.user = JSON.parse(localStorage.getItem("user")); }, diff --git a/daemon/ui/src/router.js b/daemon/ui/src/router.js index 87fe7245..ffde2f2a 100644 --- a/daemon/ui/src/router.js +++ b/daemon/ui/src/router.js @@ -1,7 +1,6 @@ import Vue from 'vue' import Router from 'vue-router' -import Home from './views/Home.vue' import Login from './views/Login.vue' import Publishers from './views/Publishers.vue' import PublisherDetails from './views/PublisherDetails.vue' @@ -15,7 +14,7 @@ const router = new Router({ { path: '/', name: 'home', - component: Home + redirect: { name: 'publishers' } }, { path: '/publishers', diff --git a/daemon/ui/src/views/Home.vue b/daemon/ui/src/views/Home.vue deleted file mode 100644 index 5e2d47ac..00000000 --- a/daemon/ui/src/views/Home.vue +++ /dev/null @@ -1,18 +0,0 @@ - \ No newline at end of file diff --git a/daemon/ui/vue.config.js b/daemon/ui/vue.config.js index 27147ecb..c2322325 100644 --- a/daemon/ui/vue.config.js +++ b/daemon/ui/vue.config.js @@ -2,7 +2,7 @@ const webpack = require('webpack') module.exports = { devServer: { - proxy: 'http://localhost:3000' + proxy: 'https://localhost:3000' }, publicPath: '/ui', From 344d90310f10d99d69f96a33258f89bf99cc8777 Mon Sep 17 00:00:00 2001 From: Enrico Berti Date: Thu, 13 Jun 2019 10:03:52 +0200 Subject: [PATCH 3/4] Restyled TA page --- daemon/ui/src/App.vue | 4 +- daemon/ui/src/locales/en.json | 1 + daemon/ui/src/views/TrustAnchor.vue | 243 +++++++++++++++------------- 3 files changed, 132 insertions(+), 116 deletions(-) diff --git a/daemon/ui/src/App.vue b/daemon/ui/src/App.vue index 4fdde23e..57b19e15 100644 --- a/daemon/ui/src/App.vue +++ b/daemon/ui/src/App.vue @@ -20,10 +20,10 @@ text-color="#fff" active-text-color="#fff"> - Publishers + {{ $t("publishers.publishers") }} - Trust Anchor + {{ $t("trustanchor.ta") }}   diff --git a/daemon/ui/src/locales/en.json b/daemon/ui/src/locales/en.json index f28dbfe4..9a71bf3e 100644 --- a/daemon/ui/src/locales/en.json +++ b/daemon/ui/src/locales/en.json @@ -27,6 +27,7 @@ "nopublisherdata": "No published data found." }, "trustanchor": { + "ta": "Trust Anchor", "absent": "There is no embedded Trust Anchor configured", "sure" : "Are you sure? You typically only need this in test and development situations.", "present": "Embedded Trust Anchor Details", diff --git a/daemon/ui/src/views/TrustAnchor.vue b/daemon/ui/src/views/TrustAnchor.vue index a3119fbe..7444a906 100644 --- a/daemon/ui/src/views/TrustAnchor.vue +++ b/daemon/ui/src/views/TrustAnchor.vue @@ -1,127 +1,142 @@ - \ No newline at end of file + From 092a507c20f05288891836c7b27cb46e656430bb Mon Sep 17 00:00:00 2001 From: Tim Bruijnzeels Date: Fri, 5 Jul 2019 15:14:57 +0200 Subject: [PATCH 4/4] Add dependency to actix-identity after this was removed in actix-web 1.0.2. --- daemon/Cargo.toml | 3 ++- daemon/src/auth.rs | 2 +- daemon/src/lib.rs | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/daemon/Cargo.toml b/daemon/Cargo.toml index 611c403e..b7cd2e7f 100644 --- a/daemon/Cargo.toml +++ b/daemon/Cargo.toml @@ -5,7 +5,8 @@ authors = ["Tim Bruijnzeels ", "Martin Hoffmann