cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject [1/2] cxf git commit: [CXF-6490] Finalizing the demo
Date Wed, 22 Jul 2015 12:33:35 GMT
Repository: cxf
Updated Branches:
  refs/heads/master a614b7538 -> 8c4dab45a


[CXF-6490] Finalizing the demo


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/817727dd
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/817727dd
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/817727dd

Branch: refs/heads/master
Commit: 817727ddca9aad39a66f7001bf5f1c959dc7f581
Parents: a614b75
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Jul 22 15:32:18 2015 +0300
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Jul 22 15:32:18 2015 +0300

----------------------------------------------------------------------
 .../basic_oidc/src/main/webapp/forms/idToken.jsp     | 14 ++++++++++----
 .../src/main/webapp/forms/oidcClientContext.jsp      | 14 --------------
 .../src/main/webapp/forms/oidcClientTokenContext.jsp | 10 ++++++++++
 .../basic_oidc/src/main/webapp/simpleLogin.html      | 15 +++++++++++----
 4 files changed, 31 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/817727dd/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/forms/idToken.jsp
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/forms/idToken.jsp
b/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/forms/idToken.jsp
index 5287de7..3791563 100644
--- a/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/forms/idToken.jsp
+++ b/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/forms/idToken.jsp
@@ -1,4 +1,4 @@
-<%@ page import="javax.servlet.http.HttpServletRequest, org.apache.cxf.rs.security.oidc.common.IdToken"
%>
+<%@ page import="javax.servlet.http.HttpServletRequest, java.util.Map, org.apache.cxf.rs.security.oidc.common.IdToken"
%>
 
 <%
     IdToken token = (IdToken) request.getAttribute("data");
@@ -10,7 +10,7 @@
 	<!--
 	  input {font-family:verdana, arial, helvetica, sans-serif;font-size:20px;line-height:40px;}
 	  div.padded {  
-         padding-left: 5em;  
+         padding-left: 1em;  
       } 
 	-->
 </STYLE>
@@ -22,10 +22,16 @@
 <p>
 <table border="1">
     <tr><th><big><big>Property</big></big></th><th><big><big>Value</big></big></th></tr>

+    <%
+       for (Map.Entry<String, Object> entry : token.asMap().entrySet()) {
+    %>
     <tr>
-       <td><big>Email</big></big></td>
-       <td><big><big><%= token.getClaim("email") %></big></big></td>
+       <td><big><%= entry.getKey() %></big></big></td>
+       <td><big><big><%= entry.getValue().toString() %></big></big></td>
     </tr>
+    <%
+       }
+    %>
 </table> 
 </div> 
 </body>

http://git-wip-us.apache.org/repos/asf/cxf/blob/817727dd/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/forms/oidcClientContext.jsp
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/forms/oidcClientContext.jsp
b/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/forms/oidcClientContext.jsp
deleted file mode 100644
index e07d044..0000000
--- a/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/forms/oidcClientContext.jsp
+++ /dev/null
@@ -1,14 +0,0 @@
-<%@ page import="javax.servlet.http.HttpServletRequest, org.apache.cxf.rs.security.oidc.rp.OidcClientTokenContext"
%>
-
-<%
-    OidcClientTokenContext oidc = (OidcClientTokenContext) request.getAttribute("data");
-    String basePath = request.getContextPath() + request.getServletPath();
-    if (!basePath.endsWith("/")) {
-        basePath += "/";
-    }
-%>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<div class="padded">
-</div>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/cxf/blob/817727dd/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/forms/oidcClientTokenContext.jsp
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/forms/oidcClientTokenContext.jsp
b/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/forms/oidcClientTokenContext.jsp
new file mode 100644
index 0000000..2a43e29
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/forms/oidcClientTokenContext.jsp
@@ -0,0 +1,10 @@
+<%@ page import="javax.servlet.http.HttpServletRequest, org.apache.cxf.rs.security.oidc.rp.OidcClientTokenContext"
%>
+
+<%
+    OidcClientTokenContext oidc = (OidcClientTokenContext) request.getAttribute("data");
+%>
+<html>
+<body>
+<name><%= oidc.getIdToken().getClaim("name") %></name>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/cxf/blob/817727dd/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/simpleLogin.html
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/simpleLogin.html
b/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/simpleLogin.html
index 01f39ce..9bf1ec5 100644
--- a/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/simpleLogin.html
+++ b/distribution/src/main/release/samples/jax_rs/basic_oidc/src/main/webapp/simpleLogin.html
@@ -14,25 +14,32 @@
     <script src="https://apis.google.com/js/platform.js" async defer></script>
   </head>
   <body>
-    <div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
     <script>
       function onSignIn(googleUser) {
         var id_token = googleUser.getAuthResponse().id_token;
         var xhr = new XMLHttpRequest();
         xhr.onload = function() {
-          
+            var parser = new DOMParser();
+            var dom = parser.parseFromString(xhr.responseText, "text/xml");
+            var userName = dom.getElementsByTagName("name")[0].childNodes[0].nodeValue;
+            document.getElementById("submitButton").disabled = false;
+            document.getElementById("welcome").childNodes[0].nodeValue = userName + ", ";
         }
         xhr.open('POST', 'https://localhost:8080/user/service/oidc/rp/signin');
         xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
         xhr.send('idtoken=' + id_token);
       };
     </script>
+    
     <div class="padded">
-<h1>Welcome to IdToken Service</h1>
+    <div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
+    <p/>
+    <div id="welcome">&nbsp;</div>
+<h2>Welcome to IdToken Service</h2>
 <em/>
 <p/>
      <form action="https://localhost:8080/user/service/info/token" method="POST">
-         <input type="submit" value="Display IdToken Properties"/>
+         <input type="submit" id="submitButton" disabled="true" value="Display IdToken
Properties"/>
      </form>
 </div>
   </body>


Mime
View raw message