Re: [Freeipa-devel] [PATCH] 0009 webui: Show certificates in useful format

2016-04-20 Thread Pavel Vomacka



On 04/15/2016 03:42 PM, Petr Vobornik wrote:

On 03/30/2016 12:46 PM, Pavel Vomacka wrote:


On 03/29/2016 11:42 AM, Pavel Vomacka wrote:


On 03/16/2016 06:56 PM, Petr Vobornik wrote:

On 03/15/2016 01:23 PM, Pavel Vomacka wrote:

Hello,

patch for https://fedorahosted.org/freeipa/ticket/5311 is attached.

--
Pavel^3 Vomacka


Not tested, but can we avoid using  s with "white-space: pre" and
therefore use only IPA.cert.pem_cert_format(text).

Also, it should be displayed in monospaced, so probably add:

.certificate-widget .certificate {
 font-family: monospace;
 overflow-x: auto;
 white-space: pre;
}

Fixed.


Probably as a separate patch or ticket: we can add "download" button which
would offer the certificate in form of data uri[1] with 'download' attribute
of 'a' element [2]. So user will get pem encoded file without any hassle.

[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs
[2] https://developer.mozilla.org/en/docs/Web/HTML/Element/a

The download button is really good idea. There is attached another patch which
adds this button. If we need new ticket let me know and I will file it.

--
Pavel^3 Vomacka



Self NACK, css parts should be moved to less files. Attaching new patches.


patch 9-3: ACK

patch 10-2:

1. Use @font-family-base variable (defined in variable.less) for the
font-family value
+a {
+font-family: 'Open Sans', Helvetica, Arial, sans-serif;
+float: right;
+}


2. Wouldn't it be better to put the download button next to the show
button? Or maybe in the actions menu which is planned in the next patches?

Yes, I would say that the best would be to leave this part to the 
planned actions menu as you wrote above.


Actually, this whole ticket will be fixed in ticket #5381.


--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [PATCH] 0009 webui: Show certificates in useful format

2016-04-15 Thread Petr Vobornik
On 03/30/2016 12:46 PM, Pavel Vomacka wrote:
> 
> 
> On 03/29/2016 11:42 AM, Pavel Vomacka wrote:
>>
>>
>> On 03/16/2016 06:56 PM, Petr Vobornik wrote:
>>> On 03/15/2016 01:23 PM, Pavel Vomacka wrote:
 Hello,

 patch for https://fedorahosted.org/freeipa/ticket/5311 is attached.

 -- 
 Pavel^3 Vomacka

>>>
>>> Not tested, but can we avoid using  s with "white-space: pre" and 
>>> therefore use only IPA.cert.pem_cert_format(text).
>>>
>>> Also, it should be displayed in monospaced, so probably add:
>>>
>>> .certificate-widget .certificate {
>>> font-family: monospace;
>>> overflow-x: auto;
>>> white-space: pre;
>>> }
>> Fixed.
>>>
>>>
>>> Probably as a separate patch or ticket: we can add "download" button which 
>>> would offer the certificate in form of data uri[1] with 'download' 
>>> attribute 
>>> of 'a' element [2]. So user will get pem encoded file without any hassle.
>>>
>>> [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs
>>> [2] https://developer.mozilla.org/en/docs/Web/HTML/Element/a
>> The download button is really good idea. There is attached another patch 
>> which 
>> adds this button. If we need new ticket let me know and I will file it.
>>
>> -- 
>> Pavel^3 Vomacka
>>
>>
> Self NACK, css parts should be moved to less files. Attaching new patches.
> 

patch 9-3: ACK

patch 10-2:

1. Use @font-family-base variable (defined in variable.less) for the
font-family value
+a {
+font-family: 'Open Sans', Helvetica, Arial, sans-serif;
+float: right;
+}


2. Wouldn't it be better to put the download button next to the show
button? Or maybe in the actions menu which is planned in the next patches?

-- 
Petr Vobornik

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


Re: [Freeipa-devel] [PATCH] 0009 webui: Show certificates in useful format

2016-03-30 Thread Pavel Vomacka



On 03/29/2016 11:42 AM, Pavel Vomacka wrote:



On 03/16/2016 06:56 PM, Petr Vobornik wrote:

On 03/15/2016 01:23 PM, Pavel Vomacka wrote:

Hello,

patch for https://fedorahosted.org/freeipa/ticket/5311 is attached.

--
Pavel^3 Vomacka



Not tested, but can we avoid using  s with "white-space: pre" and 
therefore use only IPA.cert.pem_cert_format(text).


Also, it should be displayed in monospaced, so probably add:

.certificate-widget .certificate {
font-family: monospace;
overflow-x: auto;
white-space: pre;
}

Fixed.



Probably as a separate patch or ticket: we can add "download" button 
which would offer the certificate in form of data uri[1] with 
'download' attribute of 'a' element [2]. So user will get pem encoded 
file without any hassle.


[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs
[2] https://developer.mozilla.org/en/docs/Web/HTML/Element/a
The download button is really good idea. There is attached another 
patch which adds this button. If we need new ticket let me know and I 
will file it.


--
Pavel^3 Vomacka



Self NACK, css parts should be moved to less files. Attaching new patches.
>From 605bca736d2f7420b416a985fa89df38425081f0 Mon Sep 17 00:00:00 2001
From: Pavel Vomacka 
Date: Tue, 15 Mar 2016 11:51:35 +0100
Subject: [PATCH] Show certificate in useful format

Certificates are shown in PEM format which includes BEGIN and END CERTIFICATE string
and all lines are wrapped at 64 characters.

https://fedorahosted.org/freeipa/ticket/5311
---
 install/ui/less/widgets.less  | 4 +++-
 install/ui/src/freeipa/certificate.js | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/install/ui/less/widgets.less b/install/ui/less/widgets.less
index 0f9bc8c171d5c35d955c6b55d2e95ee105c35159..b1b7ea5e6bf69b61ec300611bc23b6bcc7a20327 100644
--- a/install/ui/less/widgets.less
+++ b/install/ui/less/widgets.less
@@ -138,7 +138,9 @@
 padding-right: 10px;
 }
 .certificate {
-word-wrap: break-word;
+font-family: monospace;
+overflow-x: auto;
+white-space: pre;
 padding-bottom: 10px;
 }
 }
diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js
index ae05ebb3d45974cd1df50c16e19d0ab9fd27a19b..670bc3b0902bc87b1a6fbcb6e34d23ed8fa31b8d 100755
--- a/install/ui/src/freeipa/certificate.js
+++ b/install/ui/src/freeipa/certificate.js
@@ -1056,9 +1056,10 @@ IPA.cert.cert_widget = function(spec) {
 
 if (l && that.certs_visible) {
 for (var i=0; iFrom a4027f60328857301f3839392340f714ab029e6b Mon Sep 17 00:00:00 2001
From: Pavel Vomacka 
Date: Wed, 30 Mar 2016 12:34:54 +0200
Subject: [PATCH] Add download button for certificates

Add button for each certificate which allows user to download certificate as PEM
formatted file.

https://fedorahosted.org/freeipa/ticket/5311
---
 install/ui/less/widgets.less  |  5 +
 install/ui/src/freeipa/certificate.js | 18 +-
 install/ui/test/data/ipa_init.json|  2 ++
 ipalib/plugins/internal.py|  2 ++
 4 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/install/ui/less/widgets.less b/install/ui/less/widgets.less
index b1b7ea5e6bf69b61ec300611bc23b6bcc7a20327..57de1724ebd7013635cb47c2aeb146d3aa9a9ad1 100644
--- a/install/ui/less/widgets.less
+++ b/install/ui/less/widgets.less
@@ -142,6 +142,11 @@
 overflow-x: auto;
 white-space: pre;
 padding-bottom: 10px;
+
+a {
+font-family: 'Open Sans', Helvetica, Arial, sans-serif;
+float: right;
+}
 }
 }
 
diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js
index 670bc3b0902bc87b1a6fbcb6e34d23ed8fa31b8d..c91428710f7916889ad9c69afe66bb047e935bc1 100755
--- a/install/ui/src/freeipa/certificate.js
+++ b/install/ui/src/freeipa/certificate.js
@@ -1049,6 +1049,13 @@ IPA.cert.cert_widget = function(spec) {
 return status;
 };
 
+that.create_data_uri = function(cert) {
+var format = 'data:,';
+var uri_new_line = '%0A';
+
+return format + cert.replace(/\n/g, uri_new_line);
+};
+
 that.create_certs = function() {
 
 that.content_el.empty();
@@ -1057,10 +1064,19 @@ IPA.cert.cert_widget = function(spec) {
 if (l && that.certs_visible) {
 for (var i=0; i

Re: [Freeipa-devel] [PATCH] 0009 webui: Show certificates in useful format

2016-03-29 Thread Pavel Vomacka



On 03/16/2016 06:56 PM, Petr Vobornik wrote:

On 03/15/2016 01:23 PM, Pavel Vomacka wrote:

Hello,

patch for https://fedorahosted.org/freeipa/ticket/5311 is attached.

--
Pavel^3 Vomacka



Not tested, but can we avoid using  s with "white-space: pre" and 
therefore use only IPA.cert.pem_cert_format(text).


Also, it should be displayed in monospaced, so probably add:

.certificate-widget .certificate {
font-family: monospace;
overflow-x: auto;
white-space: pre;
}

Fixed.



Probably as a separate patch or ticket: we can add "download" button 
which would offer the certificate in form of data uri[1] with 
'download' attribute of 'a' element [2]. So user will get pem encoded 
file without any hassle.


[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs
[2] https://developer.mozilla.org/en/docs/Web/HTML/Element/a
The download button is really good idea. There is attached another patch 
which adds this button. If we need new ticket let me know and I will 
file it.


--
Pavel^3 Vomacka
>From d50fcd65531efa56b17cd8e63e1be518cf3fbcba Mon Sep 17 00:00:00 2001
From: Pavel Vomacka 
Date: Tue, 15 Mar 2016 11:51:35 +0100
Subject: [PATCH] Show certificate in useful format

Certificates are shown in PEM format which includes BEGIN and END CERTIFICATE string
and all lines are wrapped at 64 characters.

https://fedorahosted.org/freeipa/ticket/5311
---
 install/ui/ipa.css| 8 
 install/ui/src/freeipa/certificate.js | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index f419eb224252aa03eaf4b25bb03435f4c9a6de9b..a1910560641d703557b06cd7ce8efa73296950d4 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -555,3 +555,11 @@ table.scrollable tbody {
 font-weight: bold;
 font-size: 1.1em;
 }
+
+/* --- Certificates --- */
+
+.certificate-widget .certificate {
+font-family: monospace;
+overflow-x: auto;
+white-space: pre;
+}
diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js
index ae05ebb3d45974cd1df50c16e19d0ab9fd27a19b..670bc3b0902bc87b1a6fbcb6e34d23ed8fa31b8d 100755
--- a/install/ui/src/freeipa/certificate.js
+++ b/install/ui/src/freeipa/certificate.js
@@ -1056,9 +1056,10 @@ IPA.cert.cert_widget = function(spec) {
 
 if (l && that.certs_visible) {
 for (var i=0; iFrom ca9e0eaf930ac9d5344404fd0737fd1876477513 Mon Sep 17 00:00:00 2001
From: Pavel Vomacka 
Date: Tue, 29 Mar 2016 11:24:50 +0200
Subject: [PATCH] Add download button for certificates

Add button for each certificate which allows user to download certificate to PEM
formatted file.

https://fedorahosted.org/freeipa/ticket/5311
---
 install/ui/ipa.css|  5 +
 install/ui/src/freeipa/certificate.js | 19 ++-
 install/ui/test/data/ipa_init.json|  2 ++
 ipalib/plugins/internal.py|  2 ++
 4 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index a1910560641d703557b06cd7ce8efa73296950d4..99a09132a7e81493316ce790f3a5c31fcd1d8bee 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -563,3 +563,8 @@ table.scrollable tbody {
 overflow-x: auto;
 white-space: pre;
 }
+
+.certificate-widget .certificate a {
+font-family: 'Open Sans', Helvetica, Arial, sans-serif;
+float: right;
+}
diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js
index 670bc3b0902bc87b1a6fbcb6e34d23ed8fa31b8d..8edbba5d800dae075282a27191119d3881961bb9 100755
--- a/install/ui/src/freeipa/certificate.js
+++ b/install/ui/src/freeipa/certificate.js
@@ -1049,6 +1049,13 @@ IPA.cert.cert_widget = function(spec) {
 return status;
 };
 
+that.create_data_uri = function(cert) {
+var format = 'data:,';
+var uri_new_line = '%0A';
+
+return format + cert.replace(/\n/g, uri_new_line);
+};
+
 that.create_certs = function() {
 
 that.content_el.empty();
@@ -1057,10 +1064,20 @@ IPA.cert.cert_widget = function(spec) {
 if (l && that.certs_visible) {
 for (var i=0; i

Re: [Freeipa-devel] [PATCH] 0009 webui: Show certificates in useful format

2016-03-19 Thread Petr Vobornik

On 03/15/2016 01:23 PM, Pavel Vomacka wrote:

Hello,

patch for https://fedorahosted.org/freeipa/ticket/5311 is attached.

--
Pavel^3 Vomacka



Not tested, but can we avoid using  s with "white-space: pre" and 
therefore use only IPA.cert.pem_cert_format(text).


Also, it should be displayed in monospaced, so probably add:

.certificate-widget .certificate {
font-family: monospace;
overflow-x: auto;
white-space: pre;
}


Probably as a separate patch or ticket: we can add "download" button 
which would offer the certificate in form of data uri[1] with 'download' 
attribute of 'a' element [2]. So user will get pem encoded file without 
any hassle.


[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs
[2] https://developer.mozilla.org/en/docs/Web/HTML/Element/a
--
Petr Vobornik

--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code


[Freeipa-devel] [PATCH] 0009 webui: Show certificates in useful format

2016-03-15 Thread Pavel Vomacka

Hello,

patch for https://fedorahosted.org/freeipa/ticket/5311 is attached.

--
Pavel^3 Vomacka


>From 01d99f2a8b576c48ccf31c8dbccb293021104f5e Mon Sep 17 00:00:00 2001
From: Pavel Vomacka 
Date: Tue, 15 Mar 2016 11:51:35 +0100
Subject: [PATCH] Show certificate in useful format

Certificates are shown in PEM format which includes BEGIN and END CERTIFICATE string
and all lines are wrapped at 64 characters.

https://fedorahosted.org/freeipa/ticket/5311
---
 install/ui/src/freeipa/certificate.js | 30 +++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js
index ae05ebb3d45974cd1df50c16e19d0ab9fd27a19b..ef36f5c08c7d3e5674fcd2aa671ed0d0b579547a 100755
--- a/install/ui/src/freeipa/certificate.js
+++ b/install/ui/src/freeipa/certificate.js
@@ -182,6 +182,29 @@ IPA.cert.pem_csr_format = function(text) {
IPA.cert.END_CERTIFICATE_REQUEST;
 };
 
+IPA.cert.cert_to_html_format = function(text) {
+/*
+ * Input is assumed to be eihter PEM formatted data or the base64
+ * encoding of DER binary certificate data. Return data in PEM
+ * format is prepared for using in html. All line breaks are
+ * substituted with  element. The function checks if the input
+ * is PEM formatted, if so it parses base64 part and then it uses
+ * this part for creating PEM formated certificate. This is done
+ * because of possibility of missing new lines in base64 encoded
+ * part. Otherwise the input is in the base64 format and it is
+ * retransformed into PEM format with HTML new lines.
+ */
+if (text.match(IPA.cert.PEM_CERT_REGEXP)) {
+var matched_groups = IPA.cert.PEM_CERT_REGEXP.exec(text);
+var base64 = matched_groups[2];
+text = base64;
+}
+
+var formatted = IPA.cert.pem_cert_format(text);
+
+return formatted.replace(/\n+/g,"");
+};
+
 IPA.cert.download_dialog = function(spec) {
 
 spec = spec || {};
@@ -1056,10 +1079,11 @@ IPA.cert.cert_widget = function(spec) {
 
 if (l && that.certs_visible) {
 for (var i=0; i