Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

CreatingSecureVaadinApplicationsUsingJEE6.asciidoc 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. ---
  2. title: Creating Secure Vaadin Applications Using JEE6
  3. order: 49
  4. layout: page
  5. ---
  6. [[creating-secure-vaadin-applications-using-jee6]]
  7. = Creating secure Vaadin applications using JEE6
  8. by Petter Holmström
  9. [[introduction]]
  10. Introduction
  11. ~~~~~~~~~~~~
  12. In this article, we are going to look at how the security features of
  13. JEE6 and GlassFish 3 can be used to create a secure Vaadin application.
  14. You should be familiar with the security features of JEE6. If
  15. not, skim through Part VII of the
  16. http://docs.sun.com/app/docs/doc/820-7627[The Java EE 6 Tutorial, Volume
  17. I] before continuing.
  18. [[architecture]]
  19. Architecture
  20. ^^^^^^^^^^^^
  21. The example system we are going to discuss has the following
  22. architecture:
  23. image:img/architecture.png[System architecture]
  24. It is a typical JEE web application consisting of several layers. At the
  25. top, there is the client layer, i.e. the users' web browsers. Then comes
  26. the Internet (or any other network for that matter) through which the
  27. data travels between the client layer and the application server. On the
  28. server side, there are the web (or presentation) layer that contains the
  29. user interface - in this case our Vaadin application - and the
  30. enterprise (or application) layer that contains all our business logic
  31. in the form of Enterprise Java Beans (EJB). Finally, the domain layer
  32. contains the system data in the form of persistent entity objects stored
  33. in some relational database - in this case JavaDB - by some Object
  34. Relational Mapping (ORM) solution - in this case EclipseLink 2.0.
  35. In this article, we are going to secure all the layers, with the
  36. exception of the client layer. This means that once the data has reached
  37. the client it may be stored unencrypted in the browser's memory or
  38. downloaded to a disk, but that is a risk we are willing to take in this
  39. case ;-).
  40. [[getting-the-example-source-code]]
  41. Getting the Example Source Code
  42. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  43. This article is based around an example application that maintains
  44. employee records. Please note that the example system bears little
  45. resemblance to a similar real-world system in order to keep it simple
  46. and easy to understand.
  47. The source code can be downloaded
  48. https://github.com/eriklumme/doc-attachments/blob/master/attachments/SecureVaadinApplicationDemo.zip[here]
  49. and it has been packaged as a NetBeans project. If you do not have
  50. NetBeans, go to http://www.netbeans.org[the NetBeans web site] and
  51. download the latest version (6.8 at the time of writing). Remember to
  52. select the version that includes GlassFish v3.
  53. Once NetBeans and GlassFish are installed, you can unzip the source code
  54. archive and open it in NetBeans. The opened project should look
  55. something like this:
  56. image:img/nbscrshot1.png[Netbeans screenshot 1]
  57. However, before you can try out the application, you have to create a
  58. new JavaDB for the test data. This can be done from the Services tab
  59. inside NetBeans:
  60. image:img/nbscrshot2.png[Netbeans screenshot 2]
  61. When this is done, you should update the _setup/sun-resources.xml_ file
  62. accordingly, so that the correct username/password is used to connect to
  63. the database and the correct JNDI-resources are registered when the
  64. application is deployed.
  65. [[securing-the-domain-layer]]
  66. Securing the Domain Layer
  67. ~~~~~~~~~~~~~~~~~~~~~~~~~
  68. In this section we are not going to cover data encryption or Access
  69. Control Lists (ACL), so if that is what you need, you unfortunately have
  70. to look elsewhere for the time being. Instead, we are going to point out
  71. some things that need to be taken into account when designing the domain
  72. model.
  73. In a simple application where all users have read access to all data and
  74. some users have write access, the domain model can be designed basically
  75. in any way possible. However, if there are groups of users that should
  76. be given read access to only some parts of the data, things get a little
  77. more complicated.
  78. In the case of the example system written for this article, the system
  79. contains information that is not intended for everyone such as salaries,
  80. competences or individual career development plans (not included in the
  81. example code). The system will be used by different types of users
  82. (roles):
  83. * A payroll assistant will need read access to the employees' salaries
  84. in order to be able to calculate the paychecks. Write access should be
  85. prohibited.
  86. * A project manager will need read access to the employees' competences
  87. in order to be able to select the right people to his or her team.
  88. However, he or she has nothing to do with how much each employee is
  89. getting paid.
  90. * A director will need full access to the system in order to add new
  91. employees, change salaries, etc.
  92. To keep our lives simple, we should design the domain model in such a
  93. way that if a part of an object graph is readable by a certain role,
  94. then the entire graph should also be readable by the role:
  95. image:img/domain.png[Domain model]
  96. Here, all roles have read access to the `Employee` domain class. Please
  97. note that no associations point out from this class. Therefore, if we
  98. get an instance of `Employee`, we cannot accidentally (or intentionally)
  99. access restricted information by traversing through the object graph.
  100. If we take a look at the `SalaryInfo` domain class, we note that it has
  101. a unidirectional association to the `Employee` class. Thus, if we get an
  102. instance of `SalaryInfo`, we can also access all the information in the
  103. corresponding `Employee`. However, this is perfectly valid as the
  104. Payroll Assistant role has read access to both domain classes.
  105. Now it is time to move on to the enterprise layer, where the security
  106. constraints will actually be enforced.
  107. [[securing-the-enterprise-layer]]
  108. Securing the Enterprise Layer
  109. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  110. Securing the enterprise layer is actually the easiest part, as this is
  111. no different from securing EJBs in an ordinary JEE application. In this
  112. example, role-based security is sufficient so we can use annotations to
  113. secure the EJBs:
  114. [source,java]
  115. ....
  116. @Stateless
  117. @TransactionManagement
  118. public class EmployeeBean {
  119. // Implementations omitted
  120. @PersistenceContext
  121. private EntityManager entityManager;
  122. @RolesAllowed(UserRoles.ROLE_DIRECTOR)
  123. @TransactionAttribute(TransactionAttributeType.REQUIRED)
  124. public void insertEmployee(Employee employee) {
  125. ...
  126. }
  127. @RolesAllowed(UserRoles.ROLE_DIRECTOR)
  128. @TransactionAttribute(TransactionAttributeType.REQUIRED)
  129. public Employee updateEmployee(Employee employee) {
  130. ...
  131. }
  132. @RolesAllowed(UserRoles.ROLE_DIRECTOR)
  133. @TransactionAttribute(TransactionAttributeType.REQUIRED)
  134. public void deleteEmployee(Employee employee) {
  135. ...
  136. }
  137. @RolesAllowed({UserRoles.ROLE_DIRECTOR,
  138. UserRoles.ROLE_PAYROLL_ASSISTANT,
  139. UserRoles.ROLE_PROJECT_MANAGER})
  140. public Employee getEmployeeByPersonNumber(String personNumber) {
  141. ...
  142. }
  143. @RolesAllowed({UserRoles.ROLE_DIRECTOR, UserRoles.ROLE_PAYROLL_ASSISTANT})
  144. public SalaryInfo getSalaryInfo(Employee employee) {
  145. ...
  146. }
  147. @RolesAllowed({UserRoles.ROLE_DIRECTOR})
  148. @TransactionAttribute(TransactionAttributeType.REQUIRED)
  149. public SalaryInfo saveSalaryInfo(SalaryInfo salaryInfo) {
  150. ...
  151. }
  152. @RolesAllowed({UserRoles.ROLE_DIRECTOR, UserRoles.ROLE_PROJECT_MANAGER})
  153. public EmployeeCompetences getCompetences(Employee employee) {
  154. ...
  155. }
  156. @RolesAllowed({UserRoles.ROLE_DIRECTOR, UserRoles.ROLE_PROJECT_MANAGER})
  157. @TransactionAttribute(TransactionAttributeType.REQUIRED)
  158. public EmployeeCompetences saveCompetences(EmployeeCompetences competences) {
  159. ...
  160. }
  161. }
  162. ....
  163. The `UserRoles` class is a helper class that defines constants for all
  164. the role names:
  165. [source,java]
  166. ....
  167. public class UserRoles {
  168. public static final String ROLE_DIRECTOR = "DIRECTOR";
  169. public static final String ROLE_PAYROLL_ASSISTANT = "PAYROLL_ASSISTANT";
  170. public static final String ROLE_PROJECT_MANAGER = "PROJECT_MANAGER";
  171. }
  172. ....
  173. This is actually all there is to it - the container will take care of
  174. the rest. Note, that there are separate lookup methods for basic
  175. employee information and salary information, and that the methods
  176. require different roles. This is how the security constraints discussed
  177. in the previous section are enforced in practice.
  178. [[securing-the-web-layer]]
  179. Securing the Web Layer
  180. ~~~~~~~~~~~~~~~~~~~~~~
  181. As all of the application's data and logic should now be protected
  182. inside the enterprise layer, securing the web layer really comes down to
  183. two basic tasks: handling user authentication and disabling the
  184. restricted parts of your user interface. In the example application, the
  185. user interface has not been restricted in order to make it possible to
  186. test the security of the enterprise layer, e.g. what happens when a
  187. restriction actions is attempted.
  188. As the Vaadin application runs entirely on the server, this can be done
  189. inside the application in the same manner as in a Swing desktop
  190. application. However, an (arguably) better approach is to rely on
  191. standard JEE web layer security.
  192. To keep things simple, a Vaadin application should be designed in such a
  193. way that when the application starts, the user is already authenticated
  194. and when the user logs out, the application is closed. In this way, the
  195. JEE container handles the authentication and it is even possible to move
  196. from e.g. form-based authentication to certificate-based authentication
  197. without having to change a single line of code inside the Vaadin
  198. application.
  199. [[the-vaadin-application-servlet]]
  200. The Vaadin Application Servlet
  201. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  202. Here is the code for the application servlet:
  203. [source,java]
  204. ....
  205. @WebServlet(urlPatterns={"/ui/*", "/VAADIN/*"})
  206. public class DemoAppServlet extends AbstractApplicationServlet {
  207. @Inject Instance<DemoApp> application;
  208. @Override
  209. protected Class<? extends Application> getApplicationClass() throws
  210. ClassNotFoundException {
  211. return DemoApp.class;
  212. }
  213. @Override
  214. protected Application getNewApplication(HttpServletRequest request) throws
  215. ServletException {
  216. DemoApp app = application.get();
  217. Principal principal = request.getUserPrincipal();
  218. if (principal == null) {
  219. throw new ServletException("Access denied");
  220. }
  221. // In this example, a user can be in one role only
  222. if (request.isUserInRole(UserRoles.ROLE_DIRECTOR)) {
  223. app.setUserRole(UserRoles.ROLE_DIRECTOR);
  224. } else if (request.isUserInRole(UserRoles.ROLE_PAYROLL_ASSISTANT)) {
  225. app.setUserRole(UserRoles.ROLE_PAYROLL_ASSISTANT);
  226. } else if (request.isUserInRole(UserRoles.ROLE_PROJECT_MANAGER)) {
  227. app.setUserRole(UserRoles.ROLE_PROJECT_MANAGER);
  228. } else {
  229. throw new ServletException("Access denied");
  230. }
  231. app.setUser(principal);
  232. app.setLogoutURL(request.getContextPath() + "/logout.jsp");
  233. return app;
  234. }
  235. }
  236. ....
  237. Please note the URL patterns that this servlet handles. The URL for the
  238. Vaadin application will be _$CONTEXT_PATH/ui_. However, the servlet also
  239. has to handle requests to _$CONTEXT_PATH/VAADIN/*_, as the widgetsets
  240. and themes will not load otherwise.
  241. Next, in the `getNewApplication(..)` method, the user principal is
  242. fetched from the request and passed to the Vaadin application using the
  243. `setUser(..)` method (this is not a requirement, but is useful if the
  244. Vaadin application needs to know the identity of the current user). If
  245. the application will act differently depending on the user's roles,
  246. these have to be passed in as well - in this case using a custom setter
  247. defined in the `DemoApp` class. Finally, the logout URL is set to point
  248. to a custom JSP which we will look at in a moment.
  249. [[the-deployment-descriptor]]
  250. The Deployment Descriptor
  251. ^^^^^^^^^^^^^^^^^^^^^^^^^
  252. To make sure the user is authenticated when the Vaadin application is
  253. started, all requests to the Vaadin application should require
  254. authentication. In this example we are going to use form-based
  255. authentication using ordinary JSPs for the login, logout and error
  256. screens, but we could just as well use some other form of authentication
  257. such as certificates. In order to achieve this, we add the following to
  258. the `web.xml` deployment descriptor:
  259. [source,xml]
  260. ....
  261. <web-app>
  262. ...
  263. <security-constraint>
  264. <display-name>SecureApplicationConstraint</display-name>
  265. <web-resource-collection>
  266. <web-resource-name>Vaadin application</web-resource-name>
  267. <description>The entire Vaadin application is protected</description>
  268. <url-pattern>/ui/*</url-pattern>
  269. </web-resource-collection>
  270. <auth-constraint>
  271. <description>Only valid users are allowed</description>
  272. <role-name>DIRECTOR</role-name>
  273. <role-name>PAYROLL_ASSISTANT</role-name>
  274. <role-name>PROJECT_MANAGER</role-name>
  275. </auth-constraint>
  276. </security-constraint>
  277. <login-config>
  278. <auth-method>FORM</auth-method>
  279. <realm-name>file</realm-name>
  280. <form-login-config>
  281. <form-login-page>/login.jsp</form-login-page>
  282. <form-error-page>/loginError.jsp</form-error-page>
  283. </form-login-config>
  284. </login-config>
  285. <security-role>
  286. <description/>
  287. <role-name>DIRECTOR</role-name>
  288. </security-role>
  289. <security-role>
  290. <description/>
  291. <role-name>PAYROLL_ASSISTANT</role-name>
  292. </security-role>
  293. <security-role>
  294. <description/>
  295. <role-name>PROJECT_MANAGER</role-name>
  296. </security-role>
  297. ...
  298. </web-app>
  299. ....
  300. Basically, this file tells the container that this web application:
  301. * uses the roles DIRECTOR, PAYROLL_ASSISTANT and PROJECT_MANAGER,
  302. * requires the user to be in any of these roles when accessing the
  303. Vaadin application,
  304. * requires users to be in the _file_ realm (a built-in realm manageable
  305. from the GlassFish administration console), and
  306. * uses form-based authentication with a JSP for displaying the login
  307. form and another for displaying login errors.
  308. For more information about configuring security for JEE web
  309. applications, please see the JEE6 documentation.
  310. [[the-jsps]]
  311. The JSPs
  312. ^^^^^^^^
  313. Now we are going to write the JSPs that will be used for logging users
  314. in and out. These files are well covered in the JEE6 documentation, so
  315. we are just going to list them here without further commenting. First up
  316. is _login.jsp_:
  317. [source,html]
  318. ....
  319. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  320. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  321. <head>
  322. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  323. <title>Secure Vaadin Application Demo Login</title>
  324. </head>
  325. <body>
  326. <h1>Please login</h1>
  327. <form method="post" action="j_security_check">
  328. <p>
  329. Username: <input type="text" name="j_username"/>
  330. </p>
  331. <p>
  332. Password: <input type="password" name="j_password"/>
  333. </p>
  334. <p>
  335. <input type="submit" value="Login"/>
  336. </p>
  337. </form>
  338. </body>
  339. </html>
  340. ....
  341. Then we move on to _loginError.jsp_:
  342. [source,html]
  343. ....
  344. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  345. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  346. <head>
  347. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  348. <title>Secure Vaadin Application Demo Login Failure</title>
  349. </head>
  350. <body>
  351. <h1>Login Failed!</h1>
  352. <p>
  353. Please <a href="login.jsp">try again</a>.
  354. </p>
  355. </body>
  356. </html>
  357. ....
  358. Coming up next is _logout.jsp_:
  359. [source,html]
  360. ....
  361. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  362. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  363. <head>
  364. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  365. <title>Secure Vaadin Application Demo</title>
  366. </head>
  367. <body>
  368. <h1>You have been logged out</h1>
  369. <p>
  370. <a href="login.jsp">Log in</a> again.
  371. </p>
  372. </body>
  373. </html>
  374. <%
  375. session.invalidate();
  376. %>
  377. ....
  378. Please note that this file contains a single line of code at the end
  379. that invalidates the session, effectively logging the user out.
  380. Finally, an _index.jsp_ file is needed in order to make sure that any
  381. requests to the context path are redirected to the Vaadin application:
  382. [source,html]
  383. ....
  384. <%
  385. response.sendRedirect("ui/");
  386. %>
  387. ....
  388. There! Now the login and logout mechanisms are in place.
  389. [[securing-the-transport-layer]]
  390. Securing the Transport Layer
  391. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  392. Even though both the web layer and the enterprise layer are now secured,
  393. the data still has to travel across the Internet to reach the client
  394. layer and, as we know, the Internet is full of people with questionable
  395. intentions. Therefore, we need to make sure that the data reaches its
  396. destination undisclosed and unmodified. In other words, we need SSL.
  397. Provided that the application server has been properly configured to use
  398. SSL (GlassFish v3 should be out of the box, though with a self-signed
  399. certificate), it is very easy to force a web application to use SSL. We
  400. just have to add the following security constraint to the _web.xml_
  401. file:
  402. [source,xml]
  403. ....
  404. <security-constraint>
  405. <display-name>SecureChannelConstraint</display-name>
  406. <web-resource-collection>
  407. <web-resource-name>Entire site</web-resource-name>
  408. <description/>
  409. <url-pattern>/*</url-pattern>
  410. </web-resource-collection>
  411. <user-data-constraint>
  412. <description>Require encrypted channel</description>
  413. <transport-guarantee>CONFIDENTIAL</transport-guarantee>
  414. </user-data-constraint>
  415. </security-constraint>
  416. ....
  417. This will force all requests to the application to go over an encrypted
  418. SSL link.
  419. [[configuring-glassfish]]
  420. Configuring GlassFish
  421. ~~~~~~~~~~~~~~~~~~~~~
  422. As we are going to let GlassFish handle the user database, we have to do
  423. some additional configuration before the application can be deployed.
  424. Users created using the GlassFish administration console are assigned to
  425. groups, which in turn can be mapped to application roles. It is possible
  426. to configure GlassFish to automatically map a group name to a role with
  427. the same name, but in this case we are going to define the mapping
  428. manually by adding the following definitions to the _sun-web.xml_ file:
  429. [source,xml]
  430. ....
  431. <security-role-mapping>
  432. <role-name>DIRECTOR</role-name>
  433. <group-name>Directors</group-name>
  434. </security-role-mapping>
  435. <security-role-mapping>
  436. <role-name>PAYROLL_ASSISTANT</role-name>
  437. <group-name>Payroll Assistants</group-name>
  438. </security-role-mapping>
  439. <security-role-mapping>
  440. <role-name>PROJECT_MANAGER</role-name>
  441. <group-name>Project Managers</group-name>
  442. </security-role-mapping>
  443. ....
  444. These definitions tell GlassFish that all users that belong to the
  445. _Directors_ group should hold the `DIRECTOR` role, etc.
  446. The application is now secured. However, in order to try it out we need
  447. to add some users to the _file_ realm using the GlassFish Administration
  448. Console:
  449. image:img/glassfish_console1.png[Glassfish console 1]
  450. image:img/glassfish_console2.png[Glassfish console 2]
  451. Now, we can deploy the application, login with different users and
  452. explore what happens.
  453. [[adding-auditing]]
  454. Adding Auditing
  455. ~~~~~~~~~~~~~~~
  456. Although the application is now protected from unauthorized users, it
  457. has not yet been protected from illegal use by authorized users. As the
  458. application deals with sensitive personal information, it should be
  459. possible to see what the users have done with the data while using the
  460. system.
  461. GlassFish has an auditing system that, when turned on, automatically
  462. records access decisions (such as successful or failed logins). However,
  463. in this case we need some more fine-grained auditing. One way of
  464. accomplishing this is to use CDI and interceptors (go
  465. http://docs.jboss.org/webbeans/reference/1.0.0.PREVIEW1/en-US/html/interceptors.html[here]
  466. for more information).
  467. We begin by defining the annotation that will be used to annotate the
  468. methods that are to be subject to auditing:
  469. [source,java]
  470. ....
  471. @InterceptorBinding
  472. @Target({ElementType.METHOD, ElementType.TYPE})
  473. @Retention(RetentionPolicy.RUNTIME)
  474. public @interface AuditLog {
  475. }
  476. ....
  477. Next, we implement the actual interceptor:
  478. [source,java]
  479. ....
  480. @AuditLog
  481. @Interceptor
  482. public class AuditLogInterceptor {
  483. @Resource
  484. SessionContext sessionContext;
  485. @EJB
  486. AuditService auditService;
  487. @AroundInvoke
  488. public Object recordAuditLogEntry(InvocationContext ctx) throws Exception {
  489. Object result = ctx.proceed();
  490. StringBuilder sb = new StringBuilder();
  491. sb.append(ctx.getMethod().getName());
  492. sb.append("(");
  493. for (Object p : ctx.getParameters()) {
  494. sb.append(p);
  495. sb.append(",");
  496. }
  497. sb.append(")");
  498. String userName = sessionContext.getCallerPrincipal().getName();
  499. auditService.recordEntry(userName, sb.toString());
  500. return result;
  501. }
  502. }
  503. ....
  504. Before we can use the interceptor, we have to activate it by adding the
  505. following to the _beans.xml_ file:
  506. [source,xml]
  507. ....
  508. <interceptors>
  509. <class>demoapp.security.AuditLogInterceptor</class>
  510. </interceptors>
  511. ....
  512. Finally, we annotate the enterprise methods that should be subject to
  513. auditing:
  514. [source,java]
  515. ....
  516. @Stateless
  517. @TransactionManagement
  518. public class EmployeeBean {
  519. ...
  520. @RolesAllowed(UserRoles.ROLE_DIRECTOR)
  521. @TransactionAttribute(TransactionAttributeType.REQUIRED)
  522. @AuditLog
  523. public void insertEmployee(Employee employee) {
  524. ...
  525. }
  526. @RolesAllowed(UserRoles.ROLE_DIRECTOR)
  527. @TransactionAttribute(TransactionAttributeType.REQUIRED)
  528. @AuditLog
  529. public Employee updateEmployee(Employee employee) {
  530. ...
  531. }
  532. ...
  533. }
  534. ....
  535. There! Now, every time a method annotated with `@AuditLog` is
  536. successfully invoked, it will be recorded together with a timestamp and
  537. the name of the user who invoked it.
  538. [[summary]]
  539. Summary
  540. ~~~~~~~
  541. In this article, we have discussed how a typical Vaadin/JEE6 application
  542. can be secured. We have secured the enterprise layer using annotations,
  543. secured the web and channel layers by declaring security constraints in
  544. the deployment descriptor and shown how Vaadin can be used together with
  545. form-based authentication. Finally, we have looked at a way of
  546. implementing auditing using interceptors.