This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
web-integration:java-example [2019/08/15 06:15] 740803864 |
web-integration:java-example [2020/02/29 10:52] mpospisek |
||
---|---|---|---|
Line 25: | Line 25: | ||
==== Open ==== | ==== Open ==== | ||
First one starts authentication process: | First one starts authentication process: | ||
- | <code java> | + | <sxh java> |
@WebServlet("/ | @WebServlet("/ | ||
public class OpenServlet extends HttpServlet { | public class OpenServlet extends HttpServlet { | ||
Line 67: | Line 67: | ||
} | } | ||
- | </code> | + | </sxh> |
Some minor notes to source code: | Some minor notes to source code: | ||
* way to get '' | * way to get '' | ||
Line 76: | Line 76: | ||
This servlet asks for authentication operation status: | This servlet asks for authentication operation status: | ||
- | <code java> | + | <sxh java> |
@WebServlet("/ | @WebServlet("/ | ||
public class ProxyServlet extends HttpServlet { | public class ProxyServlet extends HttpServlet { | ||
Line 109: | Line 109: | ||
} | } | ||
- | </code> | + | </sxh> |
Notes to source code: | Notes to source code: | ||
Line 116: | Line 116: | ||
==== Open Check ==== | ==== Open Check ==== | ||
Servlet evaluating authentication operation result: | Servlet evaluating authentication operation result: | ||
- | <code java> | + | <sxh java> |
@WebServlet("/ | @WebServlet("/ | ||
public class OpenCheckServlet extends HttpServlet { | public class OpenCheckServlet extends HttpServlet { | ||
Line 153: | Line 153: | ||
} | } | ||
- | </code> | + | </sxh> |
Some notes to source code: | Some notes to source code: | ||
Line 159: | Line 159: | ||
===== Web Integration ===== | ===== Web Integration ===== | ||
- | Servlets described earlier are used in part of web integration. Self-explaining example is | ||
+ | ==== Start Page ==== | ||
+ | |||
+ | Servlets described earlier are used in '' | ||
+ | |||
+ | <sxh javascript> | ||
+ | <html xmlns=" | ||
+ | |||
+ | < | ||
+ | <script type=" | ||
+ | <script type=" | ||
+ | |||
+ | <script type=" | ||
+ | var aducid = new ADUCID(); | ||
+ | $(document).ready(function() { | ||
+ | aducid.setAuthentication(); | ||
+ | |||
+ | aducid.setStartOperationUrl(" | ||
+ | aducid.setResultOperationUrl(" | ||
+ | aducid.setProxyUrl(" | ||
+ | |||
+ | aducid.processResult = function(result) { | ||
+ | if (result.status == " | ||
+ | alert(" | ||
+ | location.href = result.redirect; | ||
+ | } else { | ||
+ | alert(" | ||
+ | location.href = result.redirect; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // handle PEIG not installed error | ||
+ | aducid.showPeigError = function() { | ||
+ | alert(" | ||
+ | } | ||
+ | |||
+ | // handle communication or other error | ||
+ | aducid.handleError = function(e) { | ||
+ | alert(e.data.message); | ||
+ | } | ||
+ | |||
+ | aducid.showQRHint = function(param) { | ||
+ | $('# | ||
+ | } | ||
+ | |||
+ | aducid.showRunningHint = function(param) { | ||
+ | $('# | ||
+ | }; | ||
+ | |||
+ | aducid.startAnimation = function() { | ||
+ | $("# | ||
+ | }; | ||
+ | |||
+ | aducid.stopRunningAnimation = function() { | ||
+ | $("# | ||
+ | }; | ||
+ | |||
+ | // GUI mapping | ||
+ | aducid.setButton($("# | ||
+ | aducid.setQrCode($("# | ||
+ | aducid.setQrHint($("# | ||
+ | |||
+ | // start | ||
+ | aducid.init(); | ||
+ | }); | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | <img id=" | ||
+ | <div id=" | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== Result Page ==== | ||
+ | |||
+ | After successful authentication, | ||
+ | |||
+ | <sxh javascript> | ||
+ | <html xmlns=" | ||
+ | |||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | |||
+ | < | ||
+ | UDI: ${result.userDatabaseIndex} | ||
+ | < | ||
+ | <a href=" | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | </ | ||
===== Web Application Configuration File ===== | ===== Web Application Configuration File ===== | ||
- | This file is required by Servlet API. This file provides | + | This file is required by Servlet API. File provides '' |
<code xml> | <code xml> | ||
Line 182: | Line 279: | ||
</ | </ | ||
- | </code> | + | </sxh> |
Value '' | Value '' | ||
Line 188: | Line 285: | ||
===== Maven Configuration File ===== | ===== Maven Configuration File ===== | ||
+ | Maven configuration file contents definition of plugin to generate WS classes and instruction to filter '' | ||
+ | |||
+ | <sxh xml> | ||
+ | <?xml version=" | ||
+ | <project xmlns=" | ||
+ | xsi: | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
===== Building Application ===== | ===== Building Application ===== | ||
+ | |||
+ | There is prepared batch file '' | ||
+ | |||
+ | <sxh bash> | ||
+ | set MAVEN_OPTS=" | ||
+ | mvn -Dws.url=https:// | ||
+ | </ | ||