Merge pull request #58 from amarkevich/FEDIZ-248

FEDIZ-248: OIDC UI: shared stylesheet
diff --git a/services/oidc/src/main/resources/static/styles.css b/services/oidc/src/main/resources/static/styles.css
new file mode 100644
index 0000000..2e3962b
--- /dev/null
+++ b/services/oidc/src/main/resources/static/styles.css
@@ -0,0 +1,86 @@
+table {

+    border-collapse: collapse;

+}

+

+table th {

+    background-color: #f0f0f0;

+    border-color: #ccc;

+    border-style: solid;

+    border-width: 1px;

+    padding: 3px 4px;

+    text-align: center;

+}

+

+table td {

+    border-color: #ccc;

+    border-style: solid;

+    border-width: 1px;

+    padding: 3px 4px;

+}

+

+.table_no_border {

+    border-collapse: collapse;

+}

+

+.table_no_border .td_no_border {

+    padding: 0;

+    border-width: 0px;

+}

+

+.form {

+    max-width: 425px;

+    margin-bottom: 25px;

+    margin-left: auto;

+    margin-right: auto;

+}

+

+.form-line {

+    margin: 6 0 6 0;

+    padding: 12 12 12 12;

+}

+

+.form-submit-button {

+    padding: 4px;

+    text-align: center;

+}

+

+h2 {

+    font-size: 1.5em;

+    /*font-family: verdana, arial, helvetica, sans-serif;*/

+    margin: 0;

+}

+

+.center {

+    text-align: center;

+}

+

+.header-text {

+    border-bottom: 1px solid gray;

+    padding: 24px 0;

+    margin: 12px 36px 12px;

+}

+

+label {

+    font-weight: bold;

+    margin-bottom: 9px;

+    display: block;

+    white-space: normal;

+}

+

+.form-required {

+    color: red;

+    margin-left: 5px;

+}

+

+input, select, button {

+    width: 100%;

+}

+

+.form-submit-button {

+    padding: 4px;

+    text-align: center;

+}

+

+.padded {

+    display: table;

+}

diff --git a/services/oidc/src/main/webapp/WEB-INF/views/client.jsp b/services/oidc/src/main/webapp/WEB-INF/views/client.jsp
index f66f04b..26cf464 100644
--- a/services/oidc/src/main/webapp/WEB-INF/views/client.jsp
+++ b/services/oidc/src/main/webapp/WEB-INF/views/client.jsp
@@ -20,55 +20,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
     <title>API Client Information</title>
-    <STYLE TYPE="text/css">
-    	table {
-		    border-collapse: collapse;
-		}
-		table th {
-		    background-color: #f0f0f0;
-		    border-color: #ccc;
-		    border-style: solid;
-		    border-width: 1px;
-                    padding: 3px 4px;
-		    text-align: center;
-		}
-		table td {
-		    border-color: #ccc;
-		    border-style: solid;
-                    border-width: 1px;
-                    padding: 3px 4px;
-		}
-
-
-
-.table_no_border {
-    border-collapse: collapse;
-}
-.table_no_border .td_no_border {
-    padding: 0;
-    border-width: 0px;
-}
-
-
-		
-.form {
-	max-width: 425px;
-	margin-bottom: 25px;
-	margin-left: auto;
-	margin-right: auto;
-}
-
-.form-line {
-	margin: 6 0 6 0;
-	padding: 12 12 12 12;
-}
-
-.form-submit-button {
-	padding: 4px;
-	text-align: center;
-}
-		
-	</STYLE>
+    <link rel="stylesheet" href="<%= basePath %>static/styles.css">
 </head>
 <body>
 <div class="padded">
diff --git a/services/oidc/src/main/webapp/WEB-INF/views/clientCodeGrants.jsp b/services/oidc/src/main/webapp/WEB-INF/views/clientCodeGrants.jsp
index 02947f9..2babf21 100644
--- a/services/oidc/src/main/webapp/WEB-INF/views/clientCodeGrants.jsp
+++ b/services/oidc/src/main/webapp/WEB-INF/views/clientCodeGrants.jsp
@@ -24,25 +24,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
     <title>Client Refresh Tokens</title>
-    <STYLE TYPE="text/css">
-    	table {
-		    border-collapse: collapse;
-		}
-		table th {
-		    background-color: #f0f0f0;
-		    border-color: #ccc;
-		    border-style: solid;
-		    border-width: 1px;
-		    padding: 3px 4px;
-		    text-align: center;
-		}
-		table td {
-		    border-color: #ccc;
-		    border-style: solid;
-		    border-width: 1px;
-		    padding: 3px 4px;
-		}
-	</STYLE>
+    <link rel="stylesheet" href="<%= basePath %>static/styles.css">
 </head>
 <body>
 <div class="padded">
diff --git a/services/oidc/src/main/webapp/WEB-INF/views/clientTokens.jsp b/services/oidc/src/main/webapp/WEB-INF/views/clientTokens.jsp
index 807d6af..ab47846 100644
--- a/services/oidc/src/main/webapp/WEB-INF/views/clientTokens.jsp
+++ b/services/oidc/src/main/webapp/WEB-INF/views/clientTokens.jsp
@@ -27,25 +27,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
     <title>Client Access Tokens</title>
-    <STYLE TYPE="text/css">
-    	table {
-		    border-collapse: collapse;
-		}
-		table th {
-		    background-color: #f0f0f0;
-		    border-color: #ccc;
-		    border-style: solid;
-		    border-width: 1px;
-		    padding: 3px 4px;
-		    text-align: center;
-		}
-		table td {
-		    border-color: #ccc;
-		    border-style: solid;
-		    border-width: 1px;
-		    padding: 3px 4px;
-		}
-	</STYLE>
+    <link rel="stylesheet" href="<%= basePath %>static/styles.css">
 </head>
 <body>
 <h1>Tokens issued to <%= StringEscapeUtils.escapeHtml4(client.getApplicationName()) + " (" + client.getClientId() + ")"%></h1>
diff --git a/services/oidc/src/main/webapp/WEB-INF/views/editClient.jsp b/services/oidc/src/main/webapp/WEB-INF/views/editClient.jsp
index 4f24410..403dd7b 100644
--- a/services/oidc/src/main/webapp/WEB-INF/views/editClient.jsp
+++ b/services/oidc/src/main/webapp/WEB-INF/views/editClient.jsp
@@ -16,55 +16,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title>Client Registration Form</title>
-<style TYPE="text/css">
-<!--
-h2 {
-	font-size: 1.5em;
-	font-family: verdana, arial, helvetica, sans-serif;
-	margin: 0;
-	text-align: center;
-}
-
-.header-text {
-	border-bottom: 1px solid gray;
-	padding: 24px 0;
-	margin: 12px 36px 12px;
-}
-
-label {
-	font-weight: bold;
-	margin-bottom: 9px;
-	display: block;
-	white-space: normal;
-}
-
-.form {
-	max-width: 425px;
-	margin-bottom: 25px;
-	margin-left: auto;
-	margin-right: auto;
-}
-
-.form-line {
-	margin: 6 0 6 0;
-	padding: 12 36 12 36;
-}
-
-.form-required {
-	color: red;
-	margin-left: 5px;
-}
-
-input, select, button {
-	width: 100%;
-}
-
-.form-submit-button {
-	padding: 4px;
-	text-align: center;
-}
--->
-</style>
+    <link rel="stylesheet" href="<%= basePath %>static/styles.css">
 </head>
 <body>
 	<form action="<%= basePath + "console/clients/" + c.getClientId() %>" method="POST">
diff --git a/services/oidc/src/main/webapp/WEB-INF/views/invalidRegistration.jsp b/services/oidc/src/main/webapp/WEB-INF/views/invalidRegistration.jsp
index 9681b2c..28737a0 100644
--- a/services/oidc/src/main/webapp/WEB-INF/views/invalidRegistration.jsp
+++ b/services/oidc/src/main/webapp/WEB-INF/views/invalidRegistration.jsp
@@ -11,6 +11,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
     <title>Invalid Client Registration</title>
+    <link rel="stylesheet" href="<%= basePath %>static/styles.css">
 </head>
 <body>
 <div class="padded">
diff --git a/services/oidc/src/main/webapp/WEB-INF/views/registerClient.jsp b/services/oidc/src/main/webapp/WEB-INF/views/registerClient.jsp
index 870e01a..4c11438 100644
--- a/services/oidc/src/main/webapp/WEB-INF/views/registerClient.jsp
+++ b/services/oidc/src/main/webapp/WEB-INF/views/registerClient.jsp
@@ -15,55 +15,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title>Client Registration Form</title>
-<style TYPE="text/css">
-<!--
-h2 {
-	font-size: 1.5em;
-	font-family: verdana, arial, helvetica, sans-serif;
-	margin: 0;
-	text-align: center;
-}
-
-.header-text {
-	border-bottom: 1px solid gray;
-	padding: 24px 0;
-	margin: 12px 36px 12px;
-}
-
-label {
-	font-weight: bold;
-	margin-bottom: 9px;
-	display: block;
-	white-space: normal;
-}
-
-.form {
-	max-width: 425px;
-	margin-bottom: 25px;
-	margin-left: auto;
-	margin-right: auto;
-}
-
-.form-line {
-	margin: 6 0 6 0;
-	padding: 12 36 12 36;
-}
-
-.form-required {
-	color: red;
-	margin-left: 5px;
-}
-
-input, select, button {
-	width: 100%;
-}
-
-.form-submit-button {
-	padding: 4px;
-	text-align: center;
-}
--->
-</style>
+    <link rel="stylesheet" href="<%= basePath %>static/styles.css">
 </head>
 <body>
 	<form action="<%=basePath%>console/clients" method="POST">
diff --git a/services/oidc/src/main/webapp/WEB-INF/views/registeredClients.jsp b/services/oidc/src/main/webapp/WEB-INF/views/registeredClients.jsp
index 33cd123..cd4a2b1 100644
--- a/services/oidc/src/main/webapp/WEB-INF/views/registeredClients.jsp
+++ b/services/oidc/src/main/webapp/WEB-INF/views/registeredClients.jsp
@@ -18,36 +18,18 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
     <title>Registered Clients</title>
-    <STYLE TYPE="text/css">
-    	table {
-		    border-collapse: collapse;
-		}
-		table th {
-		    background-color: #f0f0f0;
-		    border-color: #ccc;
-		    border-style: solid;
-		    border-width: 1px;
-		    padding: 3px 4px;
-		    text-align: center;
-		}
-		table td {
-		    border-color: #ccc;
-		    border-style: solid;
-		    border-width: 1px;
-		    padding: 3px 4px;
-		}
-	</STYLE>
+    <link rel="stylesheet" href="<%= basePath %>static/styles.css">
 </head>
 <body>
 <div class="padded">
 <h1>Registered Clients</h1>
 <br/>
-<table border="1" id=registered_clients>
+<table id="registered_clients">
     <tr><th>Name</th><th>ID</th><th>Creation Date</th><th>Redirect URI</th></tr> 
     <%
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM yyyy", Locale.US);
        dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
-               
+
        for (Client client : regs) {
     %>
        <tr>
diff --git a/services/oidc/src/main/webapp/WEB-INF/views/userConsole.jsp b/services/oidc/src/main/webapp/WEB-INF/views/userConsole.jsp
index 063fe9e..6d8218e 100644
--- a/services/oidc/src/main/webapp/WEB-INF/views/userConsole.jsp
+++ b/services/oidc/src/main/webapp/WEB-INF/views/userConsole.jsp
@@ -10,58 +10,10 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title>User Account</title>
-<style TYPE="text/css">
-<!--
-h2 {
-	font-size: 1.5em;
-	font-family: verdana, arial, helvetica, sans-serif;
-	margin: 0;
-	text-align: center;
-}
-
-.header-text {
-	border-bottom: 1px solid gray;
-	padding: 24px 0;
-	margin: 12px 36px 12px;
-}
-
-label {
-	font-weight: bold;
-	margin-bottom: 9px;
-	display: block;
-	white-space: normal;
-}
-
-.form {
-	max-width: 425px;
-	margin-bottom: 25px;
-	margin-left: auto;
-	margin-right: auto;
-}
-
-.form-line {
-	margin: 6 0 6 0;
-	padding: 12 36 12 36;
-}
-
-.form-required {
-	color: red;
-	margin-left: 5px;
-}
-
-input, select, button {
-	width: 100%;
-}
-
-.form-submit-button {
-	padding: 4px;
-	text-align: center;
-}
--->
-</style>
+    <link rel="stylesheet" href="<%= basePath %>static/styles.css">
 </head>
 <body>
-    <h2>Welcome to Fediz OpenId Connect Console</h2>
+    <h2 class="center">Welcome to Fediz OpenId Connect Console</h2>
 	<p><a href="<%=basePath%>console/clients">Client Registrations</a></p>
 </body>
 </html>
diff --git a/services/oidc/src/main/webapp/WEB-INF/web.xml b/services/oidc/src/main/webapp/WEB-INF/web.xml
index 15c61fc..5233c0a 100644
--- a/services/oidc/src/main/webapp/WEB-INF/web.xml
+++ b/services/oidc/src/main/webapp/WEB-INF/web.xml
@@ -59,6 +59,14 @@
     <servlet>
         <servlet-name>FederationServlet</servlet-name>
         <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+        <init-param>
+            <param-name>static-resources-list</param-name>
+            <param-value>/static/(\w)+.css</param-value>
+        </init-param>
+        <init-param>
+            <param-name>static-cache-control</param-name>
+            <param-value>public, max-age=31536000</param-value>
+        </init-param>
     </servlet>
 
     <servlet-mapping>